The class encapsulates a single privilege record with its three states of
ALLOWED, DENIED and INHERITED.
It requires the privilege widget for correct display.
Note, that magic class privileges are currently not supported by this type. Only
content-, not self-style privileges are managed by it.
Available configuration options:
- string privilege_name: The name of the privilege to manage. Must be set.
- string assignee: The assignee of the privilege to manage. Must be set.
Methods
_on_initialize ()
This startup handler validates that the class is populated correctly.
convert_from_csv ($source)
convert_from_storage ($source)
Loads the privilege from the DB if and only if a storage object is already present
and we have sufficient privileges.
convert_to_storage ()
Writes the privilege to the DB unless the privilege member is still null (in which
case the inherited default will kick in).
In all other cases the type will have
already populated storage->object with a temporary object in set_value().
get_value ()
Returns the current privilege value, defaulting to MIDCOM_PRIVILEGE_INHERIT in case the
privilege is yet unset.
Returns
int
Privilege value
set_value (int $value)
Sets the privileges value.
If the privilege record has not yet been created,
it creates a new one (getting a temporary object from the DM core if
necessary).
Parameters
$value
int
The new value of the privilege.
Properties
string $assignee
The name assignee of the privilege to manage (f.x.
string $classname
Classname the privilege applies to
\midcom_core_privilege $privilege
The privilege record encapsulated by this type (note that this does not
necessarily is an already persisted privilege).
This member may be null in case that we do not yet have a storage object.
Setting/getting the value of this type must thus not be done directly
in this member but using the get/set_value accessors.
string $privilege_name
The name of the privilege to manage (f.x.