eZ Publish  [trunk]
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)
 Copies the policy and its limitations to another role.
 createTemporaryCopy ()
 Creates a temporary copy for this policy so that it can be edited.
 eZPolicy ($row)
 limitationList ($useCache=true, $ignoreLimitIdentifier=false)
 limitIdentifier ()
 limitValue ()
 removeThis ($id=false)
 role ()
 saveTemporary ()
 Saves a temporary limitation created with createTemporaryCopy().
 setAttribute ($attr, $val)
 Sets the attribute $attr to the value $val.
 userRoleID ()

Static Public Member Functions

static create ($roleID, $module, $function)
static createNew ($roleID, $params=array())
static definition ()
 Returns the definition for the object, the default implementation is to return an empty array.
static fetch ($policyID)
 Fetches a policy by ID.
static fetchTemporaryCopy ($policyID)
 Fetches the temporary copy of a policy.
static removeByID ($id)

Public Attributes

 $Disabled = false
 $LimitIdentifier
 $LimitValue
 $UserRoleID

Detailed Description

Defines a policy in the permission system.

Definition at line 18 of file ezpolicy.php.


Member Function Documentation

eZPolicy::accessArray ( ignoreLimitIdentifier = false)

Generate access array from this policy.

return access array

Definition at line 253 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 167 of file ezpolicy.php.

eZPolicy::copy ( roleID)

Copies the policy and its limitations to another role.

Parameters:
int$roleIDthe ID of the role to copy to
Returns:
eZPolicy the created eZPolicy copy

Definition at line 200 of file ezpolicy.php.

Referenced by createTemporaryCopy().

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 145 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 120 of file ezpolicy.php.

Referenced by copy(), and eZStepCreateSites\initializePackage().

Creates a temporary copy for this policy so that it can be edited.

The policies will be linked to the copy

Returns:
eZPolicy the temporary copy
Since:
4.4

Definition at line 418 of file ezpolicy.php.

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: public 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" ); }

Returns:
array

Reimplemented from eZPersistentObject.

Definition at line 29 of file ezpolicy.php.

Referenced by eZRole\policyList().

eZPolicy::eZPolicy ( row)

Constructor

Definition at line 23 of file ezpolicy.php.

Referenced by create(), and createNew().

static eZPolicy::fetch ( policyID) [static]

Fetches a policy by ID.

Parameters:
int$policyIDPolicy ID
Returns:
eZPolicy

Definition at line 380 of file ezpolicy.php.

Referenced by eZSubtreeNotificationRule\checkObjectAccess(), fetchTemporaryCopy(), eZPolicyLimitation\policy(), removeByID(), and saveTemporary().

static eZPolicy::fetchTemporaryCopy ( policyID) [static]

Fetches the temporary copy of a policy.

Parameters:
int$policyIDThe original policy ID
Returns:
eZPolicy

Definition at line 391 of file ezpolicy.php.

eZPolicy::limitationList ( useCache = true,
ignoreLimitIdentifier = false 
)

Fetch limitation array()

Parameters:
uselimitation cache, true by default.

Definition at line 283 of file ezpolicy.php.

Referenced by accessArray().

Definition at line 67 of file ezpolicy.php.

Definition at line 72 of file ezpolicy.php.

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

Definition at line 221 of file ezpolicy.php.

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 235 of file ezpolicy.php.

Definition at line 364 of file ezpolicy.php.

Saves a temporary limitation created with createTemporaryCopy().

Exceptions:
ExceptionThe policy isn't a temporary one
Returns:
void

Definition at line 436 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.

Parameters:
string$attr
mixed$val
Returns:
void

Reimplemented from eZPersistentObject.

Definition at line 82 of file ezpolicy.php.

Referenced by saveTemporary().

Definition at line 77 of file ezpolicy.php.


Member Data Documentation

eZPolicy::$Disabled = false

Definition at line 453 of file ezpolicy.php.

eZPolicy::$LimitIdentifier

Definition at line 455 of file ezpolicy.php.

eZPolicy::$LimitValue

Definition at line 454 of file ezpolicy.php.

eZPolicy::$UserRoleID

Definition at line 456 of file ezpolicy.php.


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