From 07df90f99b5592fffbb238f9d082a69adaf39127 Mon Sep 17 00:00:00 2001 From: JuJu <857815116@qq.com> Date: Fri, 23 Oct 2020 15:33:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=95=B0=E7=BB=84=E6=9D=83?= =?UTF-8?q?=E9=99=90=E4=B8=BA=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/security/aspect/PreAuthorizeAspect.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/aspect/PreAuthorizeAspect.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/aspect/PreAuthorizeAspect.java index 64c9f17..e568b2b 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/aspect/PreAuthorizeAspect.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/aspect/PreAuthorizeAspect.java @@ -35,6 +35,9 @@ public class PreAuthorizeAspect /** 管理员角色权限标识 */ private static final String SUPER_ADMIN = "admin"; + /** 数组为0时 */ + private static final Integer ARRAY_EMPTY = 0; + @Around("@annotation(com.ruoyi.common.security.annotation.PreAuthorize)") public Object around(ProceedingJoinPoint point) throws Throwable { @@ -63,7 +66,7 @@ public class PreAuthorizeAspect } throw new PreAuthorizeException(); } - else if (!StringUtils.isEmpty(annotation.hasAnyPermi())) + else if (ARRAY_EMPTY < annotation.hasAnyPermi().length) { if (hasAnyPermi(annotation.hasAnyPermi())) { @@ -87,7 +90,7 @@ public class PreAuthorizeAspect } throw new PreAuthorizeException(); } - else if (!StringUtils.isEmpty(annotation.hasAnyRoles())) + else if (ARRAY_EMPTY < annotation.hasAnyRoles().length) { if (hasAnyRoles(annotation.hasAnyRoles())) {