Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZPolicy Class Reference
Role based permission system

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

Inheritance diagram for eZPolicy:

## Public Member Functions
| __construct ( $row)
| limitIdentifier ()
| limitValue ()
| userRoleID ()
| setAttribute ( $attr, $val)
| appendLimitation ( $identifier, $values)
| copy ( $roleID)
| removeThis ( $id=false)
| accessArray ( $ignoreLimitIdentifier=false)
| limitationList ( $useCache=true, $ignoreLimitIdentifier=false)
| role ()
| createTemporaryCopy ()
| saveTemporary ()
Public Member Functions inherited from eZPersistentObject
| eZPersistentObject ( $row=null)
| fill ( $row)
| remove ( $conditions=null, $extraConditions=null)
| store ( $fieldFilters=null)
| sync ( $fieldFilters=null)
| attributes ()
| hasAttribute ( $attr)
| attribute ( $attr, $noFunction=false)
| hasDirtyData ()
| setHasDirtyData ( $hasDirtyData)

## Static Public Member Functions
static | definition ()
static | createNew ( $roleID, $params=array())
static | create ( $roleID, $module, $function)
static | removeByID ( $id)
static | fetch ( $policyID)
static | fetchTemporaryCopy ( $policyID)
Static Public Member Functions inherited from eZPersistentObject
static | replaceFieldsWithShortNames (eZDBInterface $db, array $fieldDefs, &$fields)
static | count ( $def, $conds=null, $field=null)
static | fetchObject ( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
static | removeObject ( $def, $conditions=null, $extraConditions=null)
static | storeObject ( $obj, $fieldFilters=null)
static | conditionText ( $conditions)
static | conditionTextByRow ( $conditions, $row)
static | fetchObjectList ( $def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
static | handleRows ( $rows, $class_name, $asObject)
static | swapRow ( $table, $keys, $order_id, $rows, $id1, $id2)
static | newObjectOrder ( $def, $orderField, $conditions)
static | reorderObject ( $def, $orderField, $conditions, $down=true)
static | escapeArray ( $array)
static | updateObjectList ( $parameters)
static | getShortAttributeName ( $db, $def, $attrName)

## Public Attributes
| $Disabled = false
| $LimitValue
| $LimitIdentifier
| $UserRoleID
| $Limitations
| $RoleID
| $ModuleName
| $FunctionName
| $OriginalID
Public Attributes inherited from eZPersistentObject
| $PersistentDataDirty
| $ID
| $ContentObjectID
| $SectionID
| $OwnerID
| $ClassID
| $Published
| $Modified
| $CurrentVersion
| $Status
| $RemoteID
| $LanguageMask
| $InitialLanguageID
| $NodeID
| $ParentNodeID
| $MainNodeID
| $ContentObjectVersion
| $ContentObjectIsPublished
| $Depth
| $SortField
| $SortOrder
| $Priority
| $ModifiedSubNode
| $PathString
| $PathIdentificationString
| $IsHidden
| $IsInvisible
| $UserID
| $Name
| $Locale
| $Identifier
| $NavigationPartIdentifier
| $SerializedDescriptionList
| $URLAliasName
| $AlwaysAvailable
| $CanTranslate
| $DataInt1
| $DataInt2
| $DataInt3
| $DataInt4
| $DataFloat1
| $DataFloat2
| $DataFloat3
| $DataFloat4
| $DataText1
| $DataText2
| $DataText3
| $DataText4
| $DataText5
| $SerializedDataText
| $Category
| $PolicyID
| $Values
| $Created
| $CurrencyCode
| $ProductCollectionID
| $ItemCount
| $Price
| $IsVATIncluded
| $VATValue
| $DiscountValue
| $Email
| $IsTemporary
| $IsArchived
| $IsActive
| $OrderID
| $ModifierID
| $Code
| $Symbol
| $AutoRateValue
| $CustomRateValue
| $RateFactor
| $Main
| $MementoKey
| $MainKey
| $WorkflowEventPos
| $LanguageID
| $ContentObjectStateGroupID
| $contentobject_attribute_id
| $contentobject_id
| $rating
| $rating_count
| $rating_average

## Additional Inherited Members
Static Protected Member Functions inherited from eZPersistentObject
static | replaceFieldsWithLongNames (eZDBInterface $db, array $fieldDefs, &$fields)

## Detailed Description

Defines a policy in the permission system.

Definition at line 18 of file ezpolicy.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZPolicy::__construct | ( |  | $row | ) |

Initializes the object with the $row.

It will try to set each field taken from the database row. Calls fill to do the job. If $row is an integer, it will try to fetch it from the database using it as the unique ID.

Parameters

  int | array | $row |

Reimplemented from eZPersistentObject.

Definition at line 20 of file ezpolicy.php.

## Member Function Documentation

## ◆ accessArray()

eZPolicy::accessArray | ( |  | $ignoreLimitIdentifier = `false` | ) |

Generate access array from this policy.

return access array

Definition at line 250 of file ezpolicy.php.

References $UserRoleID, eZPersistentObject\attribute(), and limitationList().

## ◆ appendLimitation()

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

  $identifier | The identifier for the limitation, e.g. `'Class'`
  $values | Array 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 164 of file ezpolicy.php.

References eZPolicyLimitationValue\create(), eZPolicyLimitation\create(), and eZDB\instance().

## ◆ copy()

eZPolicy::copy | ( |  | $roleID | ) |

Copies the policy and its limitations to another role

Parameters

  int | $roleID | the ID of the role to copy to

Returns
  eZPolicy the created eZPolicy copy

Definition at line 197 of file ezpolicy.php.

References eZPersistentObject\attribute(), createNew(), and eZDB\instance().

Referenced by createTemporaryCopy().

## ◆ create()

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

  $module | Which module to give access to or `true` to give access to all modules.
  $function | Which function to give access to or `true` to give access to all functions.
  $limitations | An associative array with limitations and their values, use an empty array for no limitations.

Definition at line 142 of file ezpolicy.php.

Referenced by eZRole\appendPolicy().

## ◆ createNew()

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

Referenced by copy().

## ◆ createTemporaryCopy()

eZPolicy::createTemporaryCopy | ( |  | ) |

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

References eZPersistentObject\attribute(), copy(), and eZDB\instance().

## ◆ definition()

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

Referenced by eZRole\policyList().

## ◆ fetch()

static eZPolicy::fetch | ( |  | $policyID | ) |
| static

Fetches a policy by ID

Parameters

  int | $policyID | Policy ID

Returns
  eZPolicy

Definition at line 377 of file ezpolicy.php.

References eZPersistentObject\fetchObject().

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

## ◆ fetchTemporaryCopy()

static eZPolicy::fetchTemporaryCopy | ( |  | $policyID | ) |
| static

Fetches the temporary copy of a policy

Parameters

  int | $policyID | The original policy ID

Returns
  eZPolicy

Definition at line 388 of file ezpolicy.php.

References fetch(), and eZPersistentObject\fetchObject().

## ◆ limitationList()

eZPolicy::limitationList | ( |  | $useCache = `true`,
|  |  | $ignoreLimitIdentifier = `false`
| ) |  |

Fetch limitation array()

Parameters

  use | limitation cache, true by default.

Definition at line 280 of file ezpolicy.php.

References $Limitations, eZPersistentObject\attribute(), eZPolicyLimitation\definition(), eZPersistentObject\fetchObjectList(), and eZDebugSetting\writeDebug().

Referenced by accessArray().

## ◆ limitIdentifier()

eZPolicy::limitIdentifier | ( |  | ) |

Definition at line 64 of file ezpolicy.php.

References $LimitIdentifier.

## ◆ limitValue()

eZPolicy::limitValue | ( |  | ) |

Definition at line 69 of file ezpolicy.php.

References $LimitValue.

## ◆ removeByID()

static eZPolicy::removeByID | ( |  | $id | ) |
| static

See also
  removeThis

Definition at line 218 of file ezpolicy.php.

References fetch().

## ◆ removeThis()

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

References eZPersistentObject\attribute(), and eZDB\instance().

## ◆ role()

eZPolicy::role | ( |  | ) |

Definition at line 361 of file ezpolicy.php.

References eZRole\definition(), and eZPersistentObject\fetchObject().

## ◆ saveTemporary()

eZPolicy::saveTemporary | ( |  | ) |

Saves a temporary limitation created with createTemporaryCopy()

Exceptions

  Exception | The policy isn't a temporary one

Returns
  void

Definition at line 438 of file ezpolicy.php.

References eZPersistentObject\attribute(), fetch(), setAttribute(), and eZPersistentObject\store().

## ◆ setAttribute()

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

Referenced by saveTemporary().

## ◆ userRoleID()

eZPolicy::userRoleID | ( |  | ) |

Definition at line 74 of file ezpolicy.php.

References $UserRoleID.

## Member Data Documentation

## ◆ $Disabled

eZPolicy::$Disabled = false

Definition at line 455 of file ezpolicy.php.

## ◆ $FunctionName

eZPolicy::$FunctionName

Definition at line 462 of file ezpolicy.php.

## ◆ $Limitations

eZPolicy::$Limitations

Definition at line 459 of file ezpolicy.php.

Referenced by limitationList().

## ◆ $LimitIdentifier

eZPolicy::$LimitIdentifier

Definition at line 457 of file ezpolicy.php.

Referenced by limitIdentifier().

## ◆ $LimitValue

eZPolicy::$LimitValue

Definition at line 456 of file ezpolicy.php.

Referenced by limitValue().

## ◆ $ModuleName

eZPolicy::$ModuleName

Definition at line 461 of file ezpolicy.php.

## ◆ $OriginalID

eZPolicy::$OriginalID

Definition at line 463 of file ezpolicy.php.

## ◆ $RoleID

eZPolicy::$RoleID

Definition at line 460 of file ezpolicy.php.

## ◆ $UserRoleID

eZPolicy::$UserRoleID

Definition at line 458 of file ezpolicy.php.

Referenced by accessArray(), and userRoleID().

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

- ezpolicy.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.