fix(测试计划): 修复校验资源权限报错的缺陷

This commit is contained in:
wxg0103 2024-06-26 10:48:58 +08:00 committed by 刘瑞斌
parent 7422e6afbc
commit ce8e4c2175
3 changed files with 6 additions and 6 deletions

View File

@ -18,8 +18,8 @@
FROM user_role_relation FROM user_role_relation
WHERE source_id IN (SELECT project_id WHERE source_id IN (SELECT project_id
FROM ${table} JOIN ${relationTable} ON ${table}.id = ${relationTable}.${table}_id FROM ${table} JOIN ${relationTable} ON ${table}.id = ${relationTable}.${table}_id
JOIN project ON ${table}.project_id = project.id AND project.enable = TRUE JOIN project ON ${table}.project_id = project.id AND project.enable = TRUE
WHERE ${table}.id IN WHERE ${relationTable}.id IN
<foreach collection="ids" item="id" separator="," open="(" close=")"> <foreach collection="ids" item="id" separator="," open="(" close=")">
#{id} #{id}
</foreach>) </foreach>)

View File

@ -126,7 +126,7 @@ public class TestPlanApiCaseController {
@GetMapping("/run/{id}") @GetMapping("/run/{id}")
@Operation(summary = "用例执行") @Operation(summary = "用例执行")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
@CheckOwner(resourceId = "#id", resourceType = "test_plan_api_case", relationType = "test_plan") @CheckOwner(resourceId = "#id", resourceType = "test_plan", relationType = "test_plan_api_case")
public TaskRequestDTO run(@PathVariable String id, public TaskRequestDTO run(@PathVariable String id,
@Schema(description = "报告ID传了可以实时获取结果不传则不支持实时获取") @Schema(description = "报告ID传了可以实时获取结果不传则不支持实时获取")
@RequestParam(required = false) String reportId) { @RequestParam(required = false) String reportId) {
@ -137,7 +137,7 @@ public class TestPlanApiCaseController {
@PostMapping("/batch/run") @PostMapping("/batch/run")
@Operation(summary = "批量执行") @Operation(summary = "批量执行")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
@CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "test_plan_api_case", relationType = "test_plan") @CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "test_plan", relationType = "test_plan_api_case")
public void batchRun(@Validated @RequestBody TestPlanApiCaseBatchRunRequest request) { public void batchRun(@Validated @RequestBody TestPlanApiCaseBatchRunRequest request) {
testPlanApiCaseBatchRunService.asyncBatchRun(request, SessionUtils.getUserId()); testPlanApiCaseBatchRunService.asyncBatchRun(request, SessionUtils.getUserId());
} }

View File

@ -79,7 +79,7 @@ public class TestPlanApiScenarioController {
@GetMapping("/run/{id}") @GetMapping("/run/{id}")
@Operation(summary = "接口测试-接口场景管理-场景执行") @Operation(summary = "接口测试-接口场景管理-场景执行")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
@CheckOwner(resourceId = "#id", resourceType = "test_plan_api_scenario", relationType = "test_plan") @CheckOwner(resourceId = "#id", resourceType = "test_plan", relationType = "test_plan_api_scenario")
public TaskRequestDTO run(@PathVariable String id, @RequestParam(required = false) String reportId) { public TaskRequestDTO run(@PathVariable String id, @RequestParam(required = false) String reportId) {
return testPlanApiScenarioService.run(id, reportId, SessionUtils.getUserId()); return testPlanApiScenarioService.run(id, reportId, SessionUtils.getUserId());
} }
@ -87,7 +87,7 @@ public class TestPlanApiScenarioController {
@PostMapping("/batch/run") @PostMapping("/batch/run")
@Operation(summary = "批量执行") @Operation(summary = "批量执行")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
@CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "test_plan_api_scenario", relationType = "test_plan") @CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "test_plan", relationType = "test_plan_api_scenario")
public void batchRun(@Validated @RequestBody TestPlanApiScenarioBatchRunRequest request) { public void batchRun(@Validated @RequestBody TestPlanApiScenarioBatchRunRequest request) {
testPlanApiScenarioBatchRunService.asyncBatchRun(request, SessionUtils.getUserId()); testPlanApiScenarioBatchRunService.asyncBatchRun(request, SessionUtils.getUserId());
} }