Datamanager 2 Simple privilege datatype.

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.
package midcom.helper.datamanager2

 Methods

_on_initialize ()

This startup handler validates that the class is populated correctly.

convert_from_csv ($source)

Parameters

$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.

Parameters

$source

convert_to_csv ()

convert_to_html ()

convert_to_raw ()

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

intPrivilege 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

intThe new value of the privilege.

 Properties

 

string $assignee

The name assignee of the privilege to manage (f.x.

'USERS')

 

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.

'midgard:update')