Commit 3c4b01ab839d9bfc87cd40828a49d5cc5ae4b153
Committed by
Gitee
1 parent
52264b6e
权限工具类增加admin判断
Showing
1 changed file
with
4 additions
and
2 deletions
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) { | ... | ... |