- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages: default System System.Caching System.Collections System.Data System.Data.ActiveRecord System.Data.ActiveRecord.Relations System.Data.ActiveRecord.Scaffold System.Data.ActiveReecord.Scaffold.InputBuilder System.Data.Commom.Sqlite System.Data.Common System.Data.Common.Mssql System.Data.Common.Mysql System.Data.Common.Oracle System.Data.Common.Pgsql System.Data.Common.Sqlite System.Data.DataGateway System.Data.SqlMap System.Data.SqlMap.Configuration System.Data.SqlMap.Statements System.Exceptions System.I18N System.IO System.Security System.Util System.Web System.Web.Services System.Web.UI System.Web.UI.ActiveControls System.Web.UI.WebControls System.Web.UI.WebControls.assets System.Xml Classes: IUserManager TAuthManager TAuthorizationRule TAuthorizationRuleCollection TDbUser TDbUserManager TSecurityManager TSecurityManagerValidationMode TUser TUserManager TUserManagerPasswordMode |
Keyword
# Class TUser
    TComponent
       |
       --TUser
#### Direct Known Sub-classes: TDbUser TUser class TUser implements basic user functionality for a Prado application. To get the name of the user, use Name property. The property IsGuest tells if the user a guest/anonymous user. To obtain or test the roles that the user is in, use property Roles and call isInRole(), respectively. TUser is meant to be used together with IUserManager. Since: 3.0 Author: Qiang Xue <qiang.xue@gmail.com>
Constructor Summary
public | __construct Array Constructor.
Method Summary
boolean | getIsGuest ()
IUserManager | getManager ()
string | getName ()
array | getRoles ()
protected mixed | getState ( string $key, mixed $defaultValue) Returns the value of a variable that is stored in user session.
boolean | getStateChanged ()
boolean | isInRole ( string $role)
IUser | loadFromString ( string $data)
string | saveToString ()
void | setIsGuest ( boolean $value)
void | setName ( string $value)
array|string | setRoles ( mixed $value)
protected void | setState ( string $key, mixed $value, mixed $defaultValue) Stores a variable in user session.
void | setStateChanged ( boolean $value)
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()
Constructor Details
## __construct
public __construct | Array
Constructor.
Method Details
## getIsGuest
public boolean getIsGuest | ()
Output
boolean | if the user is a guest, defaults to true.
Exception
## getManager
public IUserManager getManager | ()
Output
IUserManager | user manager
Exception
## getName
public string getName | ()
Output
string | username, defaults to empty string.
Exception
## getRoles
public array getRoles | ()
Output
array | list of roles that the user is of
Exception
## getState
protected mixed getState | (string $key , mixed $defaultValue )
Returns the value of a variable that is stored in user session. 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 setState can be retrieved back using this function.
Input
string | $key | variable name
mixed | $defaultValue | default value
Output
mixed | the value of the variable. If it doesn't exist, the provided default value will be returned
Exception
## getStateChanged
public boolean getStateChanged | ()
Output
boolean | whether user session state is changed (i.e., setState() is called)
Exception
## isInRole
public boolean isInRole | (string $role )
Input
string | $role | role to be tested. Note, role is case-insensitive.
Output
boolean | whether the user is of this role
Exception
## loadFromString
public IUser loadFromString | (string $data )
Input
string | $data | user data that is serialized and restored from session
Output
IUser | the user object
Exception
## saveToString
public string saveToString | ()
Output
string | user data that is serialized and will be stored in session
Exception
## setIsGuest
public void setIsGuest | (boolean $value )
Input
boolean | $value | if the user is a guest
Output
Exception
## setName
public void setName | (string $value )
Input
string | $value | username
Output
Exception
## setRoles
public array|string setRoles | (mixed $value )
Input
mixed | $value |
Output
array|string | list of roles that the user is of. If it is a string, roles are assumed by separated by comma
Exception
## setState
protected void setState | (string $key , mixed $value , mixed $defaultValue )
Stores a variable in user session. 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 getState. The variable will be persistent across page requests during a user session.
Input
string | $key | variable name
mixed | $value | variable value
mixed | $defaultValue | default value. If $value===$defaultValue, the variable will be removed from persistent storage.
Output
Exception
## setStateChanged
public void setStateChanged | (boolean $value )
Input
boolean | $value | whether user session state is changed
Output
Exception