mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
chore:完善租户管理功能
This commit is contained in:
@ -21,7 +21,26 @@ export function useAuth() {
|
||||
return codeList.some(code => permissions.includes(code));
|
||||
}
|
||||
|
||||
function hasRole(roleCodes: string | string[]) {
|
||||
if (!authStore.isLogin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { roles } = authStore.userInfo;
|
||||
|
||||
// 超级管理员拥有所有角色权限
|
||||
if (roles.includes('superadmin') || roles.includes('admin')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 将单个角色转换为数组统一处理
|
||||
const codeList = Array.isArray(roleCodes) ? roleCodes : [roleCodes];
|
||||
|
||||
return codeList.some(code => roles.includes(code));
|
||||
}
|
||||
|
||||
return {
|
||||
hasAuth
|
||||
hasAuth,
|
||||
hasRole
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user