Xataface 2.0
Xataface Application Framework
Static Public Member Functions
Dataface_PermissionsTool Class Reference

Static Public Member Functions

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

Detailed Description

Definition at line 25 of file PermissionsTool.php.


Member Function Documentation

static _one ( ) [static]

Definition at line 135 of file PermissionsTool.php.

static _zero ( ) [static]

Definition at line 131 of file PermissionsTool.php.

static addPermissions ( conf) [static]

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 62 of file PermissionsTool.php.

static ALL ( ) [static]

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 160 of file PermissionsTool.php.

static cachePermissions ( &$  record,
params,
perms 
) [static]

Definition at line 218 of file PermissionsTool.php.

static checkPermission ( permissionName,
perms,
params = array() 
) [static]

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 87 of file PermissionsTool.php.

static clearContext ( ) [static]

Definition at line 49 of file PermissionsTool.php.

static delete ( &$  perms,
params = array() 
) [static]

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 122 of file PermissionsTool.php.

static edit ( &$  perms,
params = array() 
) [static]

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 110 of file PermissionsTool.php.

static filterPermissions ( &$  obj,
&$  perms 
) [static]

Definition at line 77 of file PermissionsTool.php.

static getCachedPermissions ( &$  record,
params 
) [static]

Definition at line 223 of file PermissionsTool.php.

static& getContext ( ) [static]

Definition at line 44 of file PermissionsTool.php.

static& getInstance ( ) [static]

Gets singleton instance of permissions tool. This is to be called statically.

Definition at line 31 of file PermissionsTool.php.

static getPermissions ( &$  obj,
params = array() 
) [static]

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 73 of file PermissionsTool.php.

static& getRolePermissions ( roleName) [static]

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 191 of file PermissionsTool.php.

static MASK ( ) [static]

Definition at line 126 of file PermissionsTool.php.

static namesAsArray ( permissions) [static]

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

Definition at line 205 of file PermissionsTool.php.

static namesAsString ( permissions) [static]

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

Definition at line 214 of file PermissionsTool.php.

static NO_ACCESS ( ) [static]

Reference to static NO ACCESS permissions array.

Definition at line 142 of file PermissionsTool.php.

static& PUBLIC_CONTEXT ( ) [static]

Definition at line 53 of file PermissionsTool.php.

static& READ_EDIT ( ) [static]

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 169 of file PermissionsTool.php.

static READ_ONLY ( ) [static]

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 151 of file PermissionsTool.php.

static roleExists ( roleName) [static]

Definition at line 197 of file PermissionsTool.php.

static setContext ( context) [static]

Definition at line 45 of file PermissionsTool.php.

static setDelegate ( del) [static]

Definition at line 40 of file PermissionsTool.php.

static view ( &$  perms,
params = array() 
) [static]

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 98 of file PermissionsTool.php.


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