PHP 클래스 Prado\Security\TUser

TUser implements basic user functionality for a Prado application. To get the name of the user, use {@link getName Name} property. The property {@link getIsGuest IsGuest} tells if the user a guest/anonymous user. To obtain or test the roles that the user is in, use property {@link getRoles Roles} and call {@link isInRole()}, respectively. TUser is meant to be used together with {@link IUserManager}.
부터: 3.0
저자: Qiang Xue ([email protected])
상속: extends Prado\TComponent, implements Prado\Security\IUser
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( IUserManager $manager ) Constructor.
getIsGuest ( ) : boolean
getManager ( ) : IUserManager
getName ( ) : string
getRoles ( ) : array
getStateChanged ( ) : boolean
isInRole ( $role ) : boolean
loadFromString ( $data ) : Prado\Security\IUser
saveToString ( ) : string
setIsGuest ( $value )
setName ( $value )
setRoles ( $value ) : array | string
setStateChanged ( $value )

보호된 메소드들

메소드 설명
getState ( $key, $defaultValue = null ) : mixed Returns the value of a variable that is stored in user session.
setState ( $key, $value, $defaultValue = null ) Stores a variable in user session.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( IUserManager $manager )
$manager IUserManager

getIsGuest() 공개 메소드

public getIsGuest ( ) : boolean
리턴 boolean if the user is a guest, defaults to true.

getManager() 공개 메소드

public getManager ( ) : IUserManager
리턴 IUserManager user manager

getName() 공개 메소드

public getName ( ) : string
리턴 string username, defaults to empty string.

getRoles() 공개 메소드

public getRoles ( ) : array
리턴 array list of roles that the user is of

getState() 보호된 메소드

This function is designed to be used by TUser descendant classes who want to store additional user information in user session. A variable, if stored in user session using {@link setState} can be retrieved back using this function.
또한 보기: setState
protected getState ( $key, $defaultValue = null ) : mixed
리턴 mixed the value of the variable. If it doesn't exist, the provided default value will be returned

getStateChanged() 공개 메소드

public getStateChanged ( ) : boolean
리턴 boolean whether user session state is changed (i.e., setState() is called)

isInRole() 공개 메소드

public isInRole ( $role ) : boolean
리턴 boolean whether the user is of this role

loadFromString() 공개 메소드

public loadFromString ( $data ) : Prado\Security\IUser
리턴 Prado\Security\IUser the user object

saveToString() 공개 메소드

public saveToString ( ) : string
리턴 string user data that is serialized and will be stored in session

setIsGuest() 공개 메소드

public setIsGuest ( $value )

setName() 공개 메소드

public setName ( $value )

setRoles() 공개 메소드

public setRoles ( $value ) : array | string
리턴 array | string list of roles that the user is of. If it is a string, roles are assumed by separated by comma

setState() 보호된 메소드

This function is designed to be used by TUser descendant classes who want to store additional user information in user session. By storing a variable using this function, the variable may be retrieved back later using {@link getState}. The variable will be persistent across page requests during a user session.
또한 보기: getState
protected setState ( $key, $value, $defaultValue = null )

setStateChanged() 공개 메소드

public setStateChanged ( $value )