Skip to content

Commit 23f792d

Browse files
committed
feat: Batch button permission
1 parent a28a6a0 commit 23f792d

File tree

13 files changed

+99
-7
lines changed

13 files changed

+99
-7
lines changed

ui/src/permission/application/system-manage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import {hasPermission} from '@/utils/permission/index'
22
import {PermissionConst, RoleConst} from '@/utils/permission/data'
33

44
const systemManage = {
5-
create: () => false,
5+
create: () => false,
6+
batchDelete: () => false,
7+
batchMove: () => false,
68
folderCreate: () => false,
79
edit: () =>
810
hasPermission(

ui/src/permission/application/workspace.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ const workspace = {
1313
],
1414
'OR'
1515
),
16+
batchDelete: () =>
17+
hasPermission(
18+
[
19+
RoleConst.USER.getWorkspaceRole,
20+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
21+
PermissionConst.APPLICATION_BATCH_DELETE.getWorkspacePermission,
22+
PermissionConst.APPLICATION_BATCH_DELETE.getWorkspacePermissionWorkspaceManageRole,
23+
],
24+
'OR',
25+
),
26+
batchMove: () =>
27+
hasPermission(
28+
[
29+
RoleConst.USER.getWorkspaceRole,
30+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
31+
PermissionConst.APPLICATION_BATCH_MOVE.getWorkspacePermission,
32+
PermissionConst.APPLICATION_BATCH_MOVE.getWorkspacePermissionWorkspaceManageRole,
33+
],
34+
'OR',
35+
),
1636
folderCreate: (folder_id: string) =>
1737
hasPermission(
1838
[

ui/src/permission/knowledge/system-manage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const systemManage = {
1313
'OR',
1414
),
1515
create: () => false,
16+
batchDelete: () => false,
17+
batchMove: () => false,
1618
sync: () => hasPermission(
1719
[
1820
RoleConst.ADMIN,

ui/src/permission/knowledge/system-share.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/dat
44
const share = {
55
is_share: () => false,
66
create: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_CREATE], 'OR'),
7+
batchDelete: () => false,
8+
batchMove: () => false,
79
sync: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_SYNC], 'OR'),
810
vector: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_VECTOR], 'OR'),
911
generate: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_GENERATE], 'OR'),

ui/src/permission/knowledge/workspace-share.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/dat
44
const workspaceShare = {
55
is_share: () => true,
66
create: () => false,
7+
batchDelete: () => false,
8+
batchMove: () => false,
79
sync: () => false,
810
vector: () => false,
911
generate: () => false,

ui/src/permission/knowledge/workspace.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@ const workspace = {
2525
],
2626
'OR',
2727
),
28+
batchDelete: () =>
29+
hasPermission(
30+
[
31+
RoleConst.USER.getWorkspaceRole,
32+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
33+
PermissionConst.KNOWLEDGE_BATCH_DELETE.getWorkspacePermission,
34+
PermissionConst.KNOWLEDGE_BATCH_DELETE.getWorkspacePermissionWorkspaceManageRole,
35+
],
36+
'OR',
37+
),
38+
batchMove: () =>
39+
hasPermission(
40+
[
41+
RoleConst.USER.getWorkspaceRole,
42+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
43+
PermissionConst.KNOWLEDGE_BATCH_MOVE.getWorkspacePermission,
44+
PermissionConst.KNOWLEDGE_BATCH_MOVE.getWorkspacePermissionWorkspaceManageRole,
45+
],
46+
'OR',
47+
),
2848
folderRead: (folder_id: string) =>
2949
hasPermission(
3050
[

ui/src/permission/tool/system-manage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ const systemManage = {
6363
'OR'
6464
),
6565
create: () => false,
66+
batchDelete: () => false,
67+
batchMove: () => false,
6668
import: () => false,
6769
switch: () =>
6870
hasPermission(

ui/src/permission/tool/system-share.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const share = {
2121
],
2222
'OR',
2323
),
24+
batchDelete: () => false,
25+
batchMove: () => false,
2426
import: () =>
2527
hasPermission(
2628
[

ui/src/permission/tool/workspace.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,26 @@ const workspace = {
3131
],
3232
'OR'
3333
),
34+
batchDelete: () =>
35+
hasPermission(
36+
[
37+
RoleConst.USER.getWorkspaceRole,
38+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
39+
PermissionConst.TOOL_BATCH_DELETE.getWorkspacePermission,
40+
PermissionConst.TOOL_BATCH_DELETE.getWorkspacePermissionWorkspaceManageRole,
41+
],
42+
'OR',
43+
),
44+
batchMove: () =>
45+
hasPermission(
46+
[
47+
RoleConst.USER.getWorkspaceRole,
48+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
49+
PermissionConst.TOOL_BATCH_MOVE.getWorkspacePermission,
50+
PermissionConst.TOOL_BATCH_MOVE.getWorkspacePermissionWorkspaceManageRole,
51+
],
52+
'OR',
53+
),
3454
import: () =>
3555
hasPermission(
3656
[

ui/src/utils/permission/data.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ const PermissionConst = {
128128
KNOWLEDGE_GENERATE: new Permission('KNOWLEDGE:READ+GENERATE'),
129129
KNOWLEDGE_RELATE_RESOURCE_VIEW: new Permission('KNOWLEDGE:READ+RELATE_VIEW'),
130130

131+
KNOWLEDGE_BATCH_DELETE: new Permission('KNOWLEDGE:READ+BATCH_DELETE'),
132+
KNOWLEDGE_BATCH_MOVE: new Permission('KNOWLEDGE:READ+BATCH_MOVE'),
133+
134+
APPLICATION_BATCH_DELETE: new Permission('APPLICATION:READ+BATCH_DELETE'),
135+
APPLICATION_BATCH_MOVE: new Permission('APPLICATION:READ+BATCH_MOVE'),
136+
137+
TOOL_BATCH_DELETE: new Permission('TOOL:READ+BATCH_DELETE'),
138+
TOOL_BATCH_MOVE: new Permission('TOOL:READ+BATCH_MOVE'),
139+
131140
KNOWLEDGE_WORKFLOW_READ: new Permission('KNOWLEDGE_WORKFLOW:READ'),
132141
KNOWLEDGE_WORKFLOW_EDIT: new Permission('KNOWLEDGE_WORKFLOW:READ+EDIT'),
133142
KNOWLEDGE_WORKFLOW_EXPORT: new Permission('KNOWLEDGE_WORKFLOW:READ+EXPORT'),

0 commit comments

Comments
 (0)