wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
UserManager Class Reference
+ Inheritance diagram for UserManager:

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, $newPassword, $newPasswordRepeated)
 
 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)
 

Public Attributes

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

Detailed Description

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

  • create/remove a user
  • create/remove a role
  • add/remove a user to/from a role
  • change a users password

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@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

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

Member Function Documentation

UserManager::UserManager (   $params)

Creates a UserManager Object.

Parameters
paramsInitialization 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:

UserManager::encryptPassword (   $password)

Encrypt a password using the md5 algorithm.

Parameters
passwordThe password to encrypt
Returns
The encrypted password.

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

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

UserManager::onError (   $message,
  $file = '',
  $line = '' 
)
UserManager::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.

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

UserManager::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.

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

UserManager::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.

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

Referenced by onError().

& UserManager::createUser (   $name,
  $firstname,
  $login,
  $password,
  $passwordRepeated 
)

Create a user login with a given password.

Parameters
nameThe name of the user
firstnameThe first name of the user
loginThe login of the user
passwordThe password of the user
passwordRepeatedThe password of the user again
Returns
A reference to the created user.

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

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

+ Here is the call graph for this function:

UserManager::removeUser (   $login)

Remove a user login.

Parameters
loginThe login of the user

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

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

Referenced by removePrincipal().

+ Here is the call graph for this function:

UserManager::setUserProperty (   $login,
  $property,
  $value 
)

Set a user property.

Parameters
loginThe login of the user
propertyOne of the USER_PROPERTY constants
valueThe value to set this property to

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

References DATATYPE_ATTRIBUTE, Message\get(), getUser(), onError(), setUserPropertyImpl(), USER_PROPERTY_CONFIG, USER_PROPERTY_FIRSTNAME, USER_PROPERTY_LOGIN, and USER_PROPERTY_NAME.

Referenced by addUserToRole(), and removeUserFromRole().

+ Here is the call graph for this function:

UserManager::resetPassword (   $login,
  $newPassword,
  $newPasswordRepeated 
)

Reset a users password.

Parameters
loginThe login of the user
newPasswordThe new password for the user
newPasswordRepeatedThe new password of the user again

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

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

+ Here is the call graph for this function:

UserManager::changePassword (   $login,
  $oldPassword,
  $newPassword,
  $newPasswordRepeated 
)

Change a users password.

Parameters
loginThe login of the user
oldPasswordThe old password of the user
newPasswordThe new password for the user
newPasswordRepeatedThe new password of the user again

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

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

+ Here is the call graph for this function:

& UserManager::createRole (   $name)

Create a role.

Parameters
nameThe name of the role
Returns
A reference to the created role.

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

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

+ Here is the call graph for this function:

UserManager::removeRole (   $name)

Remove a role.

Parameters
nameThe name of the role

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

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

Referenced by removePrincipal().

+ Here is the call graph for this function:

UserManager::setRoleProperty (   $name,
  $property,
  $value 
)

Set a role property.

Parameters
nameThe name of the role
propertyOne of the ROLE_PROPERTY constants
valueThe value to set this property to

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

References DATATYPE_ATTRIBUTE, Message\get(), getRole(), onError(), ROLE_PROPERTY_NAME, and setRolePropertyImpl().

+ Here is the call graph for this function:

UserManager::addUserToRole (   $rolename,
  $login 
)

Add a user to a role.

Parameters
rolenameThe name of the role
loginThe login of the user

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

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

+ Here is the call graph for this function:

UserManager::removeUserFromRole (   $rolename,
  $login 
)

Remove a user from a role.

Parameters
rolenameThe name of the role
loginThe login of the user

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

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

+ Here is the call graph for this function:

UserManager::listUsers ( )

Get list of all users.

Returns
An array containing all login names

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

UserManager::listRoles ( )

Get list of all roles.

Returns
An array containing all role names

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

UserManager::listUserRoles (   $login)

Get list of all roles a user has.

Returns
An array containing all role names of the user

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

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

Referenced by listRoleMembers().

+ Here is the call graph for this function:

UserManager::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 429 of file class.UserManager.php.

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

+ Here is the call graph for this function:

& UserManager::getUser (   $login)

Get a user from the repository.

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

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

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

& UserManager::getRole (   $name)

Get a role from the repository.

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

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

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

& UserManager::getPrincipal (   $oid)

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

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

Definition at line 485 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:

UserManager::removePrincipal (   $oid)

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

Parameters
oidThe oid of the principal

Definition at line 512 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:

UserManager::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 539 of file class.UserManager.php.

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

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

+ Here is the call graph for this function:

UserManager::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 553 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:

UserManager::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
paramsInitialization 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

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

References WCMFException\throwEx().

Referenced by UserManager().

+ Here is the call graph for this function:

& UserManager::createUserImpl (   $name,
  $firstname,
  $login,
  $password 
)

Create a user login with a given password.

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

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

References WCMFException\throwEx().

Referenced by createUser().

+ Here is the call graph for this function:

UserManager::removeUserImpl ( $user)

Remove a user.

Parameters
userA reference to the user
Note
This method is responsible for removing the user from all roles it has
Precondition: The login does exist

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

References WCMFException\throwEx().

Referenced by removeUser().

+ Here is the call graph for this function:

UserManager::setUserPropertyImpl ( $user,
  $property,
  $value 
)

Set a user property.

Parameters
userA reference to the user
propertyOne of the USER_PROPERTY constants or 'password'
valueThe value to set this property to

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

References WCMFException\throwEx().

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

+ Here is the call graph for this function:

& UserManager::createRoleImpl (   $name)

Create a role.

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

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

References WCMFException\throwEx().

Referenced by createRole().

+ Here is the call graph for this function:

UserManager::removeRoleImpl ( $role)

Remove a role.

Parameters
roleA 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

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

References WCMFException\throwEx().

Referenced by removeRole().

+ Here is the call graph for this function:

UserManager::setRolePropertyImpl ( $role,
  $property,
  $value 
)

Set a role property.

Parameters
roleA reference to the role
propertyOne of the ROLE_PROPERTY constants
valueThe value to set this property to

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

References WCMFException\throwEx().

Referenced by setRoleProperty().

+ Here is the call graph for this function:

UserManager::addUserToRoleImpl ( $role,
$user 
)

Add a user to a role.

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

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

References WCMFException\throwEx().

Referenced by addUserToRole().

+ Here is the call graph for this function:

UserManager::removeUserFromRoleImpl ( $role,
$user 
)

Remove a user from a role.

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

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

References WCMFException\throwEx().

Referenced by removeUserFromRole().

+ Here is the call graph for this function:

Member Data Documentation

UserManager::$_initParams = null

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

UserManager::$_userRepository = null

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

UserManager::$_roleConfig = null

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


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