/** * Set the requested privilege for this {@link USER}. * @param string $set_name Check this set of privileges. * @param integer $type Check this privilege (or privileges). * @param integer $value Can be one of {@link Privilege_always_granted}, {@link Permissions_always_denied} or {@link Privilege_controlled_by_content}. * @access private */ public function set($set_name, $type, $value) { if ($this->global_privileges->supports($set_name)) { switch ($value) { case Privilege_always_denied: $this->global_privileges->set($set_name, $type, false); break; case Privilege_always_granted: $this->global_privileges->set($set_name, $type, true); break; case Privilege_controlled_by_content: $this->raise('Global privileges cannot be controlled by content.', 'set_privilege_at', 'USER_PERMISSIONS'); } } else { switch ($value) { case Privilege_always_denied: $this->allow_privileges->set($set_name, $type, false); $this->deny_privileges->set($set_name, $type, true); break; case Privilege_always_granted: $this->allow_privileges->set($set_name, $type, true); $this->deny_privileges->set($set_name, $type, false); break; case Privilege_controlled_by_content: $this->allow_privileges->set($set_name, $type, false); $this->deny_privileges->set($set_name, $type, false); break; } } }
/** * Set the given privileges to 'value'. * @param integer $set_name Apply to this set of privileges. * @param integer $type Set this privilege (or privileges). * @param boolean $value Set privileges to this value (true or false). */ public function set($set_name, $type, $value) { $this->privileges->set($set_name, $type, $value); }