feat: 移除mock并接入真实权限控制
This commit is contained in:
@@ -100,6 +100,15 @@ export const hasPerms = (value: string | Array<string>): boolean => {
|
||||
: isIncludeAllChildren(value, permissions);
|
||||
};
|
||||
|
||||
/** 是否拥有后端返回的菜单入口。 */
|
||||
export const hasMenuAccess = (menuKey: string): boolean => {
|
||||
if (hasPerms("*")) return true;
|
||||
|
||||
const menus = getUserInfo()?.permissionMenus ?? [];
|
||||
|
||||
return menus.some(item => item.key === menuKey);
|
||||
};
|
||||
|
||||
/** 是否拥有后端菜单动作权限,用于比权限码更细的按钮显隐。 */
|
||||
export const hasMenuAction = (menuKey: string, action: string): boolean => {
|
||||
if (hasPerms("*")) return true;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { removeToken, setToken, type DataInfo } from "./auth";
|
||||
import { subBefore, getQueryMap } from "@pureadmin/utils";
|
||||
|
||||
/**
|
||||
* 简版前端单点登录,根据实际业务自行编写,平台启动后本地可以跳后面这个链接进行测试 http://localhost:8848/#/permission/page/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin
|
||||
* 简版前端单点登录,根据实际业务自行编写,平台启动后本地可以跳后面这个链接进行测试 http://localhost:8848/#/employees?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin
|
||||
* 划重点:
|
||||
* 判断是否为单点登录,不为则直接返回不再进行任何逻辑处理,下面是单点登录后的逻辑处理
|
||||
* 1.清空本地旧信息;
|
||||
|
||||
Reference in New Issue
Block a user