From 94a198831a0181b427843294f30377f92e1fab30 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Mon, 13 Mar 2023 17:09:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=84=91=E5=9B=BE=E6=93=8D=E4=BD=9C=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019436 --user=宋昌昌 【测试跟踪】github#19495用户角色没有分配删除测试用例的权限,在列表模式用户没有删除按钮,但是在脑图模式下,该用户还是可以删除测试用例 https://www.tapd.cn/55049933/s/1348930 --- framework/sdk-parent/frontend/src/i18n/lang/en-US.js | 1 + framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js | 1 + framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js | 1 + .../commons/constants/PermissionConstants.java | 1 + .../migration/2.8.0/ddl/V9__add_test_plan_index.sql | 7 +++++++ .../2.8.0/dml/V9_1__init_minder_permission.sql | 12 ++++++++++++ .../backend/src/main/resources/permission.json | 5 +++++ test-track/frontend/src/business/case/TestCase.vue | 2 +- .../src/business/common/minder/TestCaseMinder.vue | 2 +- 9 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test-track/backend/src/main/resources/db/migration/2.8.0/ddl/V9__add_test_plan_index.sql create mode 100644 test-track/backend/src/main/resources/db/migration/2.8.0/dml/V9_1__init_minder_permission.sql diff --git a/framework/sdk-parent/frontend/src/i18n/lang/en-US.js b/framework/sdk-parent/frontend/src/i18n/lang/en-US.js index 233af385fb..fc68f351af 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/en-US.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/en-US.js @@ -2896,6 +2896,7 @@ const message = { import: "IMPORT", export: "EXPORT", recover: "RECOVER", + minder_operate: "OPERATE MINDER", }, project_track_review: { name: "Review", diff --git a/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js b/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js index 6f90186ce0..43a1a08a30 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js @@ -2796,6 +2796,7 @@ const message = { import: "导入用例", export: "导出用例", recover: "恢复用例", + minder_operate: "操作脑图", }, project_track_review: { name: "测试评审", diff --git a/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js b/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js index 66536976ce..f7fb812031 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js @@ -2793,6 +2793,7 @@ const message = { import: "導入用例", export: "導出用例", recover: "恢復用例", + minder_operate: "操作腦圖", }, project_track_review: { name: "測試評審", diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java index 8e693fe7e5..f4099b90de 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/PermissionConstants.java @@ -93,6 +93,7 @@ public class PermissionConstants { public static final String PROJECT_TRACK_CASE_READ_CREATE = "PROJECT_TRACK_CASE:READ+CREATE"; public static final String PROJECT_TRACK_CASE_READ_EDIT = "PROJECT_TRACK_CASE:READ+EDIT"; public static final String PROJECT_TRACK_CASE_READ_DELETE = "PROJECT_TRACK_CASE:READ+DELETE"; + public static final String PROJECT_TRACK_CASE_MINDER_OPERATE = "PROJECT_TRACK_CASE_MINDER:OPERATE"; public static final String PROJECT_TRACK_CASE_READ_COPY = "PROJECT_TRACK_CASE:READ+COPY"; public static final String PROJECT_TRACK_CASE_READ_IMPORT = "PROJECT_TRACK_CASE:READ+IMPORT"; public static final String PROJECT_TRACK_CASE_READ_EXPORT = "PROJECT_TRACK_CASE:READ+EXPORT"; diff --git a/test-track/backend/src/main/resources/db/migration/2.8.0/ddl/V9__add_test_plan_index.sql b/test-track/backend/src/main/resources/db/migration/2.8.0/ddl/V9__add_test_plan_index.sql new file mode 100644 index 0000000000..9aff3a4714 --- /dev/null +++ b/test-track/backend/src/main/resources/db/migration/2.8.0/ddl/V9__add_test_plan_index.sql @@ -0,0 +1,7 @@ +SET SESSION innodb_lock_wait_timeout = 7200; + +-- 测试计划相关的索引 +CREATE INDEX api_case_id_IDX ON test_plan_api_case (api_case_id); +CREATE INDEX test_id_IDX ON test_case_test (test_id); + +SET SESSION innodb_lock_wait_timeout = DEFAULT; \ No newline at end of file diff --git a/test-track/backend/src/main/resources/db/migration/2.8.0/dml/V9_1__init_minder_permission.sql b/test-track/backend/src/main/resources/db/migration/2.8.0/dml/V9_1__init_minder_permission.sql new file mode 100644 index 0000000000..08d60b16ba --- /dev/null +++ b/test-track/backend/src/main/resources/db/migration/2.8.0/dml/V9_1__init_minder_permission.sql @@ -0,0 +1,12 @@ +SET SESSION innodb_lock_wait_timeout = 7200; + +-- 同时存在用例编辑和用例删除的用户组赋予脑图操作的权限 +INSERT INTO user_group_permission +SELECT UUID(), group_id, 'PROJECT_TRACK_CASE_MINDER:OPERATE', 'PROJECT_TRACK_CASE' FROM( + SELECT group_id, count(permission_id) as permissionCount FROM user_group_permission + WHERE permission_id in ('PROJECT_TRACK_CASE:READ+EDIT', 'PROJECT_TRACK_CASE:READ+DELETE') + GROUP BY group_id + HAVING permissionCount = 2 +) group_tmp; + +SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/test-track/backend/src/main/resources/permission.json b/test-track/backend/src/main/resources/permission.json index 036168f987..d5127a9c08 100644 --- a/test-track/backend/src/main/resources/permission.json +++ b/test-track/backend/src/main/resources/permission.json @@ -25,6 +25,11 @@ "name": "permission.project_track_case.delete", "resourceId": "PROJECT_TRACK_CASE" }, + { + "id": "PROJECT_TRACK_CASE_MINDER:OPERATE", + "name": "permission.project_track_case.minder_operate", + "resourceId": "PROJECT_TRACK_CASE" + }, { "id": "PROJECT_TRACK_CASE:READ+COPY", "name": "permission.project_track_case.copy", diff --git a/test-track/frontend/src/business/case/TestCase.vue b/test-track/frontend/src/business/case/TestCase.vue index 581f556997..0dc3bdfdec 100644 --- a/test-track/frontend/src/business/case/TestCase.vue +++ b/test-track/frontend/src/business/case/TestCase.vue @@ -393,7 +393,7 @@ export default { }); }, updateActiveDom(activeDom) { - openMinderConfirm(this, activeDom, 'PROJECT_TRACK_CASE:READ+EDIT'); + openMinderConfirm(this, activeDom, 'PROJECT_TRACK_CASE:READ'); }, importChangeConfirm(isSave) { store.isTestCaseMinderChanged = false; diff --git a/test-track/frontend/src/business/common/minder/TestCaseMinder.vue b/test-track/frontend/src/business/common/minder/TestCaseMinder.vue index 7828f4e9df..f01f6661aa 100644 --- a/test-track/frontend/src/business/common/minder/TestCaseMinder.vue +++ b/test-track/frontend/src/business/common/minder/TestCaseMinder.vue @@ -131,7 +131,7 @@ export default { testCaseDefaultValue: 'testCaseDefaultValue', }), disabled() { - return !hasPermission('PROJECT_TRACK_CASE:READ+EDIT'); + return !hasPermission('PROJECT_TRACK_CASE_MINDER:OPERATE'); }, moveEnable() { // 如果不是默认的排序条件不能调换位置