TUserManager manages a static list of users {@link TUser}. The user information is specified via module configuration using the following XML syntax, PHP configuration style: array( 'users' => array( 'class' => 'System.Security.TUserManager', 'properties' => array( 'PasswordMode' => 'Clear', ), 'users' => array( array('name'=>'Joe','password'=>'demo'), array('name'=>'John','password'=>'demo'), ), 'roles' => array( array('name'=>'Administrator','users'=>'John'), array('name'=>'Writer','users'=>'Joe,John'), ), ), ) 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, SHA1 or MD5. The default name for a guest user is Guest. It may be changed by setting {@link setGuestName GuestName} property. TUserManager may be used together with {@link TAuthManager} which manages how users are authenticated and authorized in a Prado application.
Since: 3.0
Author: Qiang Xue (qiang.xue@gmail.com)
Author: Carl Mathisen (carl@kamikazemedia.no)
Inheritance: extends Prado\TModule, implements IUserManager
示例#1
0
 public function testSwitchToGuest()
 {
     $userManager = new TUserManager();
     $userManager->init(self::$config);
     $user = $userManager->getUser('joe');
     $userManager->switchToGuest($user);
     self::assertTrue($user->getIsGuest());
 }