eZ Publish  [4.2]
eZPolicy Class Reference

Defines a policy in the permission system. More...

+ Inheritance diagram for eZPolicy:
+ Collaboration diagram for eZPolicy:

List of all members.

Public Member Functions

 accessArray ($ignoreLimitIdentifier=false)
 appendLimitation ($identifier, $values)
 copy ($roleID)
 eZPolicy ($row)
 limitationList ($useCache=true, $ignoreLimitIdentifier=false)
 limitIdentifier ()
 limitValue ()
 removeThis ($id=false)
 role ()
 setAttribute ($attr, $val)
 userRoleID ()

Static Public Member Functions

static create ($roleID, $module, $function)
static createNew ($roleID, $params=array())
static definition ()
static fetch ($policyID)
static removeByID ($id)

Public Attributes

 $Disabled = false
 $LimitIdentifier
 $LimitValue
 $UserRoleID

Detailed Description

Defines a policy in the permission system.

Definition at line 41 of file ezpolicy.php.


Member Function Documentation

eZPolicy::accessArray ( ignoreLimitIdentifier = false)

Generate access array from this policy.

return access array

Definition at line 268 of file ezpolicy.php.

eZPolicy::appendLimitation ( identifier,
values 
)

Appends a new policy limitation to the current policy and returns it.

Note:
The limitation and it's values will be stored to the database before returning.
Parameters:
$identifierThe identifier for the limitation, e.g. 'Class'
$valuesArray of values to store for limitation.
Note:
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 186 of file ezpolicy.php.

eZPolicy::copy ( roleID)
Note:
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 217 of file ezpolicy.php.

static eZPolicy::create ( roleID,
module,
function 
) [static]

Creates a new policy assigned to the role identified by ID $roleID and returns it.

Note:
The policy is not stored.
Parameters:
$moduleWhich module to give access to or true to give access to all modules.
$functionWhich function to give access to or true to give access to all functions.
$limitationsAn associative array with limitations and their values, use an empty array for no limitations.

Definition at line 164 of file ezpolicy.php.

Referenced by appendLimitation().

static eZPolicy::createNew ( roleID,
params = array() 
) [static]
Note:
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 139 of file ezpolicy.php.

Referenced by copy().

static eZPolicy::definition ( ) [static]
Returns:
the definition for the object, the default implementation is to return an empty array. It's upto each inheriting class to return a proper definition array.

The definition array is an associative array consists of these keys:

  • fields - an associative array of fields which defines which database field (the key) is to fetched and how they map to object member variables (the value).
  • keys - an array of fields which is used for uniquely identifying the object in the table.
  • function_attributes - an associative array of attributes which maps to member functions, used for fetching data with functions.
  • set_functions - an associative array of attributes which maps to member functions, used for setting data with functions.
  • increment_key - the field which is incremented on table inserts.
  • class_name - the classname which is used for instantiating new objecs when fetching from the database.
  • sort - an associative array which defines the default sorting of lists, the key is the table field while the value is the sorting method which is either asc or desc.
  • name - the name of the database table

Example:

static function definition()
{
    return array( "fields" => array( "id" => "ID",
                                     "version" => "Version",
                                     "name" => "Name" ),
                  "keys" => array( "id", "version" ),
                  "function_attributes" => array( "current" => "currentVersion",
                                                  "class_name" => "className" ),
                  "increment_key" => "id",
                  "class_name" => "eZContentClass",
                  "sort" => array( "id" => "asc" ),
                  "name" => "ezcontentclass" );
}

Reimplemented from eZPersistentObject.

Definition at line 52 of file ezpolicy.php.

Referenced by fetch(), and eZRole\policyList().

eZPolicy::eZPolicy ( row)

Constructor

Definition at line 46 of file ezpolicy.php.

Referenced by create(), and createNew().

static eZPolicy::fetch ( policyID) [static]
eZPolicy::limitationList ( useCache = true,
ignoreLimitIdentifier = false 
)

Fetch limitation array()

Parameters:
uselimitation cache, true by default.

Definition at line 298 of file ezpolicy.php.

Referenced by accessArray().

eZPolicy::limitIdentifier ( )

Definition at line 86 of file ezpolicy.php.

eZPolicy::limitValue ( )

Definition at line 91 of file ezpolicy.php.

static eZPolicy::removeByID ( id) [static]
See also:
removeThis

Definition at line 236 of file ezpolicy.php.

eZPolicy::removeThis ( id = false)
Note:
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 250 of file ezpolicy.php.

eZPolicy::role ( )

Definition at line 379 of file ezpolicy.php.

eZPolicy::setAttribute ( attr,
val 
)

Sets the attribute $attr to the value $val. The attribute must be present in the objects definition fields or set functions.

Reimplemented from eZPersistentObject.

Definition at line 101 of file ezpolicy.php.

eZPolicy::userRoleID ( )

Definition at line 96 of file ezpolicy.php.


Member Data Documentation

eZPolicy::$Disabled = false

Definition at line 397 of file ezpolicy.php.

eZPolicy::$LimitIdentifier

Definition at line 399 of file ezpolicy.php.

eZPolicy::$LimitValue

Definition at line 398 of file ezpolicy.php.

eZPolicy::$UserRoleID

Definition at line 400 of file ezpolicy.php.


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