From: <gem...@li...> - 2011-11-24 18:38:13
|
Revision: 285 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=285&view=rev Author: matijsdejong Date: 2011-11-24 18:38:06 +0000 (Thu, 24 Nov 2011) Log Message: ----------- Small fixes in cookie handling. Modified Paths: -------------- trunk/library/classes/Gems/User/User.php Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2011-11-24 17:17:39 UTC (rev 284) +++ trunk/library/classes/Gems/User/User.php 2011-11-24 18:38:06 UTC (rev 285) @@ -374,7 +374,7 @@ $orgId = $this->_getVar('user_organization_id'); //If not set, read it from the cookie - if (is_null($orgId)) { + if ($this->isCurrentUser() && is_null($orgId)) { $orgId = Gems_Cookies::getOrganization(Zend_Controller_Front::getInstance()->getRequest()); } return $orgId; @@ -579,6 +579,19 @@ } /** + * Is this organization in the list of currently allowed organizations? + * + * @param int $organizationId + * @return boolean + */ + public function isAllowedOrganization($organizationId) + { + $orgs = $this->getAllowedOrganizations(); + + return isset($orgs[$organizationId]); + } + + /** * Checks if this user is the current user * * @return boolean @@ -731,10 +744,10 @@ $this->session->requestCache = $requestCache; } } - } - if (! Gems_Cookies::setOrganization($organizationId, $this->basepath->getBasePath())) { - throw new Exception($this->translate->_('Cookies must be enabled for this site.')); + if (! Gems_Cookies::setOrganization($organizationId, $this->basepath->getBasePath())) { + throw new Exception($this->translate->_('Cookies must be enabled for this site.')); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |