From 4ca30f08d64de84479b3b510bc8153550f99d1f3 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 10 Nov 2023 15:46:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E5=8C=B9=E9=85=8D=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/utils/SecurityUtils.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java index f88f8a14..3898cfad 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java @@ -20,6 +20,7 @@ import com.ruoyi.common.exception.ServiceException; */ public class SecurityUtils { + /** * 用户ID **/ @@ -49,7 +50,7 @@ public class SecurityUtils throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); } } - + /** * 获取用户账户 **/ @@ -145,7 +146,7 @@ public class SecurityUtils public static boolean hasPermi(Collection authorities, String permission) { return authorities.stream().filter(StringUtils::hasText) - .anyMatch(x -> Constants.ALL_PERMISSION.contains(x) || PatternMatchUtils.simpleMatch(x, permission)); + .anyMatch(x -> Constants.ALL_PERMISSION.equals(x) || PatternMatchUtils.simpleMatch(x, permission)); } /** @@ -171,7 +172,7 @@ public class SecurityUtils public static boolean hasRole(Collection roles, String role) { return roles.stream().filter(StringUtils::hasText) - .anyMatch(x -> Constants.SUPER_ADMIN.contains(x) || PatternMatchUtils.simpleMatch(x, role)); + .anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role)); } }