Skip to content

Commit 80b339b

Browse files
committed
feat: user resource permission ui
1 parent c5bdada commit 80b339b

File tree

3 files changed

+290
-207
lines changed

3 files changed

+290
-207
lines changed

apps/common/constants/permission_constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class Group(Enum):
5151
SYSTEM_TOOL = "SYSTEM_TOOL"
5252
SYSTEM_RES_TOOL = "SYSTEM_RESOURCE_TOOL"
5353

54-
WORKSPACE_USER_RESOURCE_PERMISSION = "WORKSPACE_USER_RESOURCE_PERMISSION"
55-
5654
APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION = "APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION"
5755
KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION = "KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION"
5856
TOOL_WORKSPACE_USER_RESOURCE_PERMISSION = "TOOL_WORKSPACE_USER_RESOURCE_PERMISSION"

ui/src/router/modules/system.ts

Lines changed: 132 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ const systemRouter = {
3939
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
4040
[PermissionConst.ROLE_READ, PermissionConst.WORKSPACE_ROLE_READ],
4141
[EditionConst.IS_EE, EditionConst.IS_PE],
42-
'OR',),],
42+
'OR',
43+
),
44+
],
4345
},
4446
component: () => import('@/views/system/role/index.vue'),
4547
},
@@ -59,7 +61,9 @@ const systemRouter = {
5961
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
6062
[PermissionConst.WORKSPACE_WORKSPACE_READ, PermissionConst.WORKSPACE_READ],
6163
[EditionConst.IS_EE],
62-
'OR',),],
64+
'OR',
65+
),
66+
],
6367
},
6468
component: () => import('@/views/system/workspace/index.vue'),
6569
},
@@ -74,33 +78,27 @@ const systemRouter = {
7478
parentPath: '/system',
7579
parentName: 'system',
7680
permission: [
77-
new ComplexPermission(
78-
[RoleConst.ADMIN],
79-
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
80-
[EditionConst.IS_EE],
81-
'OR',),new ComplexPermission(
82-
[RoleConst.ADMIN],
83-
[PermissionConst.RESOURCE_TOOL_READ],
84-
[EditionConst.IS_EE],
85-
'OR',),new ComplexPermission(
86-
[RoleConst.ADMIN],
87-
[PermissionConst.RESOURCE_MODEL_READ],
88-
[EditionConst.IS_EE],
89-
'OR',),],
81+
new ComplexPermission(
82+
[RoleConst.ADMIN],
83+
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
84+
[EditionConst.IS_EE],
85+
'OR',
86+
),
87+
new ComplexPermission(
88+
[RoleConst.ADMIN],
89+
[PermissionConst.RESOURCE_TOOL_READ],
90+
[EditionConst.IS_EE],
91+
'OR',
92+
),
93+
new ComplexPermission(
94+
[RoleConst.ADMIN],
95+
[PermissionConst.RESOURCE_MODEL_READ],
96+
[EditionConst.IS_EE],
97+
'OR',
98+
),
99+
],
90100
},
91101
children: [
92-
// {
93-
// path: '/system/resource-management/application',
94-
// name: 'ApplicationResourceIndex',
95-
// meta: {
96-
// title: 'views.application.title',
97-
// activeMenu: '/system',
98-
// parentPath: '/system',
99-
// parentName: 'system',
100-
// },
101-
// component: () =>
102-
// import('@/views/system-resource-management/ApplicationResourceIndex.vue'),
103-
// },
104102
{
105103
path: '/system/resource-management/knowledge',
106104
name: 'KnowledgeResourceIndex',
@@ -115,7 +113,9 @@ const systemRouter = {
115113
[RoleConst.ADMIN],
116114
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
117115
[EditionConst.IS_EE],
118-
'OR',),],
116+
'OR',
117+
),
118+
],
119119
},
120120
component: () => import('@/views/system-resource-management/KnowledgeResourceIndex.vue'),
121121
},
@@ -133,7 +133,9 @@ const systemRouter = {
133133
[RoleConst.ADMIN],
134134
[PermissionConst.RESOURCE_TOOL_READ],
135135
[EditionConst.IS_EE],
136-
'OR',),],
136+
'OR',
137+
),
138+
],
137139
},
138140
component: () => import('@/views/system-resource-management/ToolResourceIndex.vue'),
139141
},
@@ -150,7 +152,9 @@ const systemRouter = {
150152
[RoleConst.ADMIN],
151153
[PermissionConst.RESOURCE_MODEL_READ],
152154
[EditionConst.IS_EE],
153-
'OR',),],
155+
'OR',
156+
),
157+
],
154158
},
155159
component: () => import('@/views/system-resource-management/ModelResourceIndex.vue'),
156160
},
@@ -167,12 +171,7 @@ const systemRouter = {
167171
parentPath: '/system',
168172
parentName: 'system',
169173
sameRoute: 'authorization',
170-
permission: [
171-
new ComplexPermission(
172-
[RoleConst.ADMIN],
173-
[PermissionConst.SHARED_KNOWLEDGE_READ],
174-
[EditionConst.IS_EE],
175-
'OR',),],
174+
permission: [RoleConst.ADMIN],
176175
},
177176

178177
children: [
@@ -186,6 +185,13 @@ const systemRouter = {
186185
parentName: 'system',
187186
resource: 'APPLICATION',
188187
},
188+
permission: [
189+
RoleConst.ADMIN,
190+
RoleConst.WORKSPACE_MANAGE,
191+
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
192+
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ
193+
.getWorkspacePermissionWorkspaceManageRole,
194+
],
189195
component: () => import('@/views/system/resource-authorization/index.vue'),
190196
},
191197
{
@@ -197,6 +203,13 @@ const systemRouter = {
197203
parentPath: '/system',
198204
parentName: 'system',
199205
resource: 'KNOWLEDGE',
206+
permission: [
207+
RoleConst.ADMIN,
208+
RoleConst.WORKSPACE_MANAGE,
209+
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
210+
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ
211+
.getWorkspacePermissionWorkspaceManageRole,
212+
],
200213
},
201214
component: () => import('@/views/system/resource-authorization/index.vue'),
202215
},
@@ -209,6 +222,13 @@ const systemRouter = {
209222
parentPath: '/system',
210223
parentName: 'system',
211224
resource: 'TOOL',
225+
permission: [
226+
RoleConst.ADMIN,
227+
RoleConst.WORKSPACE_MANAGE,
228+
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
229+
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
230+
.getWorkspacePermissionWorkspaceManageRole,
231+
],
212232
},
213233
component: () => import('@/views/system/resource-authorization/index.vue'),
214234
},
@@ -221,6 +241,13 @@ const systemRouter = {
221241
parentPath: '/system',
222242
parentName: 'system',
223243
resource: 'MODEL',
244+
permission: [
245+
RoleConst.ADMIN,
246+
RoleConst.WORKSPACE_MANAGE,
247+
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
248+
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
249+
.getWorkspacePermissionWorkspaceManageRole,
250+
],
224251
},
225252
component: () => import('@/views/system/resource-authorization/index.vue'),
226253
},
@@ -237,11 +264,13 @@ const systemRouter = {
237264
parentPath: '/system',
238265
parentName: 'system',
239266
permission: [
240-
new ComplexPermission(
241-
[RoleConst.ADMIN],
242-
[PermissionConst.SHARED_KNOWLEDGE_READ],
243-
[EditionConst.IS_EE],
244-
'OR',),],
267+
new ComplexPermission(
268+
[RoleConst.ADMIN],
269+
[PermissionConst.SHARED_KNOWLEDGE_READ],
270+
[EditionConst.IS_EE],
271+
'OR',
272+
),
273+
],
245274
},
246275
children: [
247276
{
@@ -257,15 +286,21 @@ const systemRouter = {
257286
[RoleConst.ADMIN],
258287
[PermissionConst.SHARED_KNOWLEDGE_READ],
259288
[EditionConst.IS_EE],
260-
'OR',),new ComplexPermission(
289+
'OR',
290+
),
291+
new ComplexPermission(
261292
[RoleConst.ADMIN],
262293
[PermissionConst.SHARED_TOOL_READ],
263294
[EditionConst.IS_EE],
264-
'OR',),new ComplexPermission(
295+
'OR',
296+
),
297+
new ComplexPermission(
265298
[RoleConst.ADMIN],
266299
[PermissionConst.SHARED_MODEL_READ],
267300
[EditionConst.IS_EE],
268-
'OR',),],
301+
'OR',
302+
),
303+
],
269304
},
270305
component: () => import('@/views/system-shared/KnowLedgeSharedIndex.vue'),
271306
},
@@ -282,7 +317,10 @@ const systemRouter = {
282317
[RoleConst.ADMIN],
283318
[PermissionConst.SHARED_TOOL_READ],
284319
[EditionConst.IS_EE],
285-
'OR',),],},
320+
'OR',
321+
),
322+
],
323+
},
286324
component: () => import('@/views/system-shared/ToolSharedIndex.vue'),
287325
},
288326
{
@@ -298,7 +336,9 @@ const systemRouter = {
298336
[RoleConst.ADMIN],
299337
[PermissionConst.SHARED_MODEL_READ],
300338
[EditionConst.IS_EE],
301-
'OR',),],
339+
'OR',
340+
),
341+
],
302342
},
303343
component: () => import('@/views/system-shared/ModelSharedIndex.vue'),
304344
},
@@ -319,15 +359,21 @@ const systemRouter = {
319359
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
320360
[PermissionConst.WORKSPACE_CHAT_USER_READ, PermissionConst.CHAT_USER_READ],
321361
[EditionConst.IS_EE, EditionConst.IS_PE],
322-
'OR',),new ComplexPermission(
362+
'OR',
363+
),
364+
new ComplexPermission(
323365
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
324366
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
325367
[EditionConst.IS_EE, EditionConst.IS_PE],
326-
'OR',),new ComplexPermission(
368+
'OR',
369+
),
370+
new ComplexPermission(
327371
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
328372
[PermissionConst.CHAT_USER_AUTH_READ],
329373
[EditionConst.IS_EE, EditionConst.IS_PE],
330-
'OR',)],
374+
'OR',
375+
),
376+
],
331377
},
332378
children: [
333379
{
@@ -344,7 +390,9 @@ const systemRouter = {
344390
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
345391
[PermissionConst.CHAT_USER_READ, PermissionConst.WORKSPACE_CHAT_USER_READ],
346392
[EditionConst.IS_EE, EditionConst.IS_PE],
347-
'OR',),],
393+
'OR',
394+
),
395+
],
348396
},
349397
component: () => import('@/views/system-chat-user/chat-user/index.vue'),
350398
},
@@ -362,7 +410,9 @@ const systemRouter = {
362410
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
363411
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
364412
[EditionConst.IS_EE, EditionConst.IS_PE],
365-
'OR',),],
413+
'OR',
414+
),
415+
],
366416
},
367417
component: () => import('@/views/system-chat-user/group/index.vue'),
368418
},
@@ -380,7 +430,9 @@ const systemRouter = {
380430
[RoleConst.ADMIN],
381431
[PermissionConst.CHAT_USER_AUTH_READ],
382432
[EditionConst.IS_EE, EditionConst.IS_PE],
383-
'OR',),],
433+
'OR',
434+
),
435+
],
384436
},
385437
component: () => import('@/views/system-chat-user/authentication/index.vue'),
386438
},
@@ -398,19 +450,25 @@ const systemRouter = {
398450
parentName: 'system',
399451
sameRoute: 'setting',
400452
permission: [
401-
new ComplexPermission(
402-
[RoleConst.ADMIN],
403-
[PermissionConst.APPEARANCE_SETTINGS_READ],
404-
[EditionConst.IS_EE, EditionConst.IS_PE],
405-
'OR',),new ComplexPermission(
406-
[RoleConst.ADMIN],
407-
[PermissionConst.LOGIN_AUTH_READ],
408-
[EditionConst.IS_EE, EditionConst.IS_PE],
409-
'OR',),new ComplexPermission(
410-
[RoleConst.ADMIN],
411-
[PermissionConst.EMAIL_SETTING_READ],
412-
[EditionConst.IS_EE, EditionConst.IS_PE],
413-
'OR',),],
453+
new ComplexPermission(
454+
[RoleConst.ADMIN],
455+
[PermissionConst.APPEARANCE_SETTINGS_READ],
456+
[EditionConst.IS_EE, EditionConst.IS_PE],
457+
'OR',
458+
),
459+
new ComplexPermission(
460+
[RoleConst.ADMIN],
461+
[PermissionConst.LOGIN_AUTH_READ],
462+
[EditionConst.IS_EE, EditionConst.IS_PE],
463+
'OR',
464+
),
465+
new ComplexPermission(
466+
[RoleConst.ADMIN],
467+
[PermissionConst.EMAIL_SETTING_READ],
468+
[EditionConst.IS_EE, EditionConst.IS_PE],
469+
'OR',
470+
),
471+
],
414472
},
415473
children: [
416474
{
@@ -427,7 +485,9 @@ const systemRouter = {
427485
[RoleConst.ADMIN],
428486
[PermissionConst.APPEARANCE_SETTINGS_READ],
429487
[EditionConst.IS_EE, EditionConst.IS_PE],
430-
'OR',),],
488+
'OR',
489+
),
490+
],
431491
},
432492
component: () => import('@/views/system-setting/theme/index.vue'),
433493
},
@@ -445,7 +505,9 @@ const systemRouter = {
445505
[RoleConst.ADMIN],
446506
[PermissionConst.LOGIN_AUTH_READ],
447507
[EditionConst.IS_EE, EditionConst.IS_PE],
448-
'OR',),],
508+
'OR',
509+
),
510+
],
449511
},
450512
component: () => import('@/views/system-setting/authentication/index.vue'),
451513
},
@@ -463,7 +525,9 @@ const systemRouter = {
463525
[RoleConst.ADMIN],
464526
[PermissionConst.EMAIL_SETTING_READ],
465527
[EditionConst.IS_EE, EditionConst.IS_PE],
466-
'OR',),],
528+
'OR',
529+
),
530+
],
467531
},
468532
component: () => import('@/views/system-setting/email/index.vue'),
469533
},
@@ -488,7 +552,6 @@ const systemRouter = {
488552
'OR',
489553
),
490554
],
491-
492555
},
493556
component: () => import('@/views/system/operate-log/index.vue'),
494557
},

0 commit comments

Comments
 (0)