diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql index fa8d62f00a..5be1af238e 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql @@ -145,6 +145,8 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_REPORT:READ'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_REPORT:READ+UPDATE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_REPORT:READ+DELETE'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_DOC:READ'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_DOC:READ+SHARE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+ADD'); @@ -259,6 +261,8 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_TEST_PLAN:READ+DELETE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_TEST_PLAN:READ+EXECUTE'); INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_TEST_PLAN:READ+ASSOCIATION'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_DOC:READ'); +INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_DOC:READ+SHARE'); -- 初始化当前站点配置 INSERT into system_parameter values('base.url', 'http://127.0.0.1:8081', 'text'); -- 初始化prometheus站点配置 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 2cd5787a53..7860105564 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 @@ -129,8 +129,6 @@ public class PermissionConstants { public static final String PROJECT_USER_READ_ADD = "PROJECT_USER:READ+ADD"; public static final String PROJECT_USER_READ_DELETE = "PROJECT_USER:READ+DELETE"; - public static final String PROJECT_API_DEFINITION_READ_ADD_API = "PROJECT_API_DEFINITION:READ+ADD_API"; - public static final String PROJECT_API_REPORT_READ_DELETE = "PROJECT_API_REPORT:READ+DELETE"; /*------ start: PROJECT_MESSAGE ------*/ public static final String PROJECT_MESSAGE_READ = "PROJECT_MESSAGE:READ"; @@ -277,6 +275,9 @@ public class PermissionConstants { public static final String PROJECT_API_DEFINITION_MOCK_UPDATE = "PROJECT_API_DEFINITION_MOCK:READ+UPDATE"; public static final String PROJECT_API_DEFINITION_MOCK_DELETE = "PROJECT_API_DEFINITION_MOCK:READ+DELETE"; public static final String PROJECT_API_DEFINITION_MOCK_EXECUTE = "PROJECT_API_DEFINITION_MOCK:READ+EXECUTE"; + + public static final String PROJECT_API_DEFINITION_DOC_READ = "PROJECT_API_DEFINITION_DOC:READ"; + public static final String PROJECT_API_DEFINITION_DOC_SHARE = "PROJECT_API_DEFINITION_DOC:READ+SHARE"; /* ----API_SCENARIO---- */ public static final String PROJECT_API_SCENARIO_READ = "PROJECT_API_SCENARIO:READ"; public static final String PROJECT_API_SCENARIO_ADD = "PROJECT_API_SCENARIO:READ+ADD"; diff --git a/backend/framework/sdk/src/main/resources/i18n/commons.properties b/backend/framework/sdk/src/main/resources/i18n/commons.properties index 27c9ab20fd..96a8e24f2c 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons.properties @@ -487,6 +487,8 @@ permission.api_debug.name=接口调试 permission.api_definition.name=接口管理 permission.api_case.name=接口用例 permission.api_mock.name=接口Mock +permission.api_doc.name=接口文档 +permission.api_doc.share=分享 permission.api_definition.import=导入 permission.api_definition.export=导出 permission.api_definition.execute=执行 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 af6e32955b..cb5d7edb0a 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 @@ -496,6 +496,8 @@ permission.api_debug.name=API Debug permission.api_definition.name=API Management permission.api_case.name=API Case permission.api_mock.name=API Mock +permission.api_doc.name=API Document +permission.api_doc.share=API Document Share permission.api_definition.import=Import permission.api_definition.export=Export permission.api_definition.execute=Execute 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 340a3272f7..0567ad2308 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 @@ -493,6 +493,8 @@ permission.api_debug.name=接口调试 permission.api_definition.name=接口管理 permission.api_case.name=接口用例 permission.api_mock.name=接口Mock +permission.api_doc.name=接口文档 +permission.api_doc.share=分享 permission.api_definition.import=导入 permission.api_definition.export=导出 permission.api_definition.execute=执行 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 c03df94d1d..38958de7af 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 @@ -493,6 +493,8 @@ permission.api_debug.name=接口調試 permission.api_definition.name=接口管理 permission.api_case.name=接口用例 permission.api_mock.name=接口Mock +permission.api_doc.name=接口文档 +permission.api_doc.share=分享 permission.api_definition.import=導入 permission.api_definition.export=導出 permission.api_definition.execute=執行 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 bf4507bf18..e0b00d869d 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 @@ -180,7 +180,7 @@ public class ApiDefinitionController { @PostMapping("/page-doc") @Operation(summary = "接口测试-接口管理-接口文档列表") - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ) + @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_READ) @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") public Pager> getDocPage(@Validated @RequestBody ApiDefinitionPageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), @@ -197,7 +197,7 @@ public class ApiDefinitionController { @PostMapping("/doc") @Operation(summary = "接口测试-接口管理-接口文档列表") - @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ) + @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE) @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") public ApiDefinitionDocDTO getDocInfo(@Validated @RequestBody ApiDefinitionDocRequest request) { return apiDefinitionService.getDocInfo(request); diff --git a/backend/services/api-test/src/main/resources/permission.json b/backend/services/api-test/src/main/resources/permission.json index b487cc99fd..b0de26c617 100644 --- a/backend/services/api-test/src/main/resources/permission.json +++ b/backend/services/api-test/src/main/resources/permission.json @@ -97,6 +97,19 @@ } ] }, + { + "id": "PROJECT_API_DEFINITION_DOC", + "name": "permission.api_doc.name", + "permissions": [ + { + "id": "PROJECT_API_DEFINITION_DOC:READ" + }, + { + "id": "PROJECT_API_DEFINITION_DOC:READ+SHARE", + "name": "permission.api_doc.share" + } + ] + }, { "id": "PROJECT_API_SCENARIO", "name": "message.api_scenario_task", 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 ee9f56a809..163db7d1ba 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 @@ -990,7 +990,7 @@ public class ApiDefinitionControllerTests extends BaseTest { Assertions.assertEquals(allApiDefinitionDocDTO.getDocInfo().getId(), copyAllApiDefinitionDocDTO.getDocInfo().getId()); // @@校验权限 - requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_READ, DOC, request); + requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE, DOC, request); } @Test