PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TUser

TUser class

TUser implements basic user functionality for a Prado application. To get the name of the user, use getName Name property. The property getIsGuest IsGuest tells if the user a guest/anonymous user. To obtain or test the roles that the user is in, use property getRoles Roles and call TUser::isInRole(), respectively.

TUser is meant to be used together with IUserManager.

TComponent
Extended by TUser implements IUser

Direct known subclasses

TDbUser
Package: System\Security
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.0
Located at Security/TUser.php
Methods summary
public
# __construct( IUserManager $manager )

Constructor.

Constructor.

Parameters

$manager
IUserManager
user manager

Overrides

TComponent::__construct()
public IUserManager
# getManager( )

Returns

IUserManager
user manager
public string
# getName( )

Returns

string
username, defaults to empty string.

Implementation of

IUser::getName()
public
# setName( string $value )

Parameters

$value
string
username

Implementation of

IUser::setName()
public boolean
# getIsGuest( )

Returns

boolean
if the user is a guest, defaults to true.

Implementation of

IUser::getIsGuest()
public
# setIsGuest( boolean $value )

Parameters

$value
boolean
if the user is a guest

Implementation of

IUser::setIsGuest()
public array
# getRoles( )

Returns

array
list of roles that the user is of

Implementation of

IUser::getRoles()
public array|string
# setRoles( mixed $value )

Returns

array|string
list of roles that the user is of. If it is a string, roles are assumed by separated by comma

Implementation of

IUser::setRoles()
public boolean
# isInRole( string $role )

Parameters

$role
string
role to be tested. Note, role is case-insensitive.

Returns

boolean
whether the user is of this role

Implementation of

IUser::isInRole()
public string
# saveToString( )

Returns

string
user data that is serialized and will be stored in session

Implementation of

IUser::saveToString()
public IUser
# loadFromString( string $data )

Parameters

$data
string
user data that is serialized and restored from session

Returns

IUser
the user object

Implementation of

IUser::loadFromString()
protected mixed
# getState( string $key, mixed $defaultValue = null )

Returns the value of a variable that is stored in user session.

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 TUser::setState() can be retrieved back using this function.

Parameters

$key
string
variable name
$defaultValue
mixed
default value

Returns

mixed
the value of the variable. If it doesn't exist, the provided default value will be returned

See

TUser::setState()
protected
# setState( string $key, mixed $value, mixed $defaultValue = null )

Stores a variable in user session.

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 TUser::getState(). The variable will be persistent across page requests during a user session.

Parameters

$key
string
variable name
$value
mixed
variable value
$defaultValue
mixed
default value. If $value===$defaultValue, the variable will be removed from persistent storage.

See

TUser::getState()
public boolean
# getStateChanged( )

Returns

boolean
whether user session state is changed (i.e., setState() is called)
public
# setStateChanged( boolean $value )

Parameters

$value
boolean
whether user session state is changed
Methods inherited from TComponent
__call(), __destruct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO