ePages 7.27.0 - DE_EPAGES/Permission/API/AttributePermission.pm

Package DE_EPAGES::Permission::API::AttributePermission

This package provides helper functions for attribute permissions.
The following rules apply for attribute permissions:

@EXPORT_OK
GetReadableAttributes
GetWritableAttributes
IsAttributeReadable
IsAttributeWritable

Functions

GetReadableAttributes
GetWritableAttributes
IsAttributeReadable
IsAttributeWritable

GetReadableAttributes

Returns an array of the class' attributes that are viewable by the given user or group (i.e. trustee).

Syntax
$ahReadableAttributes = GetReadableAttributes($Class, $UserOrGroup);
Input
$Class (object)
class object
$UserOrGroup (object)
(optional) user or group object
Return
$ahReadableAttributes (ref.array.hash)
with following keys:
  • TrusteeID - trustee id - int
  • AttributeID - attribute id - int
  • Permission - readable=2, writable=4 - tinyint

GetWritableAttributes

Returns an array of the class' attributes that are modifiable by the given user or group (i.e. trustee). All attributes of inherited classes as well as related trustees are considered.

Syntax
$ahWritableAttributes = GetWritableAttributes($Class, $UserOrGroup);
Input
$Class (object)
class object
$UserOrGroup (object)
(optional) user or group object
Return
$ahWritableAttributes (ref.array.hash)
with following keys:
  • TrusteeID - trustee id - int
  • AttributeID - attribute id - int
  • Permission - readable=2, writable=4 - tinyint

IsAttributeReadable

Returns true, if the given attribute is readable by the given trustee. If no user or group is defined, the group Everyone is assumed.

Syntax
$IsReadable = IsAttributeReadable($Attribute, $UserOrGroup);
Input
$Attribute (object)
attribute object
$UserOrGroup (object)
(optional) user or group object (i.e. trustee)
Return
$IsReadable (boolean)
true, if the attribute is readable

IsAttributeWritable

Returns true, if the given attribute can be altered by the given trustee. If no user or group is defined, the group Everyone is assumed.

Syntax
$IsReadable = IsAttributeWritable( $Attribute, $UserOrGroup);
Input
$Attribute (object)
attribute object
$UserOrGroup (object)
(optional) user or group object (i.e. trustee)
Return
$IsWritable (boolean)
true, if the attribute is writeable