Skip to content

Commit fa5df1f

Browse files
author
wyc001122
committed
feat(@vben/access): add mixed access control
1 parent e89cf40 commit fa5df1f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/@core/base/typings/src/app.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ type BreadcrumbStyleType = 'background' | 'normal';
6060
* 权限模式
6161
* backend 后端权限模式
6262
* frontend 前端权限模式
63+
* mixed 混合权限模式
6364
*/
64-
type AccessModeType = 'backend' | 'frontend';
65+
type AccessModeType = 'backend' | 'frontend' | 'mixed';
6566

6667
/**
6768
* 导航风格

packages/effects/access/src/accessible.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ async function generateRoutes(
9696
);
9797
break;
9898
}
99+
case 'mixed': {
100+
const [frontendRoutes, backendRoutes] = await Promise.all([
101+
generateRoutesByFrontend(routes, roles || [], forbiddenComponent),
102+
generateRoutesByBackend(options),
103+
]);
104+
resultRoutes = [...frontendRoutes, ...backendRoutes];
105+
break;
106+
}
99107
}
100108

101109
/**

0 commit comments

Comments
 (0)