mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
user_can() throw exception when no authentication
This commit is contained in:
@@ -1006,8 +1006,7 @@ function user_can($permission, $fail = false, $uid = 0, $class = null): bool
|
|||||||
$log .= ", set current uid: $uid";
|
$log .= ", set current uid: $uid";
|
||||||
}
|
}
|
||||||
if ($uid <= 0) {
|
if ($uid <= 0) {
|
||||||
do_log("$log, no uid, false", 'error');
|
throw new \RuntimeException("No authentication info !");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if (!$fail && isset($userCanCached[$permission][$uid])) {
|
if (!$fail && isset($userCanCached[$permission][$uid])) {
|
||||||
return $userCanCached[$permission][$uid];
|
return $userCanCached[$permission][$uid];
|
||||||
|
|||||||
Reference in New Issue
Block a user