Sfoglia il codice sorgente

修正数组权限为空判断

JuJu 5 anni fa
parent
commit
07df90f99b

+ 5 - 2
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/aspect/PreAuthorizeAspect.java

@@ -35,6 +35,9 @@ public class PreAuthorizeAspect
35 35
     /** 管理员角色权限标识 */
36 36
     private static final String SUPER_ADMIN = "admin";
37 37
 
38
+    /** 数组为0时 */
39
+    private static final Integer ARRAY_EMPTY = 0;
40
+
38 41
     @Around("@annotation(com.ruoyi.common.security.annotation.PreAuthorize)")
39 42
     public Object around(ProceedingJoinPoint point) throws Throwable
40 43
     {
@@ -63,7 +66,7 @@ public class PreAuthorizeAspect
63 66
             }
64 67
             throw new PreAuthorizeException();
65 68
         }
66
-        else if (!StringUtils.isEmpty(annotation.hasAnyPermi()))
69
+        else if (ARRAY_EMPTY < annotation.hasAnyPermi().length)
67 70
         {
68 71
             if (hasAnyPermi(annotation.hasAnyPermi()))
69 72
             {
@@ -87,7 +90,7 @@ public class PreAuthorizeAspect
87 90
             }
88 91
             throw new PreAuthorizeException();
89 92
         }
90
-        else if (!StringUtils.isEmpty(annotation.hasAnyRoles()))
93
+        else if (ARRAY_EMPTY < annotation.hasAnyRoles().length)
91 94
         {
92 95
             if (hasAnyRoles(annotation.hasAnyRoles()))
93 96
             {