/** * Remove permissions to one or more tokens from a user * @param mixed a token ID, name, or array of the same **/ public function revoke($tokens) { $tokens = Utils::single_array($tokens); // get token IDs $tokens = array_map(array('ACL', 'token_id'), $tokens); foreach ($tokens as $token) { ACL::revoke_user_permission($this->id, $token); EventLog::log(_t('User %1$s: Permission to %2$s revoked.', array($this->username, ACL::token_name($token))), 'notice', 'user', 'habari'); } }
/** * Remove a permission token from the group permissions table * @param integer $group_id The group ID * @param mixed $token_id The name or ID of the permission token * @return the result of the DB query */ public static function revoke_group_token($group_id, $token_id) { $token_id = self::token_id($token_id); $ug = UserGroup::get_by_id($group_id); $access = self::get_group_token_access($group_id, $token_id); if (empty($access)) { $result = true; } else { $result = DB::delete('{group_token_permissions}', array('group_id' => $group_id, 'token_id' => $token_id)); EventLog::log(_t('Group %1$s: Permission to %2$s revoked.', array($ug->name, ACL::token_name($token_id))), 'notice', 'user', 'habari'); } $ug->clear_permissions_cache(); ACL::clear_caches(); return $result; }