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 9e4259fa2b..00259a3d07 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 @@ -242,6 +242,11 @@ public class TestCaseController { return testCaseService.testCaseImport(file, request, httpRequest); } + @GetMapping("/check/permission/{projectId}") + public boolean checkProjectPermission(@PathVariable String projectId) { + return baseCheckPermissionService.getUserRelatedProjectIds().contains(projectId); + } + @GetMapping("/export/template/{projectId}/{importType}") @RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ_EXPORT) public void testCaseTemplateExport(@PathVariable String projectId, @PathVariable String importType, HttpServletResponse response) { diff --git a/test-track/frontend/src/api/testCase.js b/test-track/frontend/src/api/testCase.js index 297b9a1b03..57cc67377e 100644 --- a/test-track/frontend/src/api/testCase.js +++ b/test-track/frontend/src/api/testCase.js @@ -1,6 +1,4 @@ import {post, get} from "metersphere-frontend/src/plugins/request"; -import {$success} from "metersphere-frontend/src/plugins/message"; -import i18n from "@/i18n"; import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token"; import {buildPagePath} from "@/api/base-network"; @@ -246,3 +244,7 @@ export function saveCaseRelevanceScenario(caseId, param) { export function saveCaseRelevanceLoad(caseId, param) { return post(BASE_URL + "relate/test/performance/" + caseId, param); } + +export function checkProjectPermission(projectId) { + return get(BASE_URL + "check/permission/" + projectId); +} diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue index dbb4aa8f82..6820650f9f 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseEdit.vue @@ -43,7 +43,11 @@ - + @@ -166,6 +171,8 @@ import StatusTableItem from "@/business/common/tableItems/planview/StatusTableIt import {testPlanTestCaseEdit, testPlanTestCaseGet} from "@/api/remote/plan/test-plan-test-case"; import {testPlanEditStatus} from "@/api/remote/plan/test-plan"; import {getTestTemplate} from "@/api/custom-field-template"; +import {getCurrentProjectID} from "@/business/utils/sdk-utils"; +import {checkProjectPermission} from "@/api/testCase"; export default { name: "FunctionalTestCaseEdit", @@ -190,6 +197,7 @@ export default { return { loading: false, showDialog: false, + hasProjectPermission: true, testCase: {}, index: 0, editor: ClassicEditor, @@ -235,7 +243,7 @@ export default { }, pageTotal() { return Math.ceil(this.total / this.pageSize); - } + }, }, methods: { handleClose() { @@ -431,6 +439,10 @@ export default { }); }, openTestCaseEdit(testCase, tableData) { + checkProjectPermission(testCase.projectId) + .then(r => { + this.hasProjectPermission = r.data; + }); this.showDialog = true; this.activeTab = 'detail'; this.hasTapdId = false;