From 88fe1b6f5fa3ae855d0f3d581035e23f0af93e3d Mon Sep 17 00:00:00 2001 From: jianxing Date: Tue, 27 Jun 2023 17:37:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E7=BC=96=E8=BE=91=E9=A1=B5=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1027392 --user=陈建星 【测试跟踪】只读用户-功能用例开启查看权限-用例详情页-点击版本无反应 https://www.tapd.cn/55049933/s/1387112 --bug=1027389 --user=陈建星 【测试跟踪】项目成员未开启创建用例权限-功能用例页面-点击版本下拉-新建成功 https://www.tapd.cn/55049933/s/1387002 --- .../controller/TestCaseController.java | 3 ++- .../business/case/components/TestCaseEdit.vue | 14 ++++++++++++-- .../components/common/CaseVersionHistory.vue | 16 +++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java index 535b63c41b..f6349c8e74 100644 --- a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java +++ b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java @@ -26,6 +26,7 @@ import io.metersphere.service.TestCaseService; import io.metersphere.service.wapper.CheckPermissionService; import io.metersphere.xpack.track.dto.EditTestCaseRequest; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -245,7 +246,7 @@ public class TestCaseController { @MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class) @SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.getTestCase(#request.id)", targetClass = TestCaseService.class, event = NoticeConstants.Event.UPDATE, subject = "测试用例通知") - @RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ_EDIT) + @RequiresPermissions(value = {PermissionConstants.PROJECT_TRACK_CASE_READ_EDIT, PermissionConstants.PROJECT_TRACK_CASE_READ_CREATE}, logical = Logical.OR) public TestCase editTestCase(@RequestPart("request") EditTestCaseRequest request) { return testCaseService.edit(request); } diff --git a/test-track/frontend/src/business/case/components/TestCaseEdit.vue b/test-track/frontend/src/business/case/components/TestCaseEdit.vue index 289f8af06e..f5350bc32b 100644 --- a/test-track/frontend/src/business/case/components/TestCaseEdit.vue +++ b/test-track/frontend/src/business/case/components/TestCaseEdit.vue @@ -29,8 +29,8 @@ v-show="versionEnable" ref="versionHistory" :current-id="currentTestCaseInfo.id" - :is-read="readOnly" - :is-public-show="isPublicShow || hasReadonlyPermission" + :is-read="versionReadOnly" + :is-public-show="isPublicShow" :current-version-id="form.versionId" @confirmOtherInfo="confirmOtherInfo" :current-project-id="projectId" @@ -632,6 +632,16 @@ export default { !hasPermission("PROJECT_TRACK_CASE:READ+EDIT") ); }, + versionReadOnly() { + if (this.isPublicShow || this.hasReadonlyPermission) { + return true; + } + const { rowClickHasPermission } = this.currentTestCaseInfo; + if (rowClickHasPermission !== undefined) { + return !rowClickHasPermission; + } + return hasPermission('PROJECT_TRACK_CASE:READ'); + }, caseId() { return !this.isPublicShow ? this.$route.params.caseId : this.publicCaseId; }, diff --git a/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue b/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue index d4cc9c04f9..fd894b1a48 100644 --- a/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue +++ b/test-track/frontend/src/business/case/components/common/CaseVersionHistory.vue @@ -54,7 +54,7 @@
{{ $t("commons.create") }} @@ -64,7 +64,7 @@ @click.stop="del(item)" v-if="caseVersionMap.has(item.id) && !(item.id === currentVersionId) - && !isRead" + && hasDeletePermission" > {{ $t("commons.delete") }}
@@ -157,7 +157,7 @@