diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java index 04a3588017..3446b7f583 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java @@ -253,7 +253,6 @@ public class PermissionConstants { public static final String PROJECT_API_DEFINITION_ADD = "PROJECT_API_DEFINITION:READ+ADD"; public static final String PROJECT_API_DEFINITION_UPDATE = "PROJECT_API_DEFINITION:READ+UPDATE"; public static final String PROJECT_API_DEFINITION_DELETE = "PROJECT_API_DEFINITION:READ+DELETE"; - public static final String PROJECT_API_DEFINITION_RECOVER = "PROJECT_API_DEFINITION:READ+RECOVER"; public static final String PROJECT_API_DEFINITION_IMPORT = "PROJECT_API_DEFINITION:READ+IMPORT"; public static final String PROJECT_API_DEFINITION_EXPORT = "PROJECT_API_DEFINITION:READ+EXPORT"; public static final String PROJECT_API_DEFINITION_EXECUTE = "PROJECT_API_DEFINITION:READ+EXECUTE"; @@ -261,7 +260,6 @@ public class PermissionConstants { public static final String PROJECT_API_DEFINITION_CASE_ADD = "PROJECT_API_DEFINITION_CASE:READ+ADD"; public static final String PROJECT_API_DEFINITION_CASE_UPDATE = "PROJECT_API_DEFINITION_CASE:READ+UPDATE"; public static final String PROJECT_API_DEFINITION_CASE_DELETE = "PROJECT_API_DEFINITION_CASE:READ+DELETE"; - public static final String PROJECT_API_DEFINITION_CASE_RECOVER = "PROJECT_API_DEFINITION_CASE:READ+RECOVER"; public static final String PROJECT_API_DEFINITION_CASE_EXECUTE = "PROJECT_API_DEFINITION_CASE:READ+EXECUTE"; public static final String PROJECT_API_DEFINITION_MOCK_READ = "PROJECT_API_DEFINITION_MOCK:READ"; @@ -277,7 +275,6 @@ public class PermissionConstants { public static final String PROJECT_API_SCENARIO_ADD = "PROJECT_API_SCENARIO:READ+ADD"; public static final String PROJECT_API_SCENARIO_UPDATE = "PROJECT_API_SCENARIO:READ+UPDATE"; public static final String PROJECT_API_SCENARIO_DELETE = "PROJECT_API_SCENARIO:READ+DELETE"; - public static final String PROJECT_API_SCENARIO_RECOVER = "PROJECT_API_SCENARIO:READ+RECOVER"; public static final String PROJECT_API_SCENARIO_EXECUTE = "PROJECT_API_SCENARIO:READ+EXECUTE"; public static final String PROJECT_API_SCENARIO_IMPORT = "PROJECT_API_SCENARIO:READ+IMPORT"; public static final String PROJECT_API_SCENARIO_EXPORT = "PROJECT_API_SCENARIO:READ+EXPORT"; diff --git a/backend/framework/sdk/src/main/resources/i18n/commons.properties b/backend/framework/sdk/src/main/resources/i18n/commons.properties index eafbb9d885..2267888471 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons.properties @@ -454,6 +454,7 @@ permission.recover=恢复 permission.export=导出 permission.execute=执行 permission.debug=调试 +permission.api_definition.delete_and_recover=删除/恢复 file_name_illegal_error=文件名不合法 plugin_enable_error=插件未启用 diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties index c974cdbb57..77e7aff155 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties @@ -557,4 +557,6 @@ relate_source_type_not_blank=The associated resource type cannot be empty api_import_schedule=API import schedule project.description.length_range=The description must be between {min} and {max} characters -api_test_environment_datasource_connect_failed=Data source connection failed \ No newline at end of file +api_test_environment_datasource_connect_failed=Data source connection failed + +permission.api_definition.delete_and_recover=Delete/Recover \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties index ac87b1af6f..ca08383c4e 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties @@ -554,4 +554,6 @@ relate_source_type_not_blank=关联资源类型不能为空 api_import_schedule=接口定义-定时导入任务 project.description.length_range=项目描述长度必须在{min}和{max}之间 -api_test_environment_datasource_connect_failed=数据源连接失败 \ No newline at end of file +api_test_environment_datasource_connect_failed=数据源连接失败 + +permission.api_definition.delete_and_recover=删除/恢复 \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties index f233bbbf38..c7436406e0 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties @@ -554,4 +554,6 @@ relate_source_type_not_blank=關聯資源類型不能為空 api_import_schedule=接口導入定時任務 -project.description.length_range=項目描述長度必須在{min}和{max}之間 \ No newline at end of file +project.description.length_range=項目描述長度必須在{min}和{max}之間 + +permission.api_definition.delete_and_recover=刪除/恢復 \ No newline at end of file diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java index fcc2a35698..c5c65d70b5 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java @@ -171,7 +171,7 @@ public class ApiDefinitionController { @PostMapping(value = "/recover") @Operation(summary = "接口测试-接口管理-恢复回收站接口定义") - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_RECOVER) + @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DELETE) @Log(type = OperationLogType.RECOVER, expression = "#msClass.recoverLog(#request)", msClass = ApiDefinitionLogService.class) @CheckOwner(resourceId = "#request.getId()", resourceType = "api_definition") public void recover(@Validated @RequestBody ApiDefinitionDeleteRequest request) { @@ -180,7 +180,7 @@ public class ApiDefinitionController { @PostMapping(value = "/batch-recover") @Operation(summary = "接口测试-接口管理-批量从回收站恢复接口定义") - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_RECOVER) + @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DELETE) @CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "api_definition") public void batchRecover(@Validated @RequestBody ApiDefinitionBatchRequest request) { apiDefinitionService.batchRecover(request, SessionUtils.getUserId()); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiTestCaseController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiTestCaseController.java index 34ff398b65..509f9b9339 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiTestCaseController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiTestCaseController.java @@ -77,7 +77,7 @@ public class ApiTestCaseController { @GetMapping("recover/{id}") @Operation(summary = "接口测试-接口管理-接口用例-恢复") - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_CASE_RECOVER) + @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_CASE_DELETE) @Log(type = OperationLogType.RECOVER, expression = "#msClass.recoverLog(#id)", msClass = ApiTestCaseLogService.class) @CheckOwner(resourceId = "#id", resourceType = "api_test_case") public void recover(@PathVariable String id) { @@ -179,7 +179,7 @@ public class ApiTestCaseController { @PostMapping("/batch/recover") @Operation(summary = "接口测试-接口管理-接口用例-批量恢复") - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_CASE_RECOVER) + @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_CASE_DELETE) @CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "api_test_case") public void batchRecover(@Validated @RequestBody ApiTestCaseBatchRequest request) { apiTestCaseRecoverService.batchRecover(request, SessionUtils.getUserId()); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioBatchOperationController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioBatchOperationController.java index e372c401e8..a220ae22ce 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioBatchOperationController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioBatchOperationController.java @@ -57,7 +57,7 @@ public class ApiScenarioBatchOperationController { //需求补充:回收站里的相关操作都不需要发通知 @PostMapping("/batch-operation/recover-gc") @Operation(summary = "接口测试-接口场景批量操作-回收站列表-批量恢复") - @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_RECOVER) + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_DELETE) @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") public ApiScenarioBatchOperationResponse recoverFromGc(@Validated @RequestBody ApiScenarioBatchRequest request) { apiValidateService.validateApiMenuInProject(request.getProjectId(), ApiResource.PROJECT.name()); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java index 4cd4d8fca6..416dd2711a 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java @@ -143,7 +143,7 @@ public class ApiScenarioController { //需求补充:回收站里的相关操作都不需要发通知 @GetMapping("/recover/{id}") @Operation(summary = "接口测试-接口场景管理-删除场景到回收站") - @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_RECOVER) + @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_DELETE) @Log(type = OperationLogType.RESTORE, expression = "#msClass.restoreLog(#id)", msClass = ApiScenarioLogService.class) @CheckOwner(resourceId = "#id", resourceType = "api_scenario") public void recover(@PathVariable String id) { diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java index 781528a3f5..bc570d0ddb 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java @@ -96,6 +96,7 @@ public class ApiScenarioReportService { BeanUtils.copyBean(scenarioReportListDTO, scenarioReport); scenarioReportListDTO.setCreateUserName(userMap.get(scenarioReport.getCreateUser())); scenarioReportListDTO.setUpdateUserName(userMap.get(scenarioReport.getUpdateUser())); + result.add(scenarioReportListDTO); }); return result; } diff --git a/backend/services/api-test/src/main/resources/permission.json b/backend/services/api-test/src/main/resources/permission.json index b0de26c617..75e8be1c3e 100644 --- a/backend/services/api-test/src/main/resources/permission.json +++ b/backend/services/api-test/src/main/resources/permission.json @@ -42,7 +42,8 @@ "id": "PROJECT_API_DEFINITION:READ+UPDATE" }, { - "id": "PROJECT_API_DEFINITION:READ+DELETE" + "id": "PROJECT_API_DEFINITION:READ+DELETE", + "name": "permission.api_definition.delete_and_recover" }, { "id": "PROJECT_API_DEFINITION:READ+IMPORT" @@ -69,7 +70,8 @@ "id": "PROJECT_API_DEFINITION_CASE:READ+UPDATE" }, { - "id": "PROJECT_API_DEFINITION_CASE:READ+DELETE" + "id": "PROJECT_API_DEFINITION_CASE:READ+DELETE", + "name": "permission.api_definition.delete_and_recover" }, { "id": "PROJECT_API_DEFINITION_CASE:READ+EXECUTE" @@ -90,7 +92,8 @@ "id": "PROJECT_API_DEFINITION_MOCK:READ+UPDATE" }, { - "id": "PROJECT_API_DEFINITION_MOCK:READ+DELETE" + "id": "PROJECT_API_DEFINITION_MOCK:READ+DELETE", + "name": "permission.api_definition.delete_and_recover" }, { "id": "PROJECT_API_DEFINITION_MOCK:READ+EXECUTE" @@ -124,7 +127,8 @@ "id": "PROJECT_API_SCENARIO:READ+UPDATE" }, { - "id": "PROJECT_API_SCENARIO:READ+DELETE" + "id": "PROJECT_API_SCENARIO:READ+DELETE", + "name": "permission.api_definition.delete_and_recover" }, { "id": "PROJECT_API_SCENARIO:READ+EXECUTE" diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java index 50a1340c78..91ff4e51d0 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java @@ -1343,7 +1343,7 @@ public class ApiDefinitionControllerTests extends BaseTest { // @@校验权限 apiDefinitionDeleteRequest.setId(apiDefinition.getId()); - requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_RECOVER, RESTORE, apiDefinitionDeleteRequest); + requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_DELETE, RESTORE, apiDefinitionDeleteRequest); } @Test @@ -1391,7 +1391,7 @@ public class ApiDefinitionControllerTests extends BaseTest { checkLogModelList.add(new CheckLogModel(id, OperationLogType.RECOVER, BATCH_RESTORE)); } // @@校验权限 - requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_RECOVER, BATCH_RESTORE, request); + requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_DELETE, BATCH_RESTORE, request); } @Test diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java index 932dbe9843..861fe076fc 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java @@ -2053,7 +2053,7 @@ public class ApiScenarioControllerTests extends BaseTest { Assertions.assertEquals(resultResponse.getSuccess(), 0); //校验权限 - this.requestPostPermissionTest(PermissionConstants.PROJECT_API_SCENARIO_RECOVER, testUrl, request); + this.requestPostPermissionTest(PermissionConstants.PROJECT_API_SCENARIO_DELETE, testUrl, request); //反例测试 ->参数校验:项目ID为空 request = new ApiScenarioBatchCopyMoveRequest(); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java index 8fb512e05a..9b377a9a5d 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java @@ -500,7 +500,7 @@ public class ApiTestCaseControllerTests extends BaseTest { this.requestGet(RECOVER + "111").andExpect(ERROR_REQUEST_MATCHER); // @@校验权限 - requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_RECOVER, RECOVER + apiTestCase.getId()); + requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_DELETE, RECOVER + apiTestCase.getId()); } //关注 @@ -1050,7 +1050,7 @@ public class ApiTestCaseControllerTests extends BaseTest { //校验日志 checkLog(apiTestCase.getId(), OperationLogType.DELETE); //校验权限 - requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_RECOVER, BATCH_RECOVER, request); + requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_DELETE, BATCH_RECOVER, request); ApiTestCaseBatchRequest gcRequest = new ApiTestCaseBatchRequest(); gcRequest.setProjectId(DEFAULT_PROJECT_ID); gcRequest.setSelectAll(true); diff --git a/backend/services/bug-management/src/main/resources/permission.json b/backend/services/bug-management/src/main/resources/permission.json index ac5dabdb54..94280cc51f 100644 --- a/backend/services/bug-management/src/main/resources/permission.json +++ b/backend/services/bug-management/src/main/resources/permission.json @@ -18,7 +18,8 @@ "id": "PROJECT_BUG:READ+UPDATE" }, { - "id": "PROJECT_BUG:READ+DELETE" + "id": "PROJECT_BUG:READ+DELETE", + "name": "permission.api_definition.delete_and_recover" }, { "id": "PROJECT_BUG:READ+EXPORT" diff --git a/backend/services/case-management/src/main/resources/permission.json b/backend/services/case-management/src/main/resources/permission.json index 0f39cfa8f0..60d4d30e2e 100644 --- a/backend/services/case-management/src/main/resources/permission.json +++ b/backend/services/case-management/src/main/resources/permission.json @@ -18,7 +18,8 @@ "id": "FUNCTIONAL_CASE:READ+UPDATE" }, { - "id": "FUNCTIONAL_CASE:READ+DELETE" + "id": "FUNCTIONAL_CASE:READ+DELETE", + "name": "permission.api_definition.delete_and_recover" }, { "id": "FUNCTIONAL_CASE:READ+COMMENT",