!572 修复:将超级管理员的角色code由admin改为super_admin

Merge pull request !572 from ZG4vin/master
This commit is contained in:
芋道源码 2024-10-27 08:40:35 +00:00 committed by Gitee
commit 92f4160fe1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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)