[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Security/ -> TUserManager.php (sommaire)

TUserManager class

Author: Qiang Xue <qiang.xue@gmail.com>
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TUserManager.php 1397 2006-09-07 07:55:53Z wei $
Poids: 283 lignes (8 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 2 classes

TUserManager:: (13 méthodes):
  init()
  loadUserData()
  getUsers()
  getRoles()
  getUserFile()
  setUserFile()
  getGuestName()
  setGuestName()
  getPasswordMode()
  setPasswordMode()
  validateUser()
  getUser()
  switchToGuest()

TUserManagerPasswordMode:: (0 méthodes):


Classe: TUserManager  - X-Ref

TUserManager class

TUserManager manages a static list of users {@link TUser}.
The user information is specified via module configuration using the following XML syntax,
<code>
<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>
</code>

In addition, user information can also be loaded from an external file
specified by {@link setUserFile 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
{@link setPasswordMode PasswordMode} as <b>Clear</b>, <b>SHA1</b> or <b>MD5</b>.
The default name for a guest user is <b>Guest</b>. It may be changed
by setting {@link setGuestName GuestName} property.

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

init($config)   X-Ref
Initializes the module.
This method is required by IModule and is invoked by application.
It loads user/role information from the module configuration.

param: TXmlElement module configuration

loadUserData($xmlNode)   X-Ref
Loads user/role information from an XML node.

param: TXmlElement the XML node containing the user information

getUsers()   X-Ref
Returns an array of all users.
Each array element represents a single user.
The array key is the username in lower case, and the array value is the
corresponding user password.

return: array list of users

getRoles()   X-Ref
Returns an array of user role information.
Each array element represents the roles for a single user.
The array key is the username in lower case, and the array value is
the roles (represented as an array) that the user is in.

return: array list of user role information

getUserFile()   X-Ref

return: string the full path to the file storing user/role information

setUserFile($value)   X-Ref

param: string user/role data file path (in namespace form). The file format is XML

getGuestName()   X-Ref

return: string guest name, defaults to 'Guest'

setGuestName($value)   X-Ref

param: string name to be used for guest users.

getPasswordMode()   X-Ref

return: TUserManagerPasswordMode how password is stored, clear text, or MD5 or SHA1 hashed. Default to TUserManagerPasswordMode::MD5.

setPasswordMode($value)   X-Ref

param: TUserManagerPasswordMode how password is stored, clear text, or MD5 or SHA1 hashed.

validateUser($username,$password)   X-Ref
Validates if the username and password are correct.

param: string user name
param: string password
return: boolean true if validation is successful, false otherwise.

getUser($username=null)   X-Ref
Returns a user instance given the user name.

param: string user name, null if it is a guest.
return: TUser the user instance, null if the specified username is not in the user database.

switchToGuest($user)   X-Ref
Sets a user as a guest.
User name is changed as guest name, and roles are emptied.

param: TUser the user to be changed to a guest.

Classe: TUserManagerPasswordMode  - X-Ref

TUserManagerPasswordMode class.
TUserManagerPasswordMode defines the enumerable type for the possible modes
that user passwords can be specified for a {@link TUserManager}.

The following enumerable values are defined:
- Clear: the password is in plain text
- MD5: the password is recorded as the MD5 hash value of the original password
- SHA1: the password is recorded as the SHA1 hash value of the original password



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7