## Class TUserManager

Description

TUserManager class

TUserManager manages a static list of users TUser. The user information is specified via module configuration using the following XML syntax,

     <module id="users" class="System.Security.TUserManager" PasswordMode="Clear">
       <user name="Joe" password="demo" />
       <user name="John" password="demo" />
       <role name="Administrator" users="John" />
       <role name="Writer" users="Joe,John" />
     </module>

In addition, user information can also be loaded from an external file specified by 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 PasswordMode as Clear, SH1 or MD5. The default name for a guest user is Guest. It may be changed by setting GuestName property.

TUserManager may be used together with TAuthManager which manages how users are authenticated and authorized in a Prado application.

- since: 3.0
- version: $Revision: $ $Date: $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Security/TUserManager.php (line 198)

    TComponent
       |
       --TApplicationComponent
          |
          --TModule
             |
             --TUserManager

Class Constant Summary
USER_FILE_EXT = '.xml'
Method Summary
string getGuestName ()
string getPasswordMode ()
TUser getUser ([string $username = null])
string getUserFile ()
void init (TXmlElement $config)
void setGuestName (string $value)
void setPasswordMode (string $value)
void setUserFile (string $value)
void switchToGuest (TUser $user)
boolean validateUser (string $username, string $password)
Methods
getGuestName (line 299)

- return: guest name, defaults to 'Guest'
- access: public

string getGuestName ()
getPasswordMode (line 315)

- return: (Clear|MD5|SH1) how password is stored, clear text, or MD5 or SH1 hashed. Default to MD5.
- access: public

string getPasswordMode ()
getUser (line 349)

Returns a user instance given the user name.

- return: the user instance, null if the specified username is not in the user database.
- access: public

TUser getUser ([string $username = null])

- string $username: user name, null if it is a guest.

Redefinition of:

TApplicationComponent::getUser()

getUserFile (line 277)

- return: the full path to the file storing user/role information
- access: public

string getUserFile ()
init (line 236)

Initializes the module.

This method is required by IModule and is invoked by application. It loads user/role information from the module configuration.

- access: public

void init (TXmlElement $config)

- TXmlElement $config: module configuration

Redefinition of:

TModule::init()
  Initializes the module.

setGuestName (line 307)

- access: public

void setGuestName (string $value)

- string $value: name to be used for guest users.

setPasswordMode (line 323)

- access: public

void setPasswordMode (string $value)

- string $value: (Clear|MD5|SH1) how password is stored, clear text, or MD5 or SH1 hashed.

setUserFile (line 288)

- access: public
- throws: TInvalidOperationException if the module is already initialized
- throws: TConfigurationException if the file is not in proper namespace format

void setUserFile (string $value)

- string $value: user/role data file path (in namespace form). The file format is XML whose content is similar to that user/role block in application configuration.

switchToGuest (line 379)

Sets a user as a guest.

User name is changed as guest name, and roles are emptied.

- access: public

void switchToGuest (TUser $user)

- TUser $user: the user to be changed to a guest.

validateUser (line 334)

Validates if the username and password are correct.

- return: true if validation is successful, false otherwise.
- access: public

boolean validateUser (string $username, string $password)

- string $username: user name
- string $password: password

#### Inherited Methods

Inherited From TModule

> TModule::getID()
> TModule::init()
> TModule::setID()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants
USER_FILE_EXT = '.xml' (line 203)

extension name to the user file

Documentation generated on Mon, 01 May 2006 23:05:00 -0400 by phpDocumentor 1.3.0RC4