fix(系统设置): 修复系统成员不能看到系统菜单的问题
--bug=1037346 --user=刘瑞斌 【系统设置】testeryou用户是系统成员用户组,登录后看不到系统的菜单。 https://www.tapd.cn/55049933/s/1477643
This commit is contained in:
parent
b210957535
commit
5d5ee59995
|
@ -5,7 +5,7 @@ import { firstLevelMenu } from '@/config/permission';
|
|||
import { INDEX_ROUTE } from '@/router/routes/base';
|
||||
import appRoutes from '@/router/routes/index';
|
||||
import { useAppStore, useUserStore } from '@/store';
|
||||
import {SystemScopeType, UserRole, UserRoleRelation} from '@/store/modules/user/types';
|
||||
import { SystemScopeType, UserRole, UserRoleRelation } from '@/store/modules/user/types';
|
||||
|
||||
export function hasPermission(permission: string, typeList: string[]) {
|
||||
const userStore = useUserStore();
|
||||
|
@ -53,16 +53,24 @@ export function hasAllPermission(permissions: string[], typeList = ['PROJECT', '
|
|||
}
|
||||
|
||||
export function composePermissions(userRoleRelations: UserRoleRelation[], type: SystemScopeType, id: string) {
|
||||
// 系统级别的权限
|
||||
if (type === 'SYSTEM') {
|
||||
return userRoleRelations
|
||||
.filter((ur) => ur.userRole && ur.userRole.type === 'SYSTEM')
|
||||
.flatMap((role) => role.userRolePermissions)
|
||||
.map((g) => g.permissionId);
|
||||
}
|
||||
// 项目和组织级别的权限
|
||||
let func: (role: UserRole) => boolean;
|
||||
switch (type) {
|
||||
case 'PROJECT':
|
||||
func = role => role && role.type === 'PROJECT';
|
||||
func = (role) => role && role.type === 'PROJECT';
|
||||
break;
|
||||
case 'ORGANIZATION':
|
||||
func = role => role && role.type === 'ORGANIZATION';
|
||||
func = (role) => role && role.type === 'ORGANIZATION';
|
||||
break;
|
||||
default:
|
||||
func = role => role && role.type === 'SYSTEM';
|
||||
func = (role) => role && role.type === 'SYSTEM';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue