refactor: ♻️ 提取 ROLE_ROOT 常量到 constants 目录并全局统一引用
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Directive, DirectiveBinding } from "vue";
|
||||
|
||||
import { useUserStore } from "@/store";
|
||||
import { ROLE_ROOT } from "@/constants";
|
||||
|
||||
/**
|
||||
* 按钮权限
|
||||
@@ -18,8 +19,8 @@ export const hasPerm: Directive = {
|
||||
|
||||
const { roles, perms } = useUserStore().userInfo;
|
||||
|
||||
// 超级管理员拥有所有权限,如果是”*:*:*”权限标识,则不需要进行权限校验
|
||||
if (roles.includes("ROOT") || requiredPerms.includes("*:*:*")) {
|
||||
// 超级管理员拥有所有权限,如果是"*:*:*"权限标识,则不需要进行权限校验
|
||||
if (roles.includes(ROLE_ROOT) || requiredPerms.includes("*:*:*")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user