From 434e42e942b943b0639c38bc5061d651605109f3 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Wed, 24 Aug 2022 01:09:05 +0800 Subject: [PATCH] handle user_can UnAuthenticated --- include/globalfunctions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/globalfunctions.php b/include/globalfunctions.php index c48627f2..523b2403 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -1006,7 +1006,8 @@ function user_can($permission, $fail = false, $uid = 0, $class = null): bool $log .= ", set current uid: $uid"; } if ($uid <= 0) { - throw new \RuntimeException("No authentication info !"); + do_log("$log, unauthenticated, false"); + return false; } if (!$fail && isset($userCanCached[$permission][$uid])) { return $userCanCached[$permission][$uid];