feat: user resource permission ui (#3423)

This commit is contained in:
shaohuzhang1 2025-06-27 22:38:00 +08:00 committed by GitHub
parent c5bdada6dc
commit d4d7bdde41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 268 additions and 185 deletions

View File

@ -51,8 +51,6 @@ class Group(Enum):
SYSTEM_TOOL = "SYSTEM_TOOL"
SYSTEM_RES_TOOL = "SYSTEM_RESOURCE_TOOL"
WORKSPACE_USER_RESOURCE_PERMISSION = "WORKSPACE_USER_RESOURCE_PERMISSION"
APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION = "APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION"
KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION = "KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION"
TOOL_WORKSPACE_USER_RESOURCE_PERMISSION = "TOOL_WORKSPACE_USER_RESOURCE_PERMISSION"

View File

@ -39,7 +39,9 @@ const systemRouter = {
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
[PermissionConst.ROLE_READ, PermissionConst.WORKSPACE_ROLE_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system/role/index.vue'),
},
@ -59,7 +61,9 @@ const systemRouter = {
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
[PermissionConst.WORKSPACE_WORKSPACE_READ, PermissionConst.WORKSPACE_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system/workspace/index.vue'),
},
@ -78,29 +82,23 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
[EditionConst.IS_EE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.RESOURCE_TOOL_READ],
[EditionConst.IS_EE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.RESOURCE_MODEL_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
children: [
// {
// path: '/system/resource-management/application',
// name: 'ApplicationResourceIndex',
// meta: {
// title: 'views.application.title',
// activeMenu: '/system',
// parentPath: '/system',
// parentName: 'system',
// },
// component: () =>
// import('@/views/system-resource-management/ApplicationResourceIndex.vue'),
// },
{
path: '/system/resource-management/knowledge',
name: 'KnowledgeResourceIndex',
@ -115,7 +113,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-resource-management/KnowledgeResourceIndex.vue'),
},
@ -133,7 +133,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.RESOURCE_TOOL_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-resource-management/ToolResourceIndex.vue'),
},
@ -150,7 +152,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.RESOURCE_MODEL_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-resource-management/ModelResourceIndex.vue'),
},
@ -167,12 +171,7 @@ const systemRouter = {
parentPath: '/system',
parentName: 'system',
sameRoute: 'authorization',
permission: [
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.SHARED_KNOWLEDGE_READ],
[EditionConst.IS_EE],
'OR',),],
permission: [RoleConst.ADMIN],
},
children: [
@ -186,6 +185,13 @@ const systemRouter = {
parentName: 'system',
resource: 'APPLICATION',
},
permission: [
RoleConst.ADMIN,
RoleConst.WORKSPACE_MANAGE,
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ
.getWorkspacePermissionWorkspaceManageRole,
],
component: () => import('@/views/system/resource-authorization/index.vue'),
},
{
@ -197,6 +203,13 @@ const systemRouter = {
parentPath: '/system',
parentName: 'system',
resource: 'KNOWLEDGE',
permission: [
RoleConst.ADMIN,
RoleConst.WORKSPACE_MANAGE,
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ
.getWorkspacePermissionWorkspaceManageRole,
],
},
component: () => import('@/views/system/resource-authorization/index.vue'),
},
@ -209,6 +222,13 @@ const systemRouter = {
parentPath: '/system',
parentName: 'system',
resource: 'TOOL',
permission: [
RoleConst.ADMIN,
RoleConst.WORKSPACE_MANAGE,
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
.getWorkspacePermissionWorkspaceManageRole,
],
},
component: () => import('@/views/system/resource-authorization/index.vue'),
},
@ -221,6 +241,13 @@ const systemRouter = {
parentPath: '/system',
parentName: 'system',
resource: 'MODEL',
permission: [
RoleConst.ADMIN,
RoleConst.WORKSPACE_MANAGE,
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
.getWorkspacePermissionWorkspaceManageRole,
],
},
component: () => import('@/views/system/resource-authorization/index.vue'),
},
@ -241,7 +268,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.SHARED_KNOWLEDGE_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
children: [
{
@ -257,15 +286,21 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.SHARED_KNOWLEDGE_READ],
[EditionConst.IS_EE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.SHARED_TOOL_READ],
[EditionConst.IS_EE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.SHARED_MODEL_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-shared/KnowLedgeSharedIndex.vue'),
},
@ -282,7 +317,10 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.SHARED_TOOL_READ],
[EditionConst.IS_EE],
'OR',),],},
'OR',
),
],
},
component: () => import('@/views/system-shared/ToolSharedIndex.vue'),
},
{
@ -298,7 +336,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.SHARED_MODEL_READ],
[EditionConst.IS_EE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-shared/ModelSharedIndex.vue'),
},
@ -319,15 +359,21 @@ const systemRouter = {
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
[PermissionConst.WORKSPACE_CHAT_USER_READ, PermissionConst.CHAT_USER_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
[PermissionConst.CHAT_USER_AUTH_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',)],
'OR',
),
],
},
children: [
{
@ -344,7 +390,9 @@ const systemRouter = {
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
[PermissionConst.CHAT_USER_READ, PermissionConst.WORKSPACE_CHAT_USER_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-chat-user/chat-user/index.vue'),
},
@ -362,7 +410,9 @@ const systemRouter = {
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-chat-user/group/index.vue'),
},
@ -380,7 +430,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.CHAT_USER_AUTH_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-chat-user/authentication/index.vue'),
},
@ -402,15 +454,21 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.APPEARANCE_SETTINGS_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.LOGIN_AUTH_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),new ComplexPermission(
'OR',
),
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.EMAIL_SETTING_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
children: [
{
@ -427,7 +485,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.APPEARANCE_SETTINGS_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-setting/theme/index.vue'),
},
@ -445,7 +505,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.LOGIN_AUTH_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-setting/authentication/index.vue'),
},
@ -463,7 +525,9 @@ const systemRouter = {
[RoleConst.ADMIN],
[PermissionConst.EMAIL_SETTING_READ],
[EditionConst.IS_EE, EditionConst.IS_PE],
'OR',),],
'OR',
),
],
},
component: () => import('@/views/system-setting/email/index.vue'),
},
@ -488,7 +552,6 @@ const systemRouter = {
'OR',
),
],
},
component: () => import('@/views/system/operate-log/index.vue'),
},

View File

@ -30,8 +30,12 @@ const PermissionConst = {
USER_EDIT: new Permission('USER_MANAGEMENT:READ+EDIT'),
USER_DELETE: new Permission('USER_MANAGEMENT:READ+DELETE'),
WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission('WORKSPACE_USER_RESOURCE_PERMISSION:READ'),
WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission('WORKSPACE_USER_RESOURCE_PERMISSION:READ+EDIT'),
WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission(
'WORKSPACE_USER_RESOURCE_PERMISSION:READ',
),
WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission(
'WORKSPACE_USER_RESOURCE_PERMISSION:READ+EDIT',
),
WORKSPACE_ROLE_READ: new Permission('WORKSPACE_ROLE:READ'),
WORKSPACE_ROLE_ADD_MEMBER: new Permission('WORKSPACE_ROLE:READ+ADD_MEMBER'),
@ -78,7 +82,6 @@ const PermissionConst = {
USER_GROUP_ADD_MEMBER: new Permission('USER_GROUP:READ+ADD_MEMBER'),
USER_GROUP_REMOVE_MEMBER: new Permission('USER_GROUP:READ+REMOVE_MEMBER'),
ROLE_READ: new Permission('ROLE:READ'),
ROLE_CREATE: new Permission('ROLE:READ+CREATE'),
ROLE_EDIT: new Permission('ROLE:READ+EDIT'),
@ -86,7 +89,6 @@ const PermissionConst = {
ROLE_ADD_MEMBER: new Permission('ROLE:READ+ADD_MEMBER'),
ROLE_REMOVE_MEMBER: new Permission('ROLE:READ+REMOVE_MEMBER'),
KNOWLEDGE_READ: new Permission('KNOWLEDGE:READ'),
KNOWLEDGE_CREATE: new Permission('KNOWLEDGE:READ+CREATE'),
KNOWLEDGE_SYNC: new Permission('KNOWLEDGE:READ+SYNC'),
@ -128,7 +130,6 @@ const PermissionConst = {
APPLICATION_DEBUG: new Permission('APPLICATION:READ+DEBUG'),
APPLICATION_TO_CHAT: new Permission('APPLICATION:READ+TO_CHAT'),
APPLICATION_OVERVIEW_READ: new Permission('APPLICATION_OVERVIEW:READ'),
APPLICATION_OVERVIEW_EMBEDDED: new Permission('APPLICATION_OVERVIEW:READ+EMBED'),
APPLICATION_OVERVIEW_ACCESS: new Permission('APPLICATION_OVERVIEW:READ+ACCESS'),
@ -218,14 +219,35 @@ const PermissionConst = {
OPERATION_LOG_READ: new Permission('OPERATION_LOG:READ'),
OPERATION_LOG_EXPORT: new Permission('OPERATION_LOG:READ+EXPORT'),
ABOUT_READ: new Permission('OTHER:READ'),
SWITCH_LANGUAGE: new Permission('OTHER:READ+EDIT'),
CHANGE_PASSWORD: new Permission('OTHER:READ+CREATE'),
SYSTEM_API_KEY_EDIT:new Permission('OTHER:READ+DELETE')
SYSTEM_API_KEY_EDIT: new Permission('OTHER:READ+DELETE'),
APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission(
'APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION:READ',
),
KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission(
'KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION:READ',
),
TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission(
'TOOL_WORKSPACE_USER_RESOURCE_PERMISSION:READ',
),
MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission(
'MODEL_WORKSPACE_USER_RESOURCE_PERMISSION:READ',
),
APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission(
'APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT:READ+EDIT',
),
KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission(
'KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT:READ+EDIT',
),
TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission(
'TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT:READ+EDIT',
),
MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission(
'MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT:READ+EDIT',
),
}
const RoleConst = {
ADMIN: new Role('ADMIN'),