Skip to content

Commit 8583ba2

Browse files
committed
feat: System route permission
1 parent 6c6aa20 commit 8583ba2

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
component: () => import('@/views/system/resource-authorization/index.vue'),
144178
},
@@ -152,7 +186,12 @@ const systemRouter = {
152186
activeMenu: '/system',
153187
parentPath: '/system',
154188
parentName: 'system',
155-
permission: [EditionConst.IS_EE],
189+
permission: [
190+
new ComplexPermission(
191+
[RoleConst.ADMIN],
192+
[PermissionConst.SHARED_KNOWLEDGE_READ],
193+
[EditionConst.IS_EE],
194+
'OR',),],
156195
},
157196
children: [
158197
{
@@ -168,9 +207,15 @@ const systemRouter = {
168207
[RoleConst.ADMIN],
169208
[PermissionConst.SHARED_KNOWLEDGE_READ],
170209
[EditionConst.IS_EE],
171-
'OR',
172-
),
173-
],
210+
'OR',),new ComplexPermission(
211+
[RoleConst.ADMIN],
212+
[PermissionConst.SHARED_TOOL_READ],
213+
[EditionConst.IS_EE],
214+
'OR',),new ComplexPermission(
215+
[RoleConst.ADMIN],
216+
[PermissionConst.SHARED_MODEL_READ],
217+
[EditionConst.IS_EE],
218+
'OR',),],
174219
},
175220
component: () => import('@/views/system-shared/KnowLedgeSharedIndex.vue'),
176221
},
@@ -187,10 +232,7 @@ const systemRouter = {
187232
[RoleConst.ADMIN],
188233
[PermissionConst.SHARED_TOOL_READ],
189234
[EditionConst.IS_EE],
190-
'OR',
191-
),
192-
],
193-
},
235+
'OR',),],},
194236
component: () => import('@/views/system-shared/ToolSharedIndex.vue'),
195237
},
196238
{
@@ -206,9 +248,7 @@ const systemRouter = {
206248
[RoleConst.ADMIN],
207249
[PermissionConst.SHARED_MODEL_READ],
208250
[EditionConst.IS_EE],
209-
'OR',
210-
),
211-
],
251+
'OR',),],
212252
},
213253
component: () => import('@/views/system-shared/ModelSharedIndex.vue'),
214254
},
@@ -229,9 +269,15 @@ const systemRouter = {
229269
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
230270
[PermissionConst.WORKSPACE_CHAT_USER_READ, PermissionConst.CHAT_USER_READ],
231271
[EditionConst.IS_EE, EditionConst.IS_PE],
232-
'OR',
233-
),
234-
],
272+
'OR',),new ComplexPermission(
273+
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
274+
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
275+
[EditionConst.IS_EE, EditionConst.IS_PE],
276+
'OR',),new ComplexPermission(
277+
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
278+
[PermissionConst.CHAT_USER_AUTH_READ],
279+
[EditionConst.IS_EE, EditionConst.IS_PE],
280+
'OR',)],
235281
},
236282
children: [
237283
{
@@ -248,9 +294,7 @@ const systemRouter = {
248294
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
249295
[PermissionConst.CHAT_USER_READ, PermissionConst.WORKSPACE_CHAT_USER_READ],
250296
[EditionConst.IS_EE, EditionConst.IS_PE],
251-
'OR',
252-
),
253-
],
297+
'OR',),],
254298
},
255299
component: () => import('@/views/system-chat-user/chat-user/index.vue'),
256300
},
@@ -268,9 +312,7 @@ const systemRouter = {
268312
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
269313
[PermissionConst.WORKSPACE_USER_GROUP_READ, PermissionConst.USER_GROUP_READ],
270314
[EditionConst.IS_EE, EditionConst.IS_PE],
271-
'OR',
272-
),
273-
],
315+
'OR',),],
274316
},
275317
component: () => import('@/views/system-chat-user/group/index.vue'),
276318
},
@@ -288,9 +330,7 @@ const systemRouter = {
288330
[RoleConst.ADMIN],
289331
[PermissionConst.CHAT_USER_AUTH_READ],
290332
[EditionConst.IS_EE, EditionConst.IS_PE],
291-
'OR',
292-
),
293-
],
333+
'OR',),],
294334
},
295335
component: () => import('@/views/system-chat-user/authentication/index.vue'),
296336
},
@@ -307,6 +347,20 @@ const systemRouter = {
307347
parentPath: '/system',
308348
parentName: 'system',
309349
sameRoute: 'setting',
350+
permission: [
351+
new ComplexPermission(
352+
[RoleConst.ADMIN],
353+
[PermissionConst.APPEARANCE_SETTINGS_READ],
354+
[EditionConst.IS_EE, EditionConst.IS_PE],
355+
'OR',),new ComplexPermission(
356+
[RoleConst.ADMIN],
357+
[PermissionConst.LOGIN_AUTH_READ],
358+
[EditionConst.IS_EE, EditionConst.IS_PE],
359+
'OR',),new ComplexPermission(
360+
[RoleConst.ADMIN],
361+
[PermissionConst.EMAIL_SETTING_READ],
362+
[EditionConst.IS_EE, EditionConst.IS_PE],
363+
'OR',),],
310364
},
311365
children: [
312366
{
@@ -323,9 +377,7 @@ const systemRouter = {
323377
[RoleConst.ADMIN],
324378
[PermissionConst.APPEARANCE_SETTINGS_READ],
325379
[EditionConst.IS_EE, EditionConst.IS_PE],
326-
'OR',
327-
),
328-
],
380+
'OR',),],
329381
},
330382
component: () => import('@/views/system-setting/theme/index.vue'),
331383
},
@@ -343,9 +395,7 @@ const systemRouter = {
343395
[RoleConst.ADMIN],
344396
[PermissionConst.LOGIN_AUTH_READ],
345397
[EditionConst.IS_EE, EditionConst.IS_PE],
346-
'OR',
347-
),
348-
],
398+
'OR',),],
349399
},
350400
component: () => import('@/views/system-setting/authentication/index.vue'),
351401
},
@@ -363,9 +413,7 @@ const systemRouter = {
363413
[RoleConst.ADMIN],
364414
[PermissionConst.EMAIL_SETTING_READ],
365415
[EditionConst.IS_EE, EditionConst.IS_PE],
366-
'OR',
367-
),
368-
],
416+
'OR',),],
369417
},
370418
component: () => import('@/views/system-setting/email/index.vue'),
371419
},
@@ -387,9 +435,7 @@ const systemRouter = {
387435
[RoleConst.ADMIN],
388436
[PermissionConst.OPERATION_LOG_READ],
389437
[EditionConst.IS_EE, EditionConst.IS_PE],
390-
'OR',
391-
),
392-
],
438+
'OR',),],
393439
},
394440
component: () => import('@/views/system/operate-log/index.vue'),
395441
},

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)