From: <gem...@li...> - 2011-10-25 16:59:54
|
Revision: 141 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=141&view=rev Author: matijsdejong Date: 2011-10-25 16:59:48 +0000 (Tue, 25 Oct 2011) Log Message: ----------- More philosophy on users Modified Paths: -------------- branches/newUser/classes/Gems/User/ProjectSuperUser.php branches/newUser/classes/Gems/User/UserAbstract.php Added Paths: ----------- branches/newUser/classes/Gems/User/DatabaseUserAbstract.php branches/newUser/classes/Gems/User/NoLoginUser.php Added: branches/newUser/classes/Gems/User/DatabaseUserAbstract.php =================================================================== --- branches/newUser/classes/Gems/User/DatabaseUserAbstract.php (rev 0) +++ branches/newUser/classes/Gems/User/DatabaseUserAbstract.php 2011-10-25 16:59:48 UTC (rev 141) @@ -0,0 +1,75 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage User + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage User + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4.4 + */ +class Gems_User_DatabaseUserAbstract extends Gems_User_UserAbstract +{ + protected $columnMappings = array( + 'user_id'=>'gsf_id_user', + 'user_login'=>'gsf_login', + //don't expose the password hash + //'user_password'=>'gsf_password', + 'user_email'=>'gsf_email', + 'user_group'=>'gsf_id_primary_group', + 'user_locale'=>'gsf_iso_lang', + 'user_logout'=>'gsf_logout_on_survey', + ); + + abstract function getSqlStatement(); + + /** + * Intialize the values for this user. + * + * Skipped when the user is the active user and is stored in the session. + * + * @param string $login_name + * @param int $organization Only used when more than one organization uses this $login_name + * @return boolean False when the object could not load. + */ + protected function initVariables($login_name, $organization) + { + + } +} Copied: branches/newUser/classes/Gems/User/NoLoginUser.php (from rev 139, branches/newUser/classes/Gems/User/ProjectSuperUser.php) =================================================================== --- branches/newUser/classes/Gems/User/NoLoginUser.php (rev 0) +++ branches/newUser/classes/Gems/User/NoLoginUser.php 2011-10-25 16:59:48 UTC (rev 141) @@ -0,0 +1,91 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage User + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage User + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4.4 + */ +class Gems_User_NoLoginUser extends Gems_User_UserAbstract +{ + /** + * + * @var Gems_Util_Translated + */ + protected $translated; + + /** + * Adapted constructor. This class hazs nu user name. + * + * @param int $organization Only used when more than one organization uses this $login_name + */ + public function __construct($organization) + { + parent::__construct(null, $organization); + } + + /** + * Check that the password is correct for this user. + * + * @param string $password Unencrypted password + * @return boolean + */ + public function checkPassword($password) + { + return false; + } + + /** + * Intialize the values for this user. + * + * Skipped when the user is the active user and is stored in the session. + * + * @param string $login_name + * @param int $organization Only used when more than one organization uses this $login_name + * @return boolean False when the object could not load. + */ + protected function initVariables($login_name, $organization) + { + $this->setRole('nologin'); + return true; + } + +} Modified: branches/newUser/classes/Gems/User/ProjectSuperUser.php =================================================================== --- branches/newUser/classes/Gems/User/ProjectSuperUser.php 2011-10-25 15:58:01 UTC (rev 140) +++ branches/newUser/classes/Gems/User/ProjectSuperUser.php 2011-10-25 16:59:48 UTC (rev 141) @@ -28,7 +28,7 @@ * * * @package Gems - * @subpackage + * @subpackage User * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License @@ -39,7 +39,7 @@ * * * @package Gems - * @subpackage + * @subpackage User * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License * @since Class available since version 1.4.4 @@ -49,14 +49,7 @@ const MIN_PASSWORD_LENGTH = 10; /** - * The role of this user. * - * @var string - */ - protected $_role = 'super'; - - /** - * * @var ArrayObject */ protected $project; @@ -113,7 +106,7 @@ */ protected function initVariables($login_name, $organization) { - $this->setRole('super'); + $this->setRole('super'); // sublime superior master diety ? return true; } Modified: branches/newUser/classes/Gems/User/UserAbstract.php =================================================================== --- branches/newUser/classes/Gems/User/UserAbstract.php 2011-10-25 15:58:01 UTC (rev 140) +++ branches/newUser/classes/Gems/User/UserAbstract.php 2011-10-25 16:59:48 UTC (rev 141) @@ -80,6 +80,7 @@ protected $session; /** + * Creates this class for the current user. * * @param string $login_name * @param int $organization Only used when more than one organization uses this $login_name @@ -242,13 +243,24 @@ // Clean up what is there now. $this->_vars->unsetAll(); - $this->session->unsetAll(); foreach ($oldStore as $name => $value) { $this->_vars->__set($name, $value); - $this->session->__set($name, $value); } + // Copy to session + // $this->session->unsetAll(); +// $this->session->user_id; + $this->session->user_login = $this->getLoginName(); +// $this->session->user_email; +// $this->session->user_group; +// $this->session->user_style; +// $this->session->user_locale; +// $this->session->user_logout; +// $this->session->user_name; + $this->session->user_role = $this->getRole(); + $this->session->user_organization_id = $this->getOrganizationId(); +// $this->session->user_organization_name; } return $this; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |