From 29130c17def4e63475b3fd775f48832e8d07bda0 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 2 Apr 2006 15:39:57 +0000 Subject: Added TParameterModule. --- framework/Security/TUserManager.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'framework/Security/TUserManager.php') diff --git a/framework/Security/TUserManager.php b/framework/Security/TUserManager.php index 5ad582e1..5bd18d0c 100644 --- a/framework/Security/TUserManager.php +++ b/framework/Security/TUserManager.php @@ -168,12 +168,19 @@ class TUser extends TComponent implements IUser * * TUserManager manages a static list of users {@link TUser}. * The user information is specified via module configuration using the following XML syntax, + * * * * * * * + * + * + * In addition, user information can also be loaded from an external file + * specified by {@link setUserFile UserFile} property. Note, the property + * only accepts a file path in namespace format. The user file format is + * similar to the above sample. * * The user passwords may be specified as clear text, SH1 or MD5 hashed by setting * {@link setPasswordMode PasswordMode} as Clear, SH1 or MD5. @@ -228,18 +235,13 @@ class TUserManager extends TModule */ public function init($config) { + $this->loadUserData($config); if($this->_userFile!==null) { - if(is_file($this->_userFile)) - { - $dom=new TXmlDocument; - $dom->loadFromFile($this->_userFile); - $this->loadUserData($dom); - } - else - throw new TConfigurationException('usermanager_userfile_invalid',$this->_userFile); + $dom=new TXmlDocument; + $dom->loadFromFile($this->_userFile); + $this->loadUserData($dom); } - $this->loadUserData($config); $this->_initialized=true; } @@ -287,7 +289,7 @@ class TUserManager extends TModule { if($this->_initialized) throw new TInvalidOperationException('usermanager_userfile_unchangeable'); - else if(($this->_userFile=Prado::getPathOfNamespace($value,self::USER_FILE_EXT))===null) + else if(($this->_userFile=Prado::getPathOfNamespace($value,self::USER_FILE_EXT))===null || !is_file($this->_userFile)) throw new TConfigurationException('usermanager_userfile_invalid',$value); } -- cgit v1.2.3