Browse Source

将超级管理员的角色code由admin改为super_admin

ZG4vin 9 months ago
parent
commit
57ab876886
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/directives/permission/hasRole.ts
  2. 1 1
      src/utils/permission.ts

+ 1 - 1
src/directives/permission/hasRole.ts

@@ -7,7 +7,7 @@ export function hasRole(app: App<Element>) {
   app.directive('hasRole', (el, binding) => {
     const { wsCache } = useCache()
     const { value } = binding
-    const super_admin = 'admin'
+    const super_admin = 'super_admin'
     const roles = wsCache.get(CACHE_KEY.USER).roles
 
     if (value && value instanceof Array && value.length > 0) {

+ 1 - 1
src/utils/permission.ts

@@ -32,7 +32,7 @@ export function checkRole(value: string[]) {
   if (value && value instanceof Array && value.length > 0) {
     const { wsCache } = useCache()
     const permissionRoles = value
-    const super_admin = 'admin'
+    const super_admin = 'super_admin'
     const roles = wsCache.get(CACHE_KEY.USER).roles
     const hasRole = roles.some((role) => {
       return super_admin === role || permissionRoles.includes(role)