From: <gem...@li...> - 2012-05-01 14:41:35
|
Revision: 650 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=650&view=rev Author: mennodekker Date: 2012-05-01 14:41:29 +0000 (Tue, 01 May 2012) Log Message: ----------- Merged revision(s) 649 from trunk: fixed error where project user could not login when db not yet created ........ Modified Paths: -------------- tags/1.5.3/library/classes/Gems/User/ProjectUserDefinition.php tags/1.5.3/library/classes/Gems/User/UserLoader.php tags/1.5.3/library/configs/db/tables/gems__organizations.20.sql Property Changed: ---------------- tags/1.5.3/ tags/1.5.3/library/ Property changes on: tags/1.5.3 ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 /trunk:620-625 + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 /trunk:620-625,649 Property changes on: tags/1.5.3/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /tags/1.5.1/library:485,489,509-510,534 /trunk/library:620-625 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /tags/1.5.1/library:485,489,509-510,534 /trunk/library:620-625,649 Modified: tags/1.5.3/library/classes/Gems/User/ProjectUserDefinition.php =================================================================== --- tags/1.5.3/library/classes/Gems/User/ProjectUserDefinition.php 2012-05-01 14:30:29 UTC (rev 649) +++ tags/1.5.3/library/classes/Gems/User/ProjectUserDefinition.php 2012-05-01 14:41:29 UTC (rev 650) @@ -74,6 +74,14 @@ */ public function getUserData($login_name, $organization) { + try { + $orgs = $this->db->fetchPairs("SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active = 1 ORDER BY gor_name"); + natsort($orgs); + } catch (Zend_Db_Exception $zde) { + // Table might not exist, so do something failsafe + $orgs = array($organization => 'create db first'); + } + return array( 'user_id' => 1, 'user_login' => $login_name, @@ -84,6 +92,7 @@ 'user_base_org_id' => $organization, 'user_allowed_ip_ranges' => $this->project->getSuperAdminIPRanges(), 'user_blockable' => false, + '__allowedOrgs' => $orgs ); } } \ No newline at end of file Modified: tags/1.5.3/library/classes/Gems/User/UserLoader.php =================================================================== --- tags/1.5.3/library/classes/Gems/User/UserLoader.php 2012-05-01 14:30:29 UTC (rev 649) +++ tags/1.5.3/library/classes/Gems/User/UserLoader.php 2012-05-01 14:41:29 UTC (rev 650) @@ -487,12 +487,14 @@ */ protected function getUserClass($login_name, $organization) { + //First check for project user, as this one can run without a db + if ($this->isProjectUser($login_name)) { + return $this->loadUser(self::USER_PROJECT, $organization, $login_name); + } + if ((null == $login_name) || (null == $organization)) { return $this->loadUser(self::USER_NOLOGIN, $organization, $login_name); } - if ($this->isProjectUser($login_name)) { - return $this->loadUser(self::USER_PROJECT, $organization, $login_name); - } try { $select = $this->getUserClassSelect($login_name, $organization); Modified: tags/1.5.3/library/configs/db/tables/gems__organizations.20.sql =================================================================== --- tags/1.5.3/library/configs/db/tables/gems__organizations.20.sql 2012-05-01 14:30:29 UTC (rev 649) +++ tags/1.5.3/library/configs/db/tables/gems__organizations.20.sql 2012-05-01 14:41:29 UTC (rev 650) @@ -4,7 +4,7 @@ gor_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, - gor_user_class varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'StaffUser' + gor_user_class varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'StaffUser', gor_location varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, gor_url varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, gor_url_base varchar(1270) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, @@ -25,7 +25,7 @@ gor_has_login boolean not null default 1, gor_has_respondents boolean not null default 0, gor_add_respondents boolean not null default 1, - gor_respondent_group bigint unsigned references gems__groups (ggp_id_group) null, + gor_respondent_group bigint unsigned null references gems__groups (ggp_id_group), gor_active boolean not null default 1, gor_changed timestamp not null default current_timestamp on update current_timestamp, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |