Skip to content

Commit 873a9a9

Browse files
committed
feat: System route permission
1 parent 4a73755 commit 873a9a9

File tree

2 files changed

+98
-48
lines changed

2 files changed

+98
-48
lines changed

ui/src/router/modules/system.ts

Lines changed: 87 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ 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',
43-
),
44-
],
42+
'OR',),],
4543
},
4644
component: () => import('@/views/system/role/index.vue'),
4745
},
@@ -61,9 +59,7 @@ const systemRouter = {
6159
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
6260
[PermissionConst.WORKSPACE_WORKSPACE_READ, PermissionConst.WORKSPACE_READ],
6361
[EditionConst.IS_EE],
64-
'OR',
65-
),
66-
],
62+
'OR',),],
6763
},
6864
component: () => import('@/views/system/workspace/index.vue'),
6965
},
@@ -77,6 +73,20 @@ const systemRouter = {
7773
activeMenu: '/system',
7874
parentPath: '/system',
7975
parentName: 'system',
76+
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',),],
8090
},
8191
children: [
8292
// {
@@ -100,6 +110,12 @@ const systemRouter = {
100110
parentPath: '/system',
101111
parentName: 'system',
102112
sameRoute: 'workspace',
113+
permission: [
114+
new ComplexPermission(
115+
[RoleConst.ADMIN],
116+
[PermissionConst.RESOURCE_KNOWLEDGE_READ],
117+
[EditionConst.IS_EE],
118+
'OR',),],
103119
},
104120
component: () => import('@/views/system-resource-management/KnowledgeResourceIndex.vue'),
105121
},
@@ -112,6 +128,12 @@ const systemRouter = {
112128
parentPath: '/system',
113129
parentName: 'system',
114130
sameRoute: 'workspace',
131+
permission: [
132+
new ComplexPermission(
133+
[RoleConst.ADMIN],
134+
[PermissionConst.RESOURCE_TOOL_READ],
135+
[EditionConst.IS_EE],
136+
'OR',),],
115137
},
116138
component: () => import('@/views/system-resource-management/ToolResourceIndex.vue'),
117139
},
@@ -123,6 +145,12 @@ const systemRouter = {
123145
activeMenu: '/system',
124146
parentPath: '/system',
125147
parentName: 'system',
148+
permission: [
149+
new ComplexPermission(
150+
[RoleConst.ADMIN],
151+
[PermissionConst.RESOURCE_MODEL_READ],
152+
[EditionConst.IS_EE],
153+
'OR',),],
126154
},
127155
component: () => import('@/views/system-resource-management/ModelResourceIndex.vue'),
128156
},
@@ -139,6 +167,12 @@ const systemRouter = {
139167
parentPath: '/system',
140168
parentName: 'system',
141169
sameRoute: 'authorization',
170+
permission: [
171+
new ComplexPermission(
172+
[RoleConst.ADMIN],
173+
[PermissionConst.SHARED_KNOWLEDGE_READ],
174+
[EditionConst.IS_EE],
175+
'OR',),],
142176
},
143177

144178
children: [
@@ -198,7 +232,12 @@ const systemRouter = {
198232
activeMenu: '/system',
199233
parentPath: '/system',
200234
parentName: 'system',
201-
permission: [EditionConst.IS_EE],
235+
permission: [
236+
new ComplexPermission(
237+
[RoleConst.ADMIN],
238+
[PermissionConst.SHARED_KNOWLEDGE_READ],
239+
[EditionConst.IS_EE],
240+
'OR',),],
202241
},
203242
children: [
204243
{
@@ -214,9 +253,15 @@ const systemRouter = {
214253
[RoleConst.ADMIN],
215254
[PermissionConst.SHARED_KNOWLEDGE_READ],
216255
[EditionConst.IS_EE],
217-
'OR',
218-
),
219-
],
256+
'OR',),new ComplexPermission(
257+
[RoleConst.ADMIN],
258+
[PermissionConst.SHARED_TOOL_READ],
259+
[EditionConst.IS_EE],
260+
'OR',),new ComplexPermission(
261+
[RoleConst.ADMIN],
262+
[PermissionConst.SHARED_MODEL_READ],
263+
[EditionConst.IS_EE],
264+
'OR',),],
220265
},
221266
component: () => import('@/views/system-shared/KnowLedgeSharedIndex.vue'),
222267
},
@@ -233,10 +278,7 @@ const systemRouter = {
233278
[RoleConst.ADMIN],
234279
[PermissionConst.SHARED_TOOL_READ],
235280
[EditionConst.IS_EE],
236-
'OR',
237-
),
238-
],
239-
},
281+
'OR',),],},
240282
component: () => import('@/views/system-shared/ToolSharedIndex.vue'),
241283
},
242284
{
@@ -252,9 +294,7 @@ const systemRouter = {
252294
[RoleConst.ADMIN],
253295
[PermissionConst.SHARED_MODEL_READ],
254296
[EditionConst.IS_EE],
255-
'OR',
256-
),
257-
],
297+
'OR',),],
258298
},
259299
component: () => import('@/views/system-shared/ModelSharedIndex.vue'),
260300
},
@@ -275,9 +315,15 @@ const systemRouter = {
275315
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
276316
[PermissionConst.WORKSPACE_CHAT_USER_READ, PermissionConst.CHAT_USER_READ],
277317
[EditionConst.IS_EE, EditionConst.IS_PE],
278-
'OR',
279-
),
280-
],
318+
'OR',),new ComplexPermission(
319+
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
320+
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
321+
[EditionConst.IS_EE, EditionConst.IS_PE],
322+
'OR',),new ComplexPermission(
323+
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
324+
[PermissionConst.CHAT_USER_AUTH_READ],
325+
[EditionConst.IS_EE, EditionConst.IS_PE],
326+
'OR',)],
281327
},
282328
children: [
283329
{
@@ -294,9 +340,7 @@ const systemRouter = {
294340
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
295341
[PermissionConst.CHAT_USER_READ, PermissionConst.WORKSPACE_CHAT_USER_READ],
296342
[EditionConst.IS_EE, EditionConst.IS_PE],
297-
'OR',
298-
),
299-
],
343+
'OR',),],
300344
},
301345
component: () => import('@/views/system-chat-user/chat-user/index.vue'),
302346
},
@@ -314,9 +358,7 @@ const systemRouter = {
314358
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
315359
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
316360
[EditionConst.IS_EE, EditionConst.IS_PE],
317-
'OR',
318-
),
319-
],
361+
'OR',),],
320362
},
321363
component: () => import('@/views/system-chat-user/group/index.vue'),
322364
},
@@ -334,9 +376,7 @@ const systemRouter = {
334376
[RoleConst.ADMIN],
335377
[PermissionConst.CHAT_USER_AUTH_READ],
336378
[EditionConst.IS_EE, EditionConst.IS_PE],
337-
'OR',
338-
),
339-
],
379+
'OR',),],
340380
},
341381
component: () => import('@/views/system-chat-user/authentication/index.vue'),
342382
},
@@ -353,6 +393,20 @@ const systemRouter = {
353393
parentPath: '/system',
354394
parentName: 'system',
355395
sameRoute: 'setting',
396+
permission: [
397+
new ComplexPermission(
398+
[RoleConst.ADMIN],
399+
[PermissionConst.APPEARANCE_SETTINGS_READ],
400+
[EditionConst.IS_EE, EditionConst.IS_PE],
401+
'OR',),new ComplexPermission(
402+
[RoleConst.ADMIN],
403+
[PermissionConst.LOGIN_AUTH_READ],
404+
[EditionConst.IS_EE, EditionConst.IS_PE],
405+
'OR',),new ComplexPermission(
406+
[RoleConst.ADMIN],
407+
[PermissionConst.EMAIL_SETTING_READ],
408+
[EditionConst.IS_EE, EditionConst.IS_PE],
409+
'OR',),],
356410
},
357411
children: [
358412
{
@@ -369,9 +423,7 @@ const systemRouter = {
369423
[RoleConst.ADMIN],
370424
[PermissionConst.APPEARANCE_SETTINGS_READ],
371425
[EditionConst.IS_EE, EditionConst.IS_PE],
372-
'OR',
373-
),
374-
],
426+
'OR',),],
375427
},
376428
component: () => import('@/views/system-setting/theme/index.vue'),
377429
},
@@ -389,9 +441,7 @@ const systemRouter = {
389441
[RoleConst.ADMIN],
390442
[PermissionConst.LOGIN_AUTH_READ],
391443
[EditionConst.IS_EE, EditionConst.IS_PE],
392-
'OR',
393-
),
394-
],
444+
'OR',),],
395445
},
396446
component: () => import('@/views/system-setting/authentication/index.vue'),
397447
},
@@ -409,9 +459,7 @@ const systemRouter = {
409459
[RoleConst.ADMIN],
410460
[PermissionConst.EMAIL_SETTING_READ],
411461
[EditionConst.IS_EE, EditionConst.IS_PE],
412-
'OR',
413-
),
414-
],
462+
'OR',),],
415463
},
416464
component: () => import('@/views/system-setting/email/index.vue'),
417465
},
@@ -433,9 +481,7 @@ const systemRouter = {
433481
[RoleConst.ADMIN],
434482
[PermissionConst.OPERATION_LOG_READ],
435483
[EditionConst.IS_EE, EditionConst.IS_PE],
436-
'OR',
437-
),
438-
],
484+
'OR',),],
439485
},
440486
component: () => import('@/views/system/operate-log/index.vue'),
441487
},

ui/src/utils/permission/data.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,17 @@ const PermissionConst = {
194194
TOOL_IMPORT:new Permission('TOOL:READ+IMPORT'),
195195
TOOL_EXPORT:new Permission('TOOL:READ+EXPORT'),
196196

197-
RESOURCE_TOOL_CREATE:new Permission('SYSTEM_RES_TOOL:READ+CREATE'),
198-
RESOURCE_TOOL_EDIT:new Permission('SYSTEM_RES_TOOL:READ+EDIT'),
199-
RESOURCE_TOOL_READ:new Permission('SYSTEM_RES_TOOL:READ'),
200-
RESOURCE_TOOL_DELETE:new Permission('SYSTEM_RES_TOOL:READ+DELETE'),
201-
RESOURCE_TOOL_DEBUG:new Permission('SYSTEM_RES_TOOL:READ+DEBUG'),
202-
RESOURCE_TOOL_IMPORT:new Permission('SYSTEM_RES_TOOL:READ+IMPORT'),
203-
RESOURCE_TOOL_EXPORT:new Permission('SYSTEM_RES_TOOL:READ+EXPORT'),
197+
RESOURCE_TOOL_CREATE:new Permission('SYSTEM_RESOURCE_TOOL:READ+CREATE'),
198+
RESOURCE_TOOL_EDIT:new Permission('SYSTEM_RESOURCE_TOOL:READ+EDIT'),
199+
RESOURCE_TOOL_READ:new Permission('SYSTEM_RESOURCE_TOOL:READ'),
200+
RESOURCE_TOOL_DELETE:new Permission('SYSTEM_RESOURCE_TOOL:READ+DELETE'),
201+
RESOURCE_TOOL_DEBUG:new Permission('SYSTEM_RESOURCE_TOOL:READ+DEBUG'),
202+
RESOURCE_TOOL_IMPORT:new Permission('SYSTEM_RESOURCE_TOOL:READ+IMPORT'),
203+
RESOURCE_TOOL_EXPORT:new Permission('SYSTEM_RESOURCE_TOOL:READ+EXPORT'),
204+
205+
RESOURCE_KNOWLEDGE_READ:new Permission('SYSTEM_RESOURCE_KNOWLEDGE:READ'),
206+
207+
RESOURCE_MODEL_READ:new Permission('SYSTEM_RESOURCE_MODEL:READ'),
204208

205209
APPEARANCE_SETTINGS_READ:new Permission('APPEARANCE_SETTINGS:READ'),
206210
APPEARANCE_SETTINGS_EDIT:new Permission('APPEARANCE_SETTINGS:READ+EDIT'),

0 commit comments

Comments
 (0)