From dcddd8cba228aae64c948ea742891b09524fd79b Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 25 Jun 2007 22:01:01 +0000 Subject: Added TAuthManager.ReturnUrlVarName property Added TPageService.DefaultPageUrl property --- framework/Security/TAuthManager.php | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'framework/Security/TAuthManager.php') diff --git a/framework/Security/TAuthManager.php b/framework/Security/TAuthManager.php index ef9f47f9..cbad51dc 100644 --- a/framework/Security/TAuthManager.php +++ b/framework/Security/TAuthManager.php @@ -47,15 +47,19 @@ class TAuthManager extends TModule /** * @var IUserManager user manager instance */ - private $_userManager=null; + private $_userManager; /** * @var string login page */ - private $_loginPage=null; + private $_loginPage; /** * @var boolean whether authorization should be skipped */ private $_skipAuthorization=false; + /** + * @var string the session var name for storing return URL + */ + private $_returnUrlVarName; /** * Initializes this module. @@ -67,6 +71,8 @@ class TAuthManager extends TModule { if($this->_userManager===null) throw new TConfigurationException('authmanager_usermanager_required'); + if($this->_returnUrlVarName===null) + $this->_returnUrlVarName=$this->getApplication()->getID().':'.self::RETURN_URL_VAR; $application=$this->getApplication(); if(is_string($this->_userManager)) { @@ -176,12 +182,28 @@ class TAuthManager extends TModule } } + /** + * @return string the name of the session variable storing return URL. It defaults to 'AppID:ReturnUrl' + */ + public function getReturnUrlVarName() + { + return $this->_returnUrlVarName; + } + + /** + * @param string the name of the session variable storing return URL. + */ + public function setReturnUrlVarName($value) + { + $this->_returnUrlVarName=$value; + } + /** * @return string URL that the browser should be redirected to when login succeeds. */ public function getReturnUrl() { - return $this->getSession()->itemAt(self::RETURN_URL_VAR); + return $this->getSession()->itemAt($this->getReturnUrlVarName()); } /** @@ -190,7 +212,7 @@ class TAuthManager extends TModule */ public function setReturnUrl($value) { - $this->getSession()->add(self::RETURN_URL_VAR,$value); + $this->getSession()->add($this->getReturnUrlVarName(),$value); } /** -- cgit v1.2.3