wcmf logo wemove logo

AuthUser Class Reference
[Security]

AuthUser provides a storage and methods for user data used for authentication/authorization purposes. This class requires php >= 4.1.0. More...

Inheritance diagram for AuthUser:

Inheritance graph
[legend]

Public Member Functions

 login ($login, $password, $isPasswordEncrypted=false)
 addPolicies ($policies)
 authorize ($actionKey)
 matchRoles ($val)
 parsePolicy ($val)
 setDefaultPolicy ($val)
 getLoginTime ()
 toString ()
 setLogin ($login)
 getLogin ()
 setPassword ($password)
 getPassword ()
 setName ($name)
 getName ()
 setFirstname ($firstname)
 getFirstname ()
 setConfig ($config)
 getConfig ()
 addRole ($rolename)
 removeRole ($rolename)
 hasRole ($rolename)
 getRoles ()
 getClassDefinitionFiles ()
 loadFromSession ()

Data Fields

 $_login_time = ""
 $_policies = array()
 $_defaulPolicy = true
 $_user = null

Detailed Description

AuthUser provides a storage and methods for user data used for authentication/authorization purposes. This class requires php >= 4.1.0.

wCMF - wemove Content Management Framework Copyright (C) 2005-2009 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id
class.AuthUser.php 929 2009-02-22 23:20:49Z iherwig

Author:
ingo herwig <ingo@wemove.com>

Definition at line 34 of file class.AuthUser.php.


Member Function Documentation

login ( login,
password,
isPasswordEncrypted = false 
)

Log a user into the application.

Parameters:
login The login string of the user
password The password string of the user
isPasswordEncrypted True/False wether the password is encrypted or not [default: false]
Returns:
True/False whether login succeeded.

Reimplemented in AnonymousUser.

Definition at line 48 of file class.AuthUser.php.

References $GLOBALS, addPolicies(), UserManager::encryptPassword(), getConfig(), PersistenceFacade::getInstance(), RightsManager::getInstance(), InifileParser::getInstance(), UserManager::getUserClassName(), PersistentObject::setOID(), and WCMFException::throwEx().

Here is the call graph for this function:

addPolicies ( policies  ) 

Adds one ore more policies to the policy repository of the user.

Parameters:
policies An associative array with the policy information (key=action, value=policy string).
Note:
A policy string looks like this "+*, -guest, +admin"

Definition at line 106 of file class.AuthUser.php.

References parsePolicy().

Referenced by login().

Here is the call graph for this function:

authorize ( actionKey  ) 

Checks, if the user is authorized for this action. Returns defaulPolicy if action key is not defined.

Parameters:
actionKey An action key string
Returns:
True/False whether authorization succeeded

Definition at line 124 of file class.AuthUser.php.

References matchRoles().

Here is the call graph for this function:

matchRoles ( val  ) 

Matches the roles of the user and the roles for a certain key

Parameters:
val An array containing policy information as an associative array with the keys ('default', 'allow', 'deny'). Where 'allow', 'deny' are arrays itselves holding roles. 'allow' overwrites 'deny' overwrites 'default'
Returns:
True/False whether the user has access right according to this policy.

Definition at line 141 of file class.AuthUser.php.

References hasRole().

Referenced by authorize().

Here is the call graph for this function:

parsePolicy ( val  ) 

Parse an policy string and returns an associative array with the keys ('default', 'allow', 'deny'). Where 'allow', 'deny' are arrays itselves holding roles. 'deny' overwrites 'allow' overwrites 'default'

Parameters:
val An role string (+*, +admin, -guest, entries without '+' or '-' prefix default to allow rules).
Returns:
An array containing the policy data as an associative array with the keys 'default', 'allow', 'deny'.

Definition at line 162 of file class.AuthUser.php.

Referenced by addPolicies(), and RightsManager::getRight().

setDefaultPolicy ( val  ) 

Assign the default policy.

Parameters:
val A boolean value.

Definition at line 197 of file class.AuthUser.php.

getLoginTime (  ) 

Get login time of the user.

Returns:
A formatted time string.

Definition at line 206 of file class.AuthUser.php.

toString (  ) 

Get a string representation of the user.

Returns:
The string

Definition at line 215 of file class.AuthUser.php.

setLogin ( login  ) 

Implementation of abstract base class methods. Delegates to internal user instance.

See also:
User::setLogin()

Reimplemented from User.

Definition at line 230 of file class.AuthUser.php.

getLogin (  ) 

See also:
User::getLogin()

Reimplemented from User.

Reimplemented in AnonymousUser.

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

setPassword ( password  ) 

See also:
User::setPassword()

Reimplemented from User.

Definition at line 249 of file class.AuthUser.php.

getPassword (  ) 

See also:
User::getPassword()

Reimplemented from User.

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

setName ( name  ) 

See also:
User::setName()

Reimplemented from User.

Definition at line 268 of file class.AuthUser.php.

getName (  ) 

See also:
User::getName()

Reimplemented from User.

Definition at line 277 of file class.AuthUser.php.

setFirstname ( firstname  ) 

See also:
User::setFirstname()

Reimplemented from User.

Definition at line 287 of file class.AuthUser.php.

getFirstname (  ) 

See also:
User::getFirstname()

Reimplemented from User.

Definition at line 296 of file class.AuthUser.php.

setConfig ( config  ) 

See also:
User::setConfig()

Reimplemented from User.

Definition at line 306 of file class.AuthUser.php.

getConfig (  ) 

See also:
User::getConfig()

Reimplemented from User.

Definition at line 315 of file class.AuthUser.php.

Referenced by login().

addRole ( rolename  ) 

See also:
User::addRole()

Definition at line 327 of file class.AuthUser.php.

removeRole ( rolename  ) 

See also:
User::removeRole()

Definition at line 335 of file class.AuthUser.php.

hasRole ( rolename  ) 

See also:
User::hasRole()

Reimplemented from User.

Definition at line 343 of file class.AuthUser.php.

Referenced by matchRoles().

getRoles (  ) 

See also:
User::getRoles()

Reimplemented from User.

Definition at line 354 of file class.AuthUser.php.

getClassDefinitionFiles (  ) 

Implementation of the storable interface.

See also:
Storable::getClassDefinitionFiles()

Reimplemented from Storable.

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

References ObjectFactory::getInstance(), InifileParser::getInstance(), and WCMFException::throwEx().

Here is the call graph for this function:

loadFromSession (  ) 

See also:
Storable::loadFromSession() Load the user object.

Reimplemented from Storable.

Definition at line 389 of file class.AuthUser.php.


Field Documentation

$_login_time = ""

Definition at line 36 of file class.AuthUser.php.

$_policies = array()

Definition at line 37 of file class.AuthUser.php.

$_defaulPolicy = true

Definition at line 38 of file class.AuthUser.php.

$_user = null

Definition at line 39 of file class.AuthUser.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:42 2009.
Copyright © 2009 wemove digital solutions GmbH.
sourceforge logo