wcmf logo wemove logo

UserManager Class Reference
[Security]

UserManager is used to edit users and roles. UserManager supports the following operations: More...

Inheritance diagram for UserManager:

Inheritance graph
[legend]

Public Member Functions

 UserManager ($params)
 encryptPassword ($password)
 onError ($message, $file='', $line='')
 startTransaction ()
 commitTransaction ()
 rollbackTransaction ()
createUser ($name, $firstname, $login, $password, $passwordRepeated)
 removeUser ($login)
 setUserProperty ($login, $property, $value)
 resetPassword ($login)
 changePassword ($login, $oldPassword, $newPassword, $newPasswordRepeated)
createRole ($name)
 removeRole ($name)
 setRoleProperty ($name, $property, $value)
 addUserToRole ($rolename, $login)
 removeUserFromRole ($rolename, $login)
 listUsers ()
 listRoles ()
 listUserRoles ($login)
 listRoleMembers ($rolename)
getUser ($login)
getRole ($name)
getPrincipal ($oid)
 removePrincipal ($oid)
 getUserClassName ()
 getRoleClassName ()
 initialize ($params)
createUserImpl ($name, $firstname, $login, $password)
 removeUserImpl (&$user)
 setUserPropertyImpl (&$user, $property, $value)
createRoleImpl ($name)
 removeRoleImpl (&$role)
 setRolePropertyImpl (&$role, $property, $value)
 addUserToRoleImpl (&$role, &$user)
 removeUserFromRoleImpl (&$role, &$user)

Data Fields

 $_initParams = null
 $_userRepository = null
 $_roleConfig = null

Detailed Description

UserManager is used to edit users and roles. UserManager supports the following operations:

This class defines abstract methods that subclasses must implement to support different user repositories. The UserManager implementation class is defined by the configuration key 'UserManager' in the [implementation] section.

Todo:
  • Use RightsManager to restrict access to methods (except changePassword)
    • Transaction support
Author:
ingo herwig <ingo@wemove.com>

Definition at line 52 of file class.UserManager.php.


Member Function Documentation

UserManager ( params  ) 

Creates a UserManager Object.

Parameters:
params Initialization data given in an associative array as needed to load the user repository

Definition at line 62 of file class.UserManager.php.

References InifileParser::getInstance(), and initialize().

Here is the call graph for this function:

encryptPassword ( password  ) 

Encrypt a password using the md5 algorithm.

Parameters:
password The password to encrypt
Returns:
The encrypted password.

Definition at line 78 of file class.UserManager.php.

Referenced by changePassword(), createUser(), LoginController::executeKernel(), and AuthUser::login().

onError ( message,
file = '',
line = '' 
)

startTransaction (  ) 

Start a transaction. If implemented, the UserManager will collect a number of actions and execute them on commitTransaction(). If not implemented the UserManager will execute these actions on every call of the appropriate function.

Reimplemented in UserManagerXML.

Definition at line 97 of file class.UserManager.php.

commitTransaction (  ) 

Commit a transaction. If implemented, the UserManager will execute a number of actions that it collected since the call to startTransaction(). If not implemented the UserManager will execute these actions on every call of the appropriate function.

Reimplemented in UserManagerXML.

Definition at line 104 of file class.UserManager.php.

rollbackTransaction (  ) 

Rollback a transaction. If implemented, the UserManager will rollback a number of actions that it collected since the call to startTransaction(). If not implemented the UserManager will execute these actions on every call of the appropriate function.

Reimplemented in UserManagerXML.

Definition at line 111 of file class.UserManager.php.

Referenced by onError().

& createUser ( name,
firstname,
login,
password,
passwordRepeated 
)

Create a user login with a given password.

Parameters:
name The name of the user
firstname The first name of the user
login The login of the user
password The password of the user
passwordRepeated The password of the user again
Returns:
A reference to the created user.

Definition at line 122 of file class.UserManager.php.

References createUserImpl(), encryptPassword(), Message::get(), getUser(), and onError().

Here is the call graph for this function:

removeUser ( login  ) 

Remove a user login.

Parameters:
login The login of the user

Definition at line 146 of file class.UserManager.php.

References Message::get(), getUser(), onError(), and removeUserImpl().

Referenced by removePrincipal().

Here is the call graph for this function:

setUserProperty ( login,
property,
value 
)

Set a user property.

Parameters:
login The login of the user
property One of the USER_PROPERTY constants
value The value to set this property to

Definition at line 167 of file class.UserManager.php.

References Message::get(), getUser(), onError(), and setUserPropertyImpl().

Referenced by addUserToRole(), and removeUserFromRole().

Here is the call graph for this function:

resetPassword ( login  ) 

Reset a users password to empty.

Parameters:
login The login of the user

Definition at line 191 of file class.UserManager.php.

References Message::get(), getUser(), onError(), and setUserPropertyImpl().

Here is the call graph for this function:

changePassword ( login,
oldPassword,
newPassword,
newPasswordRepeated 
)

Change a users password.

Parameters:
login The login of the user
oldPassword The old password of the user
newPassword The new password for the user
newPasswordRepeated The new password of the user again

Definition at line 211 of file class.UserManager.php.

References encryptPassword(), Message::get(), getUser(), onError(), and setUserPropertyImpl().

Here is the call graph for this function:

& createRole ( name  ) 

Create a role.

Parameters:
name The name of the role
Returns:
A reference to the created role.

Definition at line 239 of file class.UserManager.php.

References createRoleImpl(), Message::get(), getRole(), and onError().

Here is the call graph for this function:

removeRole ( name  ) 

Remove a role.

Parameters:
name The name of the role

Definition at line 258 of file class.UserManager.php.

References Message::get(), getRole(), onError(), and removeRoleImpl().

Referenced by removePrincipal().

Here is the call graph for this function:

setRoleProperty ( name,
property,
value 
)

Set a role property.

Parameters:
name The name of the role
property One of the ROLE_PROPERTY constants
value The value to set this property to

Definition at line 279 of file class.UserManager.php.

References Message::get(), getRole(), onError(), and setRolePropertyImpl().

Here is the call graph for this function:

addUserToRole ( rolename,
login 
)

Add a user to a role.

Parameters:
rolename The name of the role
login The login of the user

Definition at line 304 of file class.UserManager.php.

References addUserToRoleImpl(), Message::get(), getRole(), getUser(), onError(), and setUserProperty().

Here is the call graph for this function:

removeUserFromRole ( rolename,
login 
)

Remove a user from a role.

Parameters:
rolename The name of the role
login The login of the user

Definition at line 325 of file class.UserManager.php.

References Message::get(), getRole(), getUser(), onError(), removeUserFromRoleImpl(), and setUserProperty().

Here is the call graph for this function:

listUsers (  ) 

Get list of all users.

Returns:
An array containing all login names

Definition at line 345 of file class.UserManager.php.

listRoles (  ) 

Get list of all roles.

Returns:
An array containing all role names

Definition at line 357 of file class.UserManager.php.

listUserRoles ( login  ) 

Get list of all roles a user has.

Returns:
An array containing all role names of the user

Definition at line 369 of file class.UserManager.php.

References Message::get(), getUser(), and onError().

Referenced by listRoleMembers().

Here is the call graph for this function:

listRoleMembers ( rolename  ) 

Get list of all users that have a role.

Returns:
An array containing all login names of the role members

Definition at line 384 of file class.UserManager.php.

References Message::get(), getRole(), listUserRoles(), and onError().

Here is the call graph for this function:

& getUser ( login  ) 

Get a user from the repository.

Parameters:
login The login of the user
Returns:
A reference to the matching User object or null if the user does not exist

Definition at line 404 of file class.UserManager.php.

Referenced by addUserToRole(), changePassword(), createUser(), listUserRoles(), removeUser(), removeUserFromRole(), resetPassword(), and setUserProperty().

& getRole ( name  ) 

Get a role from the repository.

Parameters:
name The name of the role
Returns:
A reference to the matching Role object or null if the role does not exist

Definition at line 420 of file class.UserManager.php.

Referenced by addUserToRole(), createRole(), listRoleMembers(), removeRole(), removeUserFromRole(), and setRoleProperty().

& getPrincipal ( oid  ) 

Get a principal (type: user/role) from the repository.

Parameters:
oid The oid of the principal
Returns:
A reference to the matching User/Role object or null if the principal does not exist

Definition at line 436 of file class.UserManager.php.

References PersistenceFacade::decomposeOID(), Message::get(), getRoleClassName(), getUserClassName(), and onError().

Referenced by removePrincipal().

Here is the call graph for this function:

removePrincipal ( oid  ) 

Remove a principal (type: user/role) from the repository.

Parameters:
oid The oid of the principal

Definition at line 460 of file class.UserManager.php.

References PersistenceFacade::decomposeOID(), Message::get(), getPrincipal(), getRoleClassName(), getUserClassName(), onError(), removeRole(), and removeUser().

Here is the call graph for this function:

getUserClassName (  ) 

Get the user implemenataion class name as configured in config section 'implementation' key 'User'. Maybe used in a static way.

Returns:
The class name

Definition at line 483 of file class.UserManager.php.

References InifileParser::getInstance(), and onError().

Referenced by UserManagerXML::createUserImpl(), UserManagerRDB::createUserImpl(), UserManagerXML::createUserInstance(), UserController::executeKernel(), PrincipalController::executeKernel(), LockManagerRDB::getLockImpl(), getPrincipal(), User::getUser(), UserManagerRDB::initialize(), AuthUser::login(), and removePrincipal().

Here is the call graph for this function:

getRoleClassName (  ) 

Get the role implemenataion class name as configured in config section 'implementation' key 'Role'. Maybe used in a static way.

Returns:
The class name

Definition at line 496 of file class.UserManager.php.

References InifileParser::getInstance(), and onError().

Referenced by UserManagerRDB::createRoleImpl(), UserManagerXML::createRoleInstance(), PrincipalController::executeKernel(), getPrincipal(), User::getRoleByName(), User::getRoles(), UserManagerRDB::initialize(), and removePrincipal().

Here is the call graph for this function:

initialize ( params  ) 

Methods to be implemented by subclasses. Get the user and roles. This method is called before any operation on the repository. Subclasses will override this method to get the data from the application repository.

Parameters:
params Initialization data given in an associative array as needed to load the user repository
Returns:
An assoziative array with the keys 'users' and 'roles' holding user and role objects respectively

Reimplemented in UserManagerRDB, UserManagerRDB, and UserManagerXML.

Definition at line 514 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by UserManager().

Here is the call graph for this function:

& createUserImpl ( name,
firstname,
login,
password 
)

Create a user login with a given password.

Parameters:
name The name of the user
firstname The first name of the user
login The login of the user
password The encrypted password of the user
Returns:
A reference to the created user
Note:
Precondition: The login does not exist

Reimplemented in UserManagerRDB, UserManagerRDB, and UserManagerXML.

Definition at line 528 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by createUser().

Here is the call graph for this function:

removeUserImpl ( &$  user  ) 

Remove a user.

Parameters:
user A reference to the user
Note:
This method is responsible for removing the user from all roles it has

Precondition: The login does exist

Reimplemented in UserManagerRDB, and UserManagerXML.

Definition at line 539 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by removeUser().

Here is the call graph for this function:

setUserPropertyImpl ( &$  user,
property,
value 
)

Set a user property.

Parameters:
user A reference to the user
property One of the USER_PROPERTY constants or 'password'
value The value to set this property to

Reimplemented in UserManagerRDB, and UserManagerXML.

Definition at line 550 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by changePassword(), resetPassword(), and setUserProperty().

Here is the call graph for this function:

& createRoleImpl ( name  ) 

Create a role.

Parameters:
name The name of the role
Returns:
A reference to the created role
Note:
Precondition: The role does not exist

Reimplemented in UserManagerRDB, UserManagerRDB, and UserManagerXML.

Definition at line 561 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by createRole().

Here is the call graph for this function:

removeRoleImpl ( &$  role  ) 

Remove a role.

Parameters:
role A reference to the role
Note:
This method is responsible for removing the role from all users it is attached to

Precondition: The role does exist

Reimplemented in UserManagerRDB, and UserManagerXML.

Definition at line 572 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by removeRole().

Here is the call graph for this function:

setRolePropertyImpl ( &$  role,
property,
value 
)

Set a role property.

Parameters:
role A reference to the role
property One of the ROLE_PROPERTY constants
value The value to set this property to

Reimplemented in UserManagerRDB, and UserManagerXML.

Definition at line 583 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by setRoleProperty().

Here is the call graph for this function:

addUserToRoleImpl ( &$  role,
&$  user 
)

Add a user to a role.

Parameters:
role A reference to the role
user A reference to the user
Note:
Precondition: user and role do exist and the user does not have the role

Reimplemented in UserManagerRDB, and UserManagerXML.

Definition at line 594 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by addUserToRole().

Here is the call graph for this function:

removeUserFromRoleImpl ( &$  role,
&$  user 
)

Remove a user from a role.

Parameters:
role A reference to the role
user A reference to the user
Note:
Precondition: user and role do exist and the user does have the role

Reimplemented in UserManagerRDB, and UserManagerXML.

Definition at line 605 of file class.UserManager.php.

References WCMFException::throwEx().

Referenced by removeUserFromRole().

Here is the call graph for this function:


Field Documentation

$_initParams = null

Reimplemented in UserManagerXML.

Definition at line 54 of file class.UserManager.php.

$_userRepository = null

Definition at line 55 of file class.UserManager.php.

$_roleConfig = null

Definition at line 56 of file class.UserManager.php.


The documentation for this class was generated from the following file:

This page generated via doxygen 1.5.8 Mon Mar 30 01:58:46 2009.
Copyright © 2009 wemove digital solutions GmbH.
sourceforge logo