PHP 클래스 Prado\Security\TUserManager
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.
파일 보기
프로젝트 열기: pradosoft/prado
1 사용 예제들
공개 메소드들
비공개 메소드들
메소드 상세
public getPasswordMode ( ) : TUserManagerPasswordMode |
리턴 |
TUserManagerPasswordMode |
how password is stored, clear text, or MD5 or SHA1 hashed. Default to TUserManagerPasswordMode::MD5. |
Each array element represents the roles for a single user.
The array key is the username in lower case, and the array value is
the roles (represented as an array) that the user is in.
Returns a user instance given the user name.
public getUser ( $username = null ) : TUser |
리턴 |
TUser |
the user instance, null if the specified username is not in the user database. |
getUserFromCookie()
공개 메소드
Returns a user instance according to auth data stored in a cookie.
public getUserFromCookie ( $cookie ) : TUser |
리턴 |
TUser |
the user instance generated based on the cookie auth data, null if the cookie does not have valid auth data. |
Each array element represents a single user.
The array key is the username in lower case, and the array value is the
corresponding user password.
This method is required by IModule and is invoked by application.
It loads user/role information from the module configuration.
saveUserToCookie()
공개 메소드
Saves user auth data into a cookie.
User name is changed as guest name, and roles are emptied.
Validates if the username and password are correct.