Skip to content

Commit 0a680c4

Browse files
authored
Merge pull request #678 from actiontech/fix/optimize-permission
[fix]: Fix permission control issues
2 parents d6a0ec9 + 993b1ac commit 0a680c4

File tree

8 files changed

+68
-81
lines changed

8 files changed

+68
-81
lines changed

packages/base/src/locale/zh-CN/dmsUserCenter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ export default {
7474
title: '角色列表',
7575
columns: {
7676
opPermissions: '平台操作权限'
77-
}
77+
},
78+
searchPlaceholder: '输入操作权限关键词搜索'
7879
},
7980
roleForm: {
8081
name: '角色名',

packages/base/src/page/DataExportManagement/List/__tests__/__snapshots__/index.test.tsx.snap

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,7 @@ exports[`test base/DataExport/List render batch close button When the user is no
1313
</div>
1414
<div
1515
class="extra"
16-
>
17-
<a
18-
href="/project/700300/data/export/create"
19-
>
20-
<button
21-
class="ant-btn ant-btn-primary basic-button-wrapper css-geipcv"
22-
type="button"
23-
>
24-
<span
25-
class="ant-btn-icon"
26-
>
27-
<svg
28-
color="currentColor"
29-
fill="none"
30-
height="10"
31-
viewBox="0 0 10 10"
32-
width="10"
33-
xmlns="http://www.w3.org/2000/svg"
34-
>
35-
<path
36-
d="m5.02.5-.012 9M.5 5h9"
37-
stroke="currentColor"
38-
stroke-linejoin="round"
39-
stroke-width="1.5"
40-
/>
41-
</svg>
42-
</span>
43-
<span>
44-
创建导出
45-
</span>
46-
</button>
47-
</a>
48-
</div>
16+
/>
4917
</div>
5018
<div
5119
class="ant-spin-nested-loading"

packages/base/src/page/UserCenter/__tests__/__snapshots__/index.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4440,7 +4440,7 @@ exports[`base/UserCenter switch to role list 1`] = `
44404440
<input
44414441
class="ant-input ant-input-sm"
44424442
id="actiontech-table-search-input"
4443-
placeholder="输入关键字搜索"
4443+
placeholder="输入操作权限关键词搜索"
44444444
type="text"
44454445
value=""
44464446
/>

packages/base/src/page/UserCenter/components/RoleList/List.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ const RoleList: React.FC<{ activePage: UserCenterListEnum }> = ({
131131
onChange: setSearchKeyword,
132132
onSearch: () => {
133133
refreshBySearchKeyword();
134-
}
134+
},
135+
placeholder: t('dmsUserCenter.role.roleList.searchPlaceholder')
135136
}}
136137
/>
137138
<ActiontechTable

packages/base/src/page/UserCenter/components/RoleList/__tests__/__snapshots__/RoleList.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exports[`base/UserCenter/RoleList render role table 1`] = `
2323
<input
2424
class="ant-input ant-input-sm"
2525
id="actiontech-table-search-input"
26-
placeholder="输入关键字搜索"
26+
placeholder="输入操作权限关键词搜索"
2727
type="text"
2828
value=""
2929
/>
@@ -946,7 +946,7 @@ exports[`base/UserCenter/RoleList should refresh role table when change current
946946
<input
947947
class="ant-input ant-input-sm"
948948
id="actiontech-table-search-input"
949-
placeholder="输入关键字搜索"
949+
placeholder="输入操作权限关键词搜索"
950950
type="text"
951951
value=""
952952
/>
@@ -3314,7 +3314,7 @@ exports[`base/UserCenter/RoleList should refresh role table when change current
33143314
<input
33153315
class="ant-input ant-input-sm"
33163316
id="actiontech-table-search-input"
3317-
placeholder="输入关键字搜索"
3317+
placeholder="输入操作权限关键词搜索"
33183318
type="text"
33193319
value=""
33203320
/>
@@ -5682,7 +5682,7 @@ exports[`base/UserCenter/RoleList should render empty tips when request not succ
56825682
<input
56835683
class="ant-input ant-input-sm"
56845684
id="actiontech-table-search-input"
5685-
placeholder="输入关键字搜索"
5685+
placeholder="输入操作权限关键词搜索"
56865686
type="text"
56875687
value=""
56885688
/>

packages/shared/lib/features/usePermission/__tests__/__snapshots__/index.test.ts.snap

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,16 @@ exports[`usePermission should match snapshot 2`] = `
558558
"type": "action",
559559
},
560560
"action:create_data_export": {
561+
"dbServicePermission": {
562+
"opType": "create_export_task",
563+
},
561564
"id": "action:create_data_export",
562565
"projectArchived": false,
566+
"projectManager": true,
567+
"role": [
568+
"admin",
569+
"systemAdministrator",
570+
],
563571
"type": "action",
564572
},
565573
"action:create_modified_sql_workflow": {
@@ -599,8 +607,16 @@ exports[`usePermission should match snapshot 2`] = `
599607
"type": "action",
600608
},
601609
"action:create_sql_audit": {
610+
"dbServicePermission": {
611+
"opType": "create_workflow",
612+
},
602613
"id": "action:create_sql_audit",
603614
"projectArchived": false,
615+
"projectManager": true,
616+
"role": [
617+
"admin",
618+
"systemAdministrator",
619+
],
604620
"type": "action",
605621
},
606622
"action:create_sql_management_exception": {
@@ -615,8 +631,16 @@ exports[`usePermission should match snapshot 2`] = `
615631
"type": "action",
616632
},
617633
"action:create_workflow": {
634+
"dbServicePermission": {
635+
"opType": "create_workflow",
636+
},
618637
"id": "action:create_workflow",
619638
"projectArchived": false,
639+
"projectManager": true,
640+
"role": [
641+
"admin",
642+
"systemAdministrator",
643+
],
620644
"type": "action",
621645
},
622646
"action:data_export_batch_close": {
@@ -647,7 +671,6 @@ exports[`usePermission should match snapshot 2`] = `
647671
"id": "action:db_service_create_audit_plan",
648672
"projectArchived": false,
649673
"projectManager": true,
650-
"projectPermission": "manage_project_data_source",
651674
"role": [
652675
"admin",
653676
"systemAdministrator",
@@ -1303,8 +1326,16 @@ exports[`usePermission should match snapshot 2`] = `
13031326
"type": "action",
13041327
},
13051328
"action:sql_management_conf_create_operator": {
1329+
"dbServicePermission": {
1330+
"opType": "save_audit_plan",
1331+
},
13061332
"id": "action:sql_management_conf_create_operator",
13071333
"projectArchived": false,
1334+
"projectManager": true,
1335+
"role": [
1336+
"admin",
1337+
"systemAdministrator",
1338+
],
13081339
"type": "action",
13091340
},
13101341
"action:sql_management_conf_delete_operator": {

packages/shared/lib/features/usePermission/permissionManifest.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ export const PERMISSION_MANIFEST: Record<
235235
dbServicePermission: {
236236
fieldName: 'uid',
237237
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
238-
},
239-
projectPermission:
240-
OpPermissionItemOpPermissionTypeEnum.manage_project_data_source
238+
}
241239
},
242240
[PERMISSIONS.ACTIONS.BASE.DB_SERVICE.EDIT]: {
243241
id: PERMISSIONS.ACTIONS.BASE.DB_SERVICE.EDIT,
@@ -618,7 +616,12 @@ export const PERMISSION_MANIFEST: Record<
618616
[PERMISSIONS.ACTIONS.BASE.DATA_EXPORT.CREATE]: {
619617
id: PERMISSIONS.ACTIONS.BASE.DATA_EXPORT.CREATE,
620618
type: 'action',
621-
projectArchived: false
619+
projectArchived: false,
620+
projectManager: true,
621+
role: [SystemRole.admin, SystemRole.systemAdministrator],
622+
dbServicePermission: {
623+
opType: OpPermissionItemOpPermissionTypeEnum.create_export_task
624+
}
622625
},
623626
[PERMISSIONS.ACTIONS.BASE.DATA_EXPORT.CLOSE]: {
624627
id: PERMISSIONS.ACTIONS.BASE.DATA_EXPORT.CLOSE,
@@ -645,7 +648,12 @@ export const PERMISSION_MANIFEST: Record<
645648
[PERMISSIONS.ACTIONS.SQLE.SQL_EXEC_WORKFLOW.CREATE]: {
646649
id: PERMISSIONS.ACTIONS.SQLE.SQL_EXEC_WORKFLOW.CREATE,
647650
type: 'action',
648-
projectArchived: false
651+
projectArchived: false,
652+
projectManager: true,
653+
role: [SystemRole.admin, SystemRole.systemAdministrator],
654+
dbServicePermission: {
655+
opType: OpPermissionItemOpPermissionTypeEnum.create_workflow
656+
}
649657
},
650658
[PERMISSIONS.ACTIONS.SQLE.SQL_EXEC_WORKFLOW.EXPORT]: {
651659
id: PERMISSIONS.ACTIONS.SQLE.SQL_EXEC_WORKFLOW.EXPORT,
@@ -1161,7 +1169,12 @@ export const PERMISSION_MANIFEST: Record<
11611169
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.CREATE]: {
11621170
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.CREATE,
11631171
type: 'action',
1164-
projectArchived: false
1172+
projectArchived: false,
1173+
projectManager: true,
1174+
role: [SystemRole.admin, SystemRole.systemAdministrator],
1175+
dbServicePermission: {
1176+
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
1177+
}
11651178
},
11661179
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.EDIT]: {
11671180
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.EDIT,
@@ -1262,7 +1275,12 @@ export const PERMISSION_MANIFEST: Record<
12621275
[PERMISSIONS.ACTIONS.SQLE.SQL_AUDIT.CREATE]: {
12631276
id: PERMISSIONS.ACTIONS.SQLE.SQL_AUDIT.CREATE,
12641277
type: 'action',
1265-
projectArchived: false
1278+
projectArchived: false,
1279+
projectManager: true,
1280+
role: [SystemRole.admin, SystemRole.systemAdministrator],
1281+
dbServicePermission: {
1282+
opType: OpPermissionItemOpPermissionTypeEnum.create_workflow
1283+
}
12661284
},
12671285

12681286
// 流水线配置

packages/sqle/src/page/SqlAudit/__snapshots__/index.test.tsx.snap

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,7 @@ exports[`sqle/SqlAudit should match snap shot 1`] = `
1313
</div>
1414
<div
1515
class="extra"
16-
>
17-
<a
18-
href="/sqle/project//sql-audit/create"
19-
>
20-
<button
21-
class="ant-btn ant-btn-primary basic-button-wrapper css-geipcv"
22-
type="button"
23-
>
24-
<span
25-
class="ant-btn-icon"
26-
>
27-
<svg
28-
color="currentColor"
29-
fill="none"
30-
height="10"
31-
viewBox="0 0 10 10"
32-
width="10"
33-
xmlns="http://www.w3.org/2000/svg"
34-
>
35-
<path
36-
d="m5.02.5-.012 9M.5 5h9"
37-
stroke="currentColor"
38-
stroke-linejoin="round"
39-
stroke-width="1.5"
40-
/>
41-
</svg>
42-
</span>
43-
<span>
44-
创建审核
45-
</span>
46-
</button>
47-
</a>
48-
</div>
16+
/>
4917
</div>
5018
<div
5119
class="margin-top-60"

0 commit comments

Comments
 (0)