set_privilege()
set_privilege(mixed $privilege, mixed $assignee = null, integer $value = MIDCOM_PRIVILEGE_ALLOW, string $classname = '') : boolean
Set a privilege on an object.
This requires both midgard:update and midgard:privileges.
You can either pass a ready made privilege record or a privilege/assignee/value
combination suitable for usage with create_new_privilege_object() (see there).
Parameters
mixed |
$privilege |
Either the full privilege object (midcom_core_privilege) to set or the name of the privilege (string).
If the name was specified, the other parameters must be specified as well. |
mixed |
$assignee |
A valid assignee suitable for midcom_core_privilege::set_privilege(). This defaults to the currently
active user if authenticated or to 'EVERYONE' otherwise (invalid if $privilege is a midcom_core_privilege). |
integer |
$value |
The privilege value, this defaults to MIDCOM_PRIVILEGE_ALLOW (invalid if $privilege is a midcom_core_privilege). |
string |
$classname |
An optional class name to which a SELF privilege gets restricted to. Only valid for SELF privileges
(invalid if $privilege is a midcom_core_privilege). |
Returns
boolean
— Indicating success.