refactor(接口测试): 补充接口文档权限
This commit is contained in:
parent
d2564b2ba9
commit
d91463df40
|
@ -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');
|
||||||
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+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_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');
|
||||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+ADD');
|
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+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+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_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');
|
INSERT into system_parameter values('base.url', 'http://127.0.0.1:8081', 'text');
|
||||||
-- 初始化prometheus站点配置
|
-- 初始化prometheus站点配置
|
||||||
|
|
|
@ -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_ADD = "PROJECT_USER:READ+ADD";
|
||||||
public static final String PROJECT_USER_READ_DELETE = "PROJECT_USER:READ+DELETE";
|
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 ------*/
|
/*------ start: PROJECT_MESSAGE ------*/
|
||||||
public static final String PROJECT_MESSAGE_READ = "PROJECT_MESSAGE:READ";
|
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_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_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_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---- */
|
/* ----API_SCENARIO---- */
|
||||||
public static final String PROJECT_API_SCENARIO_READ = "PROJECT_API_SCENARIO:READ";
|
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";
|
public static final String PROJECT_API_SCENARIO_ADD = "PROJECT_API_SCENARIO:READ+ADD";
|
||||||
|
|
|
@ -487,6 +487,8 @@ permission.api_debug.name=接口调试
|
||||||
permission.api_definition.name=接口管理
|
permission.api_definition.name=接口管理
|
||||||
permission.api_case.name=接口用例
|
permission.api_case.name=接口用例
|
||||||
permission.api_mock.name=接口Mock
|
permission.api_mock.name=接口Mock
|
||||||
|
permission.api_doc.name=接口文档
|
||||||
|
permission.api_doc.share=分享
|
||||||
permission.api_definition.import=导入
|
permission.api_definition.import=导入
|
||||||
permission.api_definition.export=导出
|
permission.api_definition.export=导出
|
||||||
permission.api_definition.execute=执行
|
permission.api_definition.execute=执行
|
||||||
|
|
|
@ -496,6 +496,8 @@ permission.api_debug.name=API Debug
|
||||||
permission.api_definition.name=API Management
|
permission.api_definition.name=API Management
|
||||||
permission.api_case.name=API Case
|
permission.api_case.name=API Case
|
||||||
permission.api_mock.name=API Mock
|
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.import=Import
|
||||||
permission.api_definition.export=Export
|
permission.api_definition.export=Export
|
||||||
permission.api_definition.execute=Execute
|
permission.api_definition.execute=Execute
|
||||||
|
|
|
@ -493,6 +493,8 @@ permission.api_debug.name=接口调试
|
||||||
permission.api_definition.name=接口管理
|
permission.api_definition.name=接口管理
|
||||||
permission.api_case.name=接口用例
|
permission.api_case.name=接口用例
|
||||||
permission.api_mock.name=接口Mock
|
permission.api_mock.name=接口Mock
|
||||||
|
permission.api_doc.name=接口文档
|
||||||
|
permission.api_doc.share=分享
|
||||||
permission.api_definition.import=导入
|
permission.api_definition.import=导入
|
||||||
permission.api_definition.export=导出
|
permission.api_definition.export=导出
|
||||||
permission.api_definition.execute=执行
|
permission.api_definition.execute=执行
|
||||||
|
|
|
@ -493,6 +493,8 @@ permission.api_debug.name=接口調試
|
||||||
permission.api_definition.name=接口管理
|
permission.api_definition.name=接口管理
|
||||||
permission.api_case.name=接口用例
|
permission.api_case.name=接口用例
|
||||||
permission.api_mock.name=接口Mock
|
permission.api_mock.name=接口Mock
|
||||||
|
permission.api_doc.name=接口文档
|
||||||
|
permission.api_doc.share=分享
|
||||||
permission.api_definition.import=導入
|
permission.api_definition.import=導入
|
||||||
permission.api_definition.export=導出
|
permission.api_definition.export=導出
|
||||||
permission.api_definition.execute=執行
|
permission.api_definition.execute=執行
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class ApiDefinitionController {
|
||||||
|
|
||||||
@PostMapping("/page-doc")
|
@PostMapping("/page-doc")
|
||||||
@Operation(summary = "接口测试-接口管理-接口文档列表")
|
@Operation(summary = "接口测试-接口管理-接口文档列表")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_READ)
|
||||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||||
public Pager<List<ApiDefinitionDTO>> getDocPage(@Validated @RequestBody ApiDefinitionPageRequest request) {
|
public Pager<List<ApiDefinitionDTO>> getDocPage(@Validated @RequestBody ApiDefinitionPageRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||||
|
@ -197,7 +197,7 @@ public class ApiDefinitionController {
|
||||||
|
|
||||||
@PostMapping("/doc")
|
@PostMapping("/doc")
|
||||||
@Operation(summary = "接口测试-接口管理-接口文档列表")
|
@Operation(summary = "接口测试-接口管理-接口文档列表")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE)
|
||||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||||
public ApiDefinitionDocDTO getDocInfo(@Validated @RequestBody ApiDefinitionDocRequest request) {
|
public ApiDefinitionDocDTO getDocInfo(@Validated @RequestBody ApiDefinitionDocRequest request) {
|
||||||
return apiDefinitionService.getDocInfo(request);
|
return apiDefinitionService.getDocInfo(request);
|
||||||
|
|
|
@ -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",
|
"id": "PROJECT_API_SCENARIO",
|
||||||
"name": "message.api_scenario_task",
|
"name": "message.api_scenario_task",
|
||||||
|
|
|
@ -990,7 +990,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
Assertions.assertEquals(allApiDefinitionDocDTO.getDocInfo().getId(), copyAllApiDefinitionDocDTO.getDocInfo().getId());
|
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
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue