Horde_Perms_Permission::removeGroupPermission PHP Method

removeGroupPermission() public method

Removes a permission that a group currently has on this object.
public removeGroupPermission ( integer $groupId = null, integer $permission = null, boolean $update = true )
$groupId integer The id of the group to remove the permission from. Defaults to all groups.
$permission integer The permission (DELETE, etc.) to remove. Defaults to all permissions.
$update boolean Whether to automatically update the backend.
    public function removeGroupPermission($groupId = null, $permission = null, $update = true)
    {
        if (is_null($groupId)) {
            $this->data['groups'] = array();
        } else {
            if (!isset($this->data['groups'][$groupId])) {
                return;
            }
            if ($permission && $this->get('type') == 'matrix') {
                $this->data['groups'][$groupId] &= ~$permission;
                if (empty($this->data['groups'][$groupId])) {
                    unset($this->data['groups'][$groupId]);
                }
            } else {
                unset($this->data['groups'][$groupId]);
            }
        }
        if ($update) {
            $this->save();
        }
    }