Sfoglia il codice sorgente

权限工具类增加admin判断

DokiYoloo 5 anni fa
parent
commit
161a6249e9
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      ruoyi-ui/src/utils/permission.js

+ 4 - 2
ruoyi-ui/src/utils/permission.js

@@ -9,9 +9,10 @@ export function checkPermi(value) {
9 9
   if (value && value instanceof Array && value.length > 0) {
10 10
     const permissions = store.getters && store.getters.permissions
11 11
     const permissionDatas = value
12
+    const all_permission = "*:*:*";
12 13
 
13 14
     const hasPermission = permissions.some(permission => {
14
-      return permissionDatas.includes(permission)
15
+      return all_permission === permission || permissionDatas.includes(permission)
15 16
     })
16 17
 
17 18
     if (!hasPermission) {
@@ -33,9 +34,10 @@ export function checkRole(value) {
33 34
   if (value && value instanceof Array && value.length > 0) {
34 35
     const roles = store.getters && store.getters.roles
35 36
     const permissionRoles = value
37
+    const super_admin = "admin";
36 38
 
37 39
     const hasRole = roles.some(role => {
38
-      return permissionRoles.includes(role)
40
+      return super_admin === role || permissionRoles.includes(role)
39 41
     })
40 42
 
41 43
     if (!hasRole) {