Xataface 2.0
Xataface Application Framework
Public Member Functions | Data Fields
Dataface_PermissionsTool_Instance Class Reference

Public Member Functions

 __construct ($conf=null)
 setDelegate ($del)
getContext ()
 setContext ($context)
 clearContext ()
PUBLIC_CONTEXT ()
 addPermissions ($conf)
 getPermissions (&$obj, $params=array())
 filterPermissions (&$obj, &$perms)
 checkPermission ($permissionName, $perms, $params=array())
 view (&$perms, $params=array())
 edit (&$perms, $params=array())
 delete (&$perms, $params=array())
 MASK ()
 _zero ()
 _one ()
 NO_ACCESS ()
 READ_ONLY ()
 ALL ()
READ_EDIT ()
getRolePermissions ($roleName)
 roleExists ($roleName)
 namesAsArray ($permissions)
 namesAsString ($permissions)
 cachePermissions (&$record, $params, $perms)
 getCachedPermissions (&$record, $params)

Data Fields

 $_cache = array()
 $rolePermissions = array()
 $permissions = array()
 $context = null
 $delegate = null

Detailed Description

Definition at line 243 of file PermissionsTool.php.


Constructor & Destructor Documentation

__construct ( conf = null)

Definition at line 263 of file PermissionsTool.php.


Member Function Documentation

_one ( )

Definition at line 448 of file PermissionsTool.php.

_zero ( )

Definition at line 444 of file PermissionsTool.php.

addPermissions ( conf)

Adds permissions as loaded from a configuration file. Key/Value pairs are interpreted as being permission Name/Label pairs and key/Array(key/value) are interpreted as being a role defintion.

Definition at line 303 of file PermissionsTool.php.

ALL ( )

Reference to permissions array that has all permissions (view, edit, and delete). !! NOTE THAT THIS METHOD IS DEPRECATED AS OF VERSION 0.6 . PLEASE USE !! getRolePermissions() instead.

Definition at line 485 of file PermissionsTool.php.

cachePermissions ( &$  record,
params,
perms 
)

Definition at line 575 of file PermissionsTool.php.

checkPermission ( permissionName,
perms,
params = array() 
)

Checks to see if a particular permission is granted in an object or permissions array.

Parameters:
$permissionNameThe name of the permission to check (one of {'view','edit','delete'})
$permsThe object or permissions array to check. It this is an object it must be of type one of {Dataface_Table, Dataface_Record, or Dataface_Relationship}.
$paramsOptional field name in the case that param #2 is a table or record.

Definition at line 365 of file PermissionsTool.php.

clearContext ( )

Definition at line 286 of file PermissionsTool.php.

delete ( &$  perms,
params = array() 
)

Checks to see if an object or permissions array has delete permissions. !! NOTE THAT THIS METHOD IS DEPRECATED AS OF VERSION 0.6 . PLEASE USE !! getRolePermissions() instead.

Parameters:
$permsEither an object (Table or Record) or a permissions array.
2Optional name of a field we wish to check (only if $perms is a Table or Record).

Definition at line 421 of file PermissionsTool.php.

edit ( &$  perms,
params = array() 
)

Checks to see if an object or permissions array has edit permissions. !! NOTE THAT THIS METHOD IS DEPRECATED AS OF VERSION 0.6 . PLEASE USE !! getRolePermissions() instead.

Parameters:
$permsEither an object (Table or Record) or a permissions array.
2Optional name of a field we wish to check (only if $perms is a Table or Record).

Definition at line 408 of file PermissionsTool.php.

filterPermissions ( &$  obj,
&$  perms 
)

Definition at line 355 of file PermissionsTool.php.

getCachedPermissions ( &$  record,
params 
)

Definition at line 600 of file PermissionsTool.php.

& getContext ( )

Definition at line 280 of file PermissionsTool.php.

getPermissions ( &$  obj,
params = array() 
)

Gets the permissions of an object.

Parameters:
$objA Dataface_Table, Dataface_Record, or Dataface_Relationship record we wish to check.
2Optional field name whose permission we wish to check.

Definition at line 332 of file PermissionsTool.php.

& getRolePermissions ( roleName)

Returns the permissions that are assigned to a certain role. This allows a set of permissions to be grouped together and returned by getPermissions() methods. A role is essentially just a list of permissions that are associated with the name of the role. Roles can be defined in the permissions.ini files which are located in any table configuration folder, the application folder, or the dataface folder. Try to place the roles in the appropriate folder based on what it is most closely related to. For example, if the role is specifically related to one table then place it in the permissions.ini file for that table, but if it is more general you can place it in the permissions.ini file for the application. This will allow for better modularization and re-use of useful table definitions between applications. The goal here is to allow you to distribute your tables to others so that they can be added easily to other applications. If everything relating to the table is located in one folder then this becomes much easier.

Parameters:
$roleNameThe name of the role.
Returns:
An array of permissions (the keys are the permission names, and the values are the permission labels.

Definition at line 528 of file PermissionsTool.php.

MASK ( )

Definition at line 427 of file PermissionsTool.php.

namesAsArray ( permissions)

Returns a list of names of granted permissions in a given permissions array.

Definition at line 554 of file PermissionsTool.php.

namesAsString ( permissions)

Returns comma-delimited list of names of granted permissions in a given permissions array.

Definition at line 571 of file PermissionsTool.php.

NO_ACCESS ( )

Reference to static NO ACCESS permissions array.

Definition at line 455 of file PermissionsTool.php.

& PUBLIC_CONTEXT ( )

Definition at line 290 of file PermissionsTool.php.

& READ_EDIT ( )

Reference to permissions array that has read and edit access (but not delete). !! NOTE THAT THIS METHOD IS DEPRECATED AS OF VERSION 0.6 . PLEASE USE !! getRolePermissions() instead.

Definition at line 501 of file PermissionsTool.php.

READ_ONLY ( )

Reference to permissions array that have only view permissions. !! NOTE THAT THIS METHOD IS DEPRECATED AS OF VERSION 0.6 . PLEASE USE !! getRolePermissions() instead.

Definition at line 468 of file PermissionsTool.php.

roleExists ( roleName)

Definition at line 546 of file PermissionsTool.php.

setContext ( context)

Definition at line 281 of file PermissionsTool.php.

setDelegate ( del)

Definition at line 276 of file PermissionsTool.php.

view ( &$  perms,
params = array() 
)

Checks to see if an object or permissions array has view permissions. !! NOTE THAT THIS METHOD IS DEPRECATED AS OF VERSION 0.6 . PLEASE USE !! getRolePermissions() instead.

Parameters:
$permsEither an object (Table or Record) or a permissions array.
2Optional name of a field we wish to check (only if $perms is a Table or Record).

Definition at line 395 of file PermissionsTool.php.


Field Documentation

$_cache = array()

Definition at line 246 of file PermissionsTool.php.

$context = null

Definition at line 258 of file PermissionsTool.php.

$delegate = null

Definition at line 261 of file PermissionsTool.php.

$permissions = array()

Associative array of the loaded permissions. [Permission name] -> [Permission Label].

Definition at line 256 of file PermissionsTool.php.

$rolePermissions = array()

An associative array of role permissions available. [Role Name] -> array([Permission Name] -> [Allowed (0 or 1)])

Definition at line 251 of file PermissionsTool.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations