fix listUserClassPermissions()

This commit is contained in:
xiaomlove
2022-08-22 23:48:26 +08:00
parent adfd8f36e7
commit efec6348ef
3 changed files with 2 additions and 5 deletions

View File

@@ -368,10 +368,8 @@ class ToolRepository extends BaseRepository
{ {
$userInfo = get_user_row($uid); $userInfo = get_user_row($uid);
$prefix = "authority"; $prefix = "authority";
$excludes = collect(Setting::$permissionMustHaveClass)->map(fn ($p) => "$prefix.$p")->toArray();
return Setting::query() return Setting::query()
->where("name", "like", "$prefix.%") ->where("name", "like", "$prefix.%")
->whereNotIn('name', $excludes)
->where('value', '<=', $userInfo['class']) ->where('value', '<=', $userInfo['class'])
->where('value', '>=', User::CLASS_PEASANT) ->where('value', '>=', User::CLASS_PEASANT)
->pluck('name') ->pluck('name')
@@ -379,7 +377,6 @@ class ToolRepository extends BaseRepository
->toArray(); ->toArray();
} }
public static function listUserAllPermissions($uid): array public static function listUserAllPermissions($uid): array
{ {
return NexusDB::remember("user_{$uid}_permissions", 600, function () use ($uid) { return NexusDB::remember("user_{$uid}_permissions", 600, function () use ($uid) {

View File

@@ -352,8 +352,7 @@ if ($action == "edituser")
if (!empty($banLog)) { if (!empty($banLog)) {
\App\Models\UserBanLog::query()->insert($banLog); \App\Models\UserBanLog::query()->insert($banLog);
} }
\Nexus\Database\NexusDB::cache_del("user_{$userid}_content"); clear_user_cache($userid, $userInfo->passkey);
\Nexus\Database\NexusDB::cache_del('user_passkey_'.$userInfo->passkey.'_content');
$returnto = htmlspecialchars($_POST["returnto"]); $returnto = htmlspecialchars($_POST["returnto"]);
header("Location: " . get_protocol_prefix() . "$BASEURL/$returnto"); header("Location: " . get_protocol_prefix() . "$BASEURL/$returnto");
die; die;

View File

@@ -35,6 +35,7 @@ sql_query("INSERT INTO staffmessages (sender, added, msg, subject) VALUES($useri
sql_query("UPDATE users SET last_staffmsg = NOW() WHERE id = ".sqlesc($CURUSER['id'])) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE users SET last_staffmsg = NOW() WHERE id = ".sqlesc($CURUSER['id'])) or sqlerr(__FILE__, __LINE__);
$Cache->delete_value('staff_message_count'); $Cache->delete_value('staff_message_count');
$Cache->delete_value('staff_new_message_count'); $Cache->delete_value('staff_new_message_count');
clear_staff_message_cache();
if ($_POST["returnto"]) if ($_POST["returnto"])
{ {
header("Location: " . htmlspecialchars($_POST["returnto"])); header("Location: " . htmlspecialchars($_POST["returnto"]));