HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
RAuthorizer Class Reference

Public Member Functions

 init ()
 getRoles ($includeSuperuser=true, $sort=true)
 createAuthItem ($name, $type, $description= '', $bizRule=null, $data=null)
 updateAuthItem ($oldName, $name, $description= '', $bizRule=null, $data=null)
 getAuthItems ($types=null, $userId=null, CAuthItem $parent=null, $sort=true, $exclude=array())
 getAuthItemParents ($item, $type=null, $parentName=null, $direct=false)
 getAuthItemChildren ($item, $type=null)
 attachAuthItemBehavior ($items, $userId=null, CAuthItem $parent=null)
 getSuperusers ()
 attachUserBehavior ($users)
 isSuperuser ($userId)
 getPermissions ($itemName=null)
 hasPermission ($itemName, $parentName=null, $permissions=array())
 getAuthManager ()

Public Attributes

 $superuserName

Protected Member Functions

 mergeAuthItems ($array1, $array2)
 excludeInvalidAuthItems ($items, CAuthItem $parent=null, $exclude=array())
 sanitizeExpression ($code)

Private Member Functions

 getAuthItemParentsRecursive ($itemName, $items, $direct)
 getPermissionsRecursive (CAuthItem $item)

Private Attributes

 $_authManager

Detailed Description

Rights authorizer component class file.

Author
Christoffer Niska cnisk.nosp@m.a@li.nosp@m.ve.co.nosp@m.m
Since
0.5

Definition at line 10 of file RAuthorizer.php.

Member Function Documentation

RAuthorizer::attachAuthItemBehavior (   $items,
  $userId = null,
CAuthItem  $parent = null 
)

Attaches the rights authorization item behavior to the given item.

Parameters
mixed$itemsthe item or items to which attach the behavior.
int$userIdthe ID of the user to which the item is assigned.
CAuthItem$parentthe parent of the given item.
Returns
mixed the item or items with the behavior attached.

Definition at line 292 of file RAuthorizer.php.

Here is the caller graph for this function:

RAuthorizer::attachUserBehavior (   $users)

Attaches the rights user behavior to the given users.

Parameters
mixed$usersthe user or users to which attach the behavior.
Returns
mixed the user or users with the behavior attached.

Definition at line 350 of file RAuthorizer.php.

Here is the call graph for this function:

Here is the caller graph for this function:

RAuthorizer::createAuthItem (   $name,
  $type,
  $description = '',
  $bizRule = null,
  $data = null 
)

Creates an authorization item.

Parameters
string$namethe item name. This must be a unique identifier.
integer$typethe item type (0: operation, 1: task, 2: role).
string$descriptionthe description for the item.
string$bizRulebusiness rule associated with the item. This is a piece of PHP code that will be executed when checkAccess is called for the item.
mixed$dataadditional data associated with the item.
Returns
CAuthItem the authorization item

Definition at line 60 of file RAuthorizer.php.

Here is the call graph for this function:

RAuthorizer::excludeInvalidAuthItems (   $items,
CAuthItem  $parent = null,
  $exclude = array() 
)
protected

Excludes invalid authorization items. When an item is provided its parents and children are excluded aswell.

Parameters
array$itemsthe authorization items to process.
CAuthItem$parentthe item to check valid authorization items for.
array$excludeadditional items to be excluded.
Returns
array valid authorization items.

Definition at line 164 of file RAuthorizer.php.

Here is the call graph for this function:

Here is the caller graph for this function:

RAuthorizer::getAuthItemChildren (   $item,
  $type = null 
)

Returns the children for the specified authorization item recursively.

Parameters
mixed$itemthe item for which to get its children.
integer$typethe item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type.
Returns
array the names of the item's children.

Definition at line 264 of file RAuthorizer.php.

Here is the call graph for this function:

RAuthorizer::getAuthItemParents (   $item,
  $type = null,
  $parentName = null,
  $direct = false 
)

Returns the parents of the specified authorization item.

Parameters
mixed$itemthe item name for which to get its parents.
integer$typethe item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type.
string$parentNamethe name of the item in which permissions to search.
boolean$directwhether we want the specified items parent or all parents.
Returns
array the names of the parent items.

Definition at line 200 of file RAuthorizer.php.

Here is the call graph for this function:

Here is the caller graph for this function:

RAuthorizer::getAuthItemParentsRecursive (   $itemName,
  $items,
  $direct 
)
private

Returns the parents of the specified authorization item recursively.

Parameters
string$itemNamethe item name for which to get its parents.
array$itemsthe items to process.
boolean$directwhether we want the specified items parent or all parents.
Returns
the names of the parents items recursively.

Definition at line 231 of file RAuthorizer.php.

Here is the caller graph for this function:

RAuthorizer::getAuthItems (   $types = null,
  $userId = null,
CAuthItem  $parent = null,
  $sort = true,
  $exclude = array() 
)

Returns the authorization items of the specific type and user.

Parameters
mixed$typesthe item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type.
mixed$userIdthe user ID. Defaults to null, meaning returning all items even if they are not assigned to a user.
CAuthItem$parentthe item for which to get the select options.
boolean$sortsort items by to weights.
array$excludethe items to be excluded.
Returns
array the authorization items of the specific type.

Definition at line 109 of file RAuthorizer.php.

Here is the call graph for this function:

Here is the caller graph for this function:

RAuthorizer::getAuthManager ( )
Returns
RAuthManager the authorization manager.

Definition at line 512 of file RAuthorizer.php.

RAuthorizer::getPermissions (   $itemName = null)

Returns the permissions for a specific authorization item.

Parameters
string$itemNamethe name of the item for which to get permissions. Defaults to null, meaning that the full permission tree is returned.
Returns
the permission tree.

Definition at line 390 of file RAuthorizer.php.

Here is the call graph for this function:

Here is the caller graph for this function:

RAuthorizer::getPermissionsRecursive ( CAuthItem  $item)
private

Returns the permissions for a specific authorization item recursively.

Parameters
CAuthItem$itemthe item for which to get permissions.
Returns
array the section of the permissions tree.

Definition at line 413 of file RAuthorizer.php.

Here is the caller graph for this function:

RAuthorizer::getRoles (   $includeSuperuser = true,
  $sort = true 
)

Returns the a list of all roles.

Parameters
boolean$includeSuperuserwhether to include the superuser.
boolean$sortwhether to sort the items by their weights.
Returns
the roles.

Definition at line 39 of file RAuthorizer.php.

Here is the call graph for this function:

Here is the caller graph for this function:

RAuthorizer::getSuperusers ( )

Returns the users with superuser privileges.

Returns
the superusers.

Definition at line 313 of file RAuthorizer.php.

Here is the call graph for this function:

RAuthorizer::hasPermission (   $itemName,
  $parentName = null,
  $permissions = array() 
)

Returns the permission type for an authorization item.

Parameters
string$itemNamethe name of the item to check permission for.
string$parentNamethe name of the item in which permissions to look.
array$permissionsthe permissions.
Returns
integer the permission type (0: None, 1: Direct, 2: Inherited).

Definition at line 435 of file RAuthorizer.php.

Here is the call graph for this function:

RAuthorizer::init ( )

Initializes the authorizer.

Definition at line 24 of file RAuthorizer.php.

RAuthorizer::isSuperuser (   $userId)

Returns whether the user is a superuser.

Parameters
integer$userIdthe id of the user to do the check for.
Returns
boolean whether the user is a superuser.

Definition at line 375 of file RAuthorizer.php.

RAuthorizer::mergeAuthItems (   $array1,
  $array2 
)
protected

Merges two arrays with authorization items preserving the keys.

Parameters
array$array1the items to merge to.
array$array2the items to merge from.
Returns
array the merged items.

Definition at line 143 of file RAuthorizer.php.

Here is the caller graph for this function:

RAuthorizer::sanitizeExpression (   $code)
protected

Tries to sanitize code to make it safe for execution.

Parameters
string$codethe code to be execute.
Returns
mixed the return value of eval() or null if the code was unsafe to execute.

Definition at line 467 of file RAuthorizer.php.

Here is the caller graph for this function:

RAuthorizer::updateAuthItem (   $oldName,
  $name,
  $description = '',
  $bizRule = null,
  $data = null 
)

Updates an authorization item.

Parameters
string$oldNamethe item name. This must be a unique identifier.
integer$namethe item type (0: operation, 1: task, 2: role).
string$descriptionthe description for the item.
string$bizRulebusiness rule associated with the item. This is a piece of PHP code that will be executed when checkAccess is called for the item.
mixed$dataadditional data associated with the item.

Definition at line 81 of file RAuthorizer.php.

Here is the call graph for this function:

Member Data Documentation

RAuthorizer::$_authManager
private

Definition at line 19 of file RAuthorizer.php.

RAuthorizer::$superuserName

Definition at line 15 of file RAuthorizer.php.


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