capability = $capability; $this->roleid = $roleid; $this->contextid = $contextid; $this->assign($permission); } /** * Assign a new permission. * @param int $permission One of CAP_ALLOW, CAP_PROHIBIT, CAP_PREVENT */ public function assign($permission) { foreach ($this->capability as $capability) { assign_capability($capability, $permission, $this->roleid, $this->contextid, true); } accesslib_clear_all_caches_for_unit_testing(); } /** * Revokes the capability assignment. */ public function revoke() { foreach ($this->capability as $capability) { unassign_capability($capability, $this->roleid, $this->contextid); } accesslib_clear_all_caches_for_unit_testing(); } }