user_can() throw exception when no authentication

This commit is contained in:
xiaomlove
2022-08-24 01:01:55 +08:00
parent bcee5ef1b8
commit 302b334779

View File

@@ -1006,8 +1006,7 @@ function user_can($permission, $fail = false, $uid = 0, $class = null): bool
$log .= ", set current uid: $uid";
}
if ($uid <= 0) {
do_log("$log, no uid, false", 'error');
return false;
throw new \RuntimeException("No authentication info !");
}
if (!$fail && isset($userCanCached[$permission][$uid])) {
return $userCanCached[$permission][$uid];