From 165bf2676f0598a67d905a417f0329562b091378 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 20 Jun 2024 09:56:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=AE=A1=E5=88=92=E5=88=97=E8=A1=A8=E6=9D=83=E9=99=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/controller/TestPlanApiCaseController.java | 5 ++--- .../controller/TestPlanApiScenarioController.java | 4 ++-- .../plan/controller/TestPlanReportController.java | 13 +++++++------ .../controller/TestPlanApiCaseControllerTests.java | 4 ++-- .../TestPlanApiScenarioControllerTests.java | 4 ++-- frontend/src/locale/en-US/common.ts | 1 + .../taskCenter/component/testPlan.vue | 9 ++++++--- .../views/test-plan/report/component/reportList.vue | 4 ++-- frontend/src/views/test-plan/report/locale/en-US.ts | 2 ++ frontend/src/views/test-plan/report/locale/zh-CN.ts | 2 -- 10 files changed, 26 insertions(+), 22 deletions(-) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiCaseController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiCaseController.java index 8eb57fb341..2c8953b687 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiCaseController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiCaseController.java @@ -5,7 +5,6 @@ import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.definition.ApiReportDTO; import io.metersphere.api.dto.definition.ApiReportDetailDTO; import io.metersphere.api.service.definition.ApiReportService; -import io.metersphere.plan.constants.TestPlanResourceConfig; import io.metersphere.plan.dto.request.*; import io.metersphere.plan.dto.response.TestPlanApiCasePageResponse; import io.metersphere.plan.dto.response.TestPlanAssociationResponse; @@ -148,7 +147,7 @@ public class TestPlanApiCaseController { @GetMapping("/report/get/{id}") @Operation(summary = "测试计划-用例列表-执行结果获取") @CheckOwner(resourceId = "#id", resourceType = "api_report") - @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_READ, PermissionConstants.TEST_PLAN_REPORT_READ}, logical = Logical.OR) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) public ApiReportDTO get(@PathVariable String id) { testPlanApiCaseService.checkReportIsTestPlan(id); return apiReportService.get(id); @@ -157,7 +156,7 @@ public class TestPlanApiCaseController { @GetMapping("/report/get/detail/{reportId}/{stepId}") @Operation(summary = "测试计划-用例列表-执行结果获取-报告详情获取") @CheckOwner(resourceId = "#reportId", resourceType = "api_report") - @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_READ, PermissionConstants.TEST_PLAN_REPORT_READ}, logical = Logical.OR) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) public List getDetail(@PathVariable String reportId, @PathVariable String stepId) { testPlanApiCaseService.checkReportIsTestPlan(reportId); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiScenarioController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiScenarioController.java index a606e803b9..02dfee793f 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiScenarioController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanApiScenarioController.java @@ -128,7 +128,7 @@ public class TestPlanApiScenarioController { @GetMapping("/report/get/{id}") @Operation(summary = "测试计划-计划详情-场景用例列表-查看执行结果") @CheckOwner(resourceId = "#id", resourceType = "api_scenario_report") - @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_READ, PermissionConstants.TEST_PLAN_REPORT_READ}, logical = Logical.OR) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) public ApiScenarioReportDTO get(@PathVariable String id) { testPlanApiScenarioService.checkReportIsTestPlan(id); return apiScenarioReportService.get(id); @@ -137,7 +137,7 @@ public class TestPlanApiScenarioController { @GetMapping("report/get/detail/{reportId}/{stepId}") @Operation(summary = "测试计划-计划详情-场景用例列表-执行结果详情获取") @CheckOwner(resourceId = "#reportId", resourceType = "api_scenario_report") - @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_READ, PermissionConstants.TEST_PLAN_REPORT_READ}, logical = Logical.OR) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) public List getDetail(@PathVariable String reportId, @PathVariable String stepId) { testPlanApiScenarioService.checkReportIsTestPlan(reportId); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java index 57b39ddc48..ca38a3abe8 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java @@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -97,7 +98,7 @@ public class TestPlanReportController { @GetMapping("/get/{reportId}") @Operation(summary = "测试计划-报告-详情") - @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report") public TestPlanReportDetailResponse get(@PathVariable String reportId) { return testPlanReportService.getReport(reportId); @@ -121,7 +122,7 @@ public class TestPlanReportController { @PostMapping("/detail/bug/page") @Operation(summary = "测试计划-报告-详情-缺陷分页查询") - @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> pageBug(@Validated @RequestBody TestPlanReportDetailPageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), @@ -131,7 +132,7 @@ public class TestPlanReportController { @PostMapping("/detail/functional/case/page") @Operation(summary = "测试计划-报告-详情-功能用例分页查询") - @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> pageFunctionalCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), @@ -141,7 +142,7 @@ public class TestPlanReportController { @PostMapping("/detail/api/case/page") @Operation(summary = "测试计划-报告-详情-接口用例分页查询") - @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> pageApiCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), @@ -151,7 +152,7 @@ public class TestPlanReportController { @PostMapping("/detail/scenario/case/page") @Operation(summary = "测试计划-报告-详情-场景用例分页查询") - @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> pageScenarioCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), @@ -161,7 +162,7 @@ public class TestPlanReportController { @PostMapping("/detail/plan/report/page") @Operation(summary = "测试计划-报告-集合报告详情") - @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> planReportPage(@Validated @RequestBody TestPlanReportDetailPageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), diff --git a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java index 9f5c9ad7a8..6ad4dc12b3 100644 --- a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java +++ b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java @@ -453,7 +453,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest { // @@校验权限 - requestGetPermissionTest(PermissionConstants.TEST_PLAN_READ, "/report/get/plan-test-report-id"); + requestGetPermissionTest(PermissionConstants.TEST_PLAN_REPORT_READ, "/report/get/plan-test-report-id"); List reportsDetail = new ArrayList<>(); for (int i = 0; i < 2; i++) { @@ -471,7 +471,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest { this.requestGetWithOk("/report/get/detail/plan-test-report-id" + "/" + "plan-test-report-step-id1") .andReturn(); - requestGetPermissionTest(PermissionConstants.TEST_PLAN_READ, "/report/get/detail/plan-test-report-id" + "/" + "plan-test-report-step-id1"); + requestGetPermissionTest(PermissionConstants.TEST_PLAN_REPORT_READ, "/report/get/detail/plan-test-report-id" + "/" + "plan-test-report-step-id1"); } @Test diff --git a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiScenarioControllerTests.java b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiScenarioControllerTests.java index 3bb4bb1587..038f9c55ad 100644 --- a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiScenarioControllerTests.java +++ b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiScenarioControllerTests.java @@ -500,7 +500,7 @@ public class TestPlanApiScenarioControllerTests extends BaseTest { apiScenarioReportMapper.updateByPrimaryKeySelective(scenarioReport1); // @@校验权限 - requestGetPermissionTest(PermissionConstants.TEST_PLAN_READ, "/report/get/plan-test-scenario-report-id"); + requestGetPermissionTest(PermissionConstants.TEST_PLAN_REPORT_READ, "/report/get/plan-test-scenario-report-id"); List reportsDetails = new ArrayList<>(); List reportBlogs = new ArrayList<>(); @@ -527,7 +527,7 @@ public class TestPlanApiScenarioControllerTests extends BaseTest { this.requestGetWithOk("/report/get/detail/plan-test-scenario-report-id/plan-test-scenario-report-step-id1") .andReturn(); - requestGetPermissionTest(PermissionConstants.TEST_PLAN_READ, "/report/get/detail/plan-test-scenario-report-id/plan-test-scenario-report-step-id1"); + requestGetPermissionTest(PermissionConstants.TEST_PLAN_REPORT_READ, "/report/get/detail/plan-test-scenario-report-id/plan-test-scenario-report-step-id1"); } } diff --git a/frontend/src/locale/en-US/common.ts b/frontend/src/locale/en-US/common.ts index d2f7bea356..5b58e0e4b2 100644 --- a/frontend/src/locale/en-US/common.ts +++ b/frontend/src/locale/en-US/common.ts @@ -190,4 +190,5 @@ export default { 'common.name': 'name', 'common.stopped': 'Stopped', 'common.config': 'Config', + 'common.executionResult': 'Execution result', }; diff --git a/frontend/src/views/project-management/taskCenter/component/testPlan.vue b/frontend/src/views/project-management/taskCenter/component/testPlan.vue index 9b2454b3fd..0465db19e5 100644 --- a/frontend/src/views/project-management/taskCenter/component/testPlan.vue +++ b/frontend/src/views/project-management/taskCenter/component/testPlan.vue @@ -159,17 +159,17 @@ organization: { stop: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_TEST_PLAN:READ+EXECUTE'], jump: ['PROJECT_TEST_PLAN:READ'], - report: ['PROJECT_TEST_PLAN:READ', 'PROJECT_TEST_PLAN_REPORT:READ'], + report: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN_REPORT:READ'], }, system: { stop: ['SYSTEM_TASK_CENTER:READ+STOP', 'PROJECT_TEST_PLAN:READ+EXECUTE'], jump: ['PROJECT_TEST_PLAN:READ'], - report: ['PROJECT_TEST_PLAN:READ', 'PROJECT_TEST_PLAN_REPORT:READ'], + report: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN_REPORT:READ'], }, project: { stop: ['PROJECT_TEST_PLAN:READ+EXECUTE'], jump: ['PROJECT_TEST_PLAN:READ'], - report: ['PROJECT_TEST_PLAN:READ', 'PROJECT_TEST_PLAN_REPORT:READ'], + report: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN_REPORT:READ'], }, }; @@ -428,6 +428,9 @@ } function showDetail(id: string) { + if (!hasJumpPermission.value) { + return; + } openNewPage(RouteEnum.TEST_PLAN_INDEX_DETAIL, { id, }); diff --git a/frontend/src/views/test-plan/report/component/reportList.vue b/frontend/src/views/test-plan/report/component/reportList.vue index 053c126ef1..79b19e720f 100644 --- a/frontend/src/views/test-plan/report/component/reportList.vue +++ b/frontend/src/views/test-plan/report/component/reportList.vue @@ -45,8 +45,8 @@ {{ record.integrated - ? t('report.detail.testPlanGroup.testGroupReport') - : t('report.detail.testPlanGroup.testReport') + ? t('report.detail.testPlanGroupReport') + : t('report.detail.testReport') }} diff --git a/frontend/src/views/test-plan/report/locale/en-US.ts b/frontend/src/views/test-plan/report/locale/en-US.ts index 62afc53d4e..404f3ad254 100644 --- a/frontend/src/views/test-plan/report/locale/en-US.ts +++ b/frontend/src/views/test-plan/report/locale/en-US.ts @@ -45,4 +45,6 @@ export default { 'report.detail.testPlanGroup.result': 'Result', 'report.detail.testPlanGroup.useCasesCount': 'Use cases', 'report.detail.testPlanGroup.viewReport': 'View Report', + 'report.detail.testReport': 'Test report', + 'report.detail.testPlanGroupReport': 'Test group report', }; diff --git a/frontend/src/views/test-plan/report/locale/zh-CN.ts b/frontend/src/views/test-plan/report/locale/zh-CN.ts index 5a67d17452..573bf61903 100644 --- a/frontend/src/views/test-plan/report/locale/zh-CN.ts +++ b/frontend/src/views/test-plan/report/locale/zh-CN.ts @@ -47,6 +47,4 @@ export default { 'report.detail.testPlanGroup.result': '结果', 'report.detail.testPlanGroup.useCasesCount': '用例数', 'report.detail.testPlanGroup.viewReport': '查看报告', - 'report.detail.testPlanGroup.testGroupReport': '测试组报告', - 'report.detail.testPlanGroup.testReport': '测试报告', };