PHP Class 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}.
Show file
Open project: pradosoft/prado
Class Usage Examples
Public Methods
Protected Methods
Method |
Description |
|
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. |
|
Method Details
__construct()
public method
public __construct ( IUserManager $manager ) |
$manager |
IUserManager |
|
getIsGuest()
public method
getManager()
public method
public getManager ( ) : IUserManager |
return |
IUserManager |
user manager |
getState()
protected method
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.
protected getState ( $key, $defaultValue = null ) : mixed |
return |
mixed |
the value of the variable. If it doesn't exist, the provided default value will be returned |
getStateChanged()
public method
loadFromString()
public method
public loadFromString ( $data ) : Prado\Security\IUser |
return |
Prado\Security\IUser |
the user object |
saveToString()
public method
setIsGuest()
public method
public setRoles ( $value ) : array | string |
return |
array | string |
list of roles that the user is of. If it is a string, roles are assumed by separated by comma |
setState()
protected method
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.
protected setState ( $key, $value, $defaultValue = null ) |
setStateChanged()
public method