Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
Public Member Functions | Static Public Member Functions
Dataface_PermissionsTool Class Reference

Public Member Functions

 getPortalRecordPermissions (Dataface_Record $record, $params=array())
 getPortalFieldPermissions (Dataface_Record $record, $params=array())
 Wrapper around getContextMask() to get the permissions for a record through the context of a portal.

Static Public Member Functions

static & getInstance ()
static setDelegate ($del)
static addContextMask (Dataface_RelatedRecord $contextRecord)
static removeContextMask (Dataface_RelatedRecord $contextRecord)
static & getContextMasks ()
static & getContextMask ($id, $fieldname=null)
static & getContext ()
static setContext ($context)
static clearContext ()
static & PUBLIC_CONTEXT ()
static addPermissions ($conf)
static getPermissions (&$obj, $params=array())
static filterPermissions (&$obj, &$perms, $params=array())
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 193 of file PermissionsTool.php.

static _zero ( )
static

Definition at line 189 of file PermissionsTool.php.

static addContextMask ( Dataface_RelatedRecord  $contextRecord)
static
Since
2.0
See Also
Dataface_PermissionsTool_Instance::addContextMask()

Definition at line 48 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 120 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 218 of file PermissionsTool.php.

static cachePermissions ( $record,
  $params,
  $perms 
)
static

Definition at line 276 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 145 of file PermissionsTool.php.

static clearContext ( )
static

Definition at line 107 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 180 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 168 of file PermissionsTool.php.

static filterPermissions ( $obj,
$perms,
  $params = array() 
)
static

Definition at line 135 of file PermissionsTool.php.

static getCachedPermissions ( $record,
  $params 
)
static

Definition at line 281 of file PermissionsTool.php.

static& getContext ( )
static

Definition at line 102 of file PermissionsTool.php.

static& getContextMask (   $id,
  $fieldname = null 
)
static
Since
2.0
See Also
Dataface_PermissionsTool_Instance::getContextMask()

Definition at line 74 of file PermissionsTool.php.

static& getContextMasks ( )
static
Since
2.0
See Also
Dataface_PermissionsTool_Instance::getContextMasks()

Definition at line 65 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 131 of file PermissionsTool.php.

getPortalFieldPermissions ( Dataface_Record  $record,
  $params = array() 
)

Wrapper around getContextMask() to get the permissions for a record through the context of a portal.

Returns
array(
perm:
tring =>

val:boolean)

Since
2.0
See Also
Dataface_PermissionsTool_Instance::getPortalFieldPermissions()

Definition at line 97 of file PermissionsTool.php.

getPortalRecordPermissions ( Dataface_Record  $record,
  $params = array() 
)
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 249 of file PermissionsTool.php.

static MASK ( )
static

Definition at line 184 of file PermissionsTool.php.

static namesAsArray (   $permissions)
static

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

Definition at line 263 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 272 of file PermissionsTool.php.

static NO_ACCESS ( )
static

Reference to static NO ACCESS permissions array.

Definition at line 200 of file PermissionsTool.php.

static& PUBLIC_CONTEXT ( )
static

Definition at line 111 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 227 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 209 of file PermissionsTool.php.

static removeContextMask ( Dataface_RelatedRecord  $contextRecord)
static
static roleExists (   $roleName)
static

Definition at line 255 of file PermissionsTool.php.

static setContext (   $context)
static

Definition at line 103 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 156 of file PermissionsTool.php.


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