更新平台治理
This commit is contained in:
@@ -74,6 +74,12 @@ const routes: RouteRecordRaw[] = [
|
||||
component: () => import('@/views/approvals/ApprovalInstanceView.vue'),
|
||||
meta: { title: '审批中心', permission: 'user-settings' },
|
||||
},
|
||||
{
|
||||
path: 'resource-acl',
|
||||
name: 'resource-acl',
|
||||
component: () => import('@/views/governance/ResourceAclView.vue'),
|
||||
meta: { title: '资源授权', permission: 'user-settings' },
|
||||
},
|
||||
// 模型调优
|
||||
{
|
||||
path: 'fine-tune',
|
||||
@@ -351,6 +357,7 @@ const permissionBySegment: Record<string, PermissionCode> = {
|
||||
'audit-logs': 'user-settings',
|
||||
'approval-templates': 'user-settings',
|
||||
'approval-instances': 'user-settings',
|
||||
'resource-acl': 'user-settings',
|
||||
}
|
||||
|
||||
function requiredPermission(path: string, explicit?: unknown) {
|
||||
@@ -361,6 +368,11 @@ function requiredPermission(path: string, explicit?: unknown) {
|
||||
|
||||
// 全局守卫:登录校验
|
||||
// 离开页面超时由 App.vue 的 visibilitychange 监听接管
|
||||
//
|
||||
// 权限控制规则(基于 governance-user-guide.md 设计):
|
||||
// - admin 用户:可以访问所有页面
|
||||
// - 非 admin 用户:默认可访问所有业务页面(训练、评测、推理、数据等)
|
||||
// 仅以下页面限制 admin 访问:user-settings、compute(算力节点)
|
||||
router.beforeEach((to, _from, next) => {
|
||||
if (!to.meta.public) routeLoading.value = true
|
||||
const auth = useAuthStore()
|
||||
@@ -384,20 +396,18 @@ router.beforeEach((to, _from, next) => {
|
||||
|
||||
if (!to.meta.skipPermission) {
|
||||
const permission = requiredPermission(to.path, to.meta.permission)
|
||||
if (permission && !auth.hasPermission(permission)) {
|
||||
next({ name: 'permission-denied', replace: true })
|
||||
return
|
||||
}
|
||||
// user-settings 权限对应的页面仅管理员可访问
|
||||
// 仅限制管理员专属页面的访问权限
|
||||
// user-settings(用户设置、租户管理、项目空间、审批、审计日志)仅 admin 可访问
|
||||
if (permission === 'user-settings' && !auth.isAdmin) {
|
||||
next({ name: 'permission-denied', replace: true })
|
||||
return
|
||||
}
|
||||
// 算力节点仅管理员可访问
|
||||
// compute(算力节点/GPU 分配)仅 admin 可访问
|
||||
if (permission === 'compute' && !auth.isAdmin) {
|
||||
next({ name: 'permission-denied', replace: true })
|
||||
return
|
||||
}
|
||||
// 其他所有业务页面对已登录用户开放,不再检查权限码
|
||||
}
|
||||
|
||||
// 路由切换时记录业务模块访问(用于看板用户操作分布统计)
|
||||
|
||||
Reference in New Issue
Block a user