fix: 只读用户不能执行创建、修改、删除等操作
This commit is contained in:
parent
fec5cf30f0
commit
781d27453a
|
@ -11,7 +11,7 @@ import io.metersphere.commons.utils.PageUtils;
|
|||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.DashboardTestDTO;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -27,7 +27,7 @@ public class APIReportController {
|
|||
@Resource
|
||||
private APIReportService apiReportService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@GetMapping("recent/{count}")
|
||||
public List<APIReportResult> recentTest(@PathVariable int count) {
|
||||
|
@ -41,7 +41,7 @@ public class APIReportController {
|
|||
|
||||
@GetMapping("/list/{testId}/{goPage}/{pageSize}")
|
||||
public Pager<List<APIReportResult>> listByTestId(@PathVariable String testId, @PathVariable int goPage, @PathVariable int pageSize) {
|
||||
checkOwnerService.checkApiTestOwner(testId);
|
||||
checkPermissionService.checkApiTestOwner(testId);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, apiReportService.listByTestId(testId));
|
||||
|
||||
|
|
|
@ -15,11 +15,13 @@ import io.metersphere.base.domain.ApiTest;
|
|||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.commons.utils.CronUtils;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||
import io.metersphere.dto.ScheduleDao;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
|
@ -27,7 +29,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
@ -46,7 +47,7 @@ public class APITestController {
|
|||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
private CheckOwnerService checkownerService;
|
||||
private CheckPermissionService checkownerService;
|
||||
@Resource
|
||||
private ApiTestCaseService apiTestCaseService;
|
||||
@Resource
|
||||
|
|
|
@ -14,6 +14,7 @@ import io.metersphere.commons.constants.RoleConstants;
|
|||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
|
@ -30,6 +31,8 @@ import java.util.List;
|
|||
public class ApiDefinitionController {
|
||||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<ApiDefinitionResult>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) {
|
||||
|
@ -41,18 +44,21 @@ public class ApiDefinitionController {
|
|||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
|
||||
public void create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
checkPermissionService.checkReadOnlyUser();
|
||||
apiDefinitionService.create(request, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
|
||||
public void update(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
checkPermissionService.checkReadOnlyUser();
|
||||
apiDefinitionService.update(request, bodyFiles);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
|
||||
public void delete(@PathVariable String id) {
|
||||
checkPermissionService.checkReadOnlyUser();
|
||||
apiDefinitionService.delete(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.metersphere.api.dto.definition.DragModuleRequest;
|
|||
import io.metersphere.api.service.ApiModuleService;
|
||||
import io.metersphere.base.domain.ApiModule;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -21,17 +21,17 @@ public class ApiModuleController {
|
|||
@Resource
|
||||
ApiModuleService apiModuleService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@GetMapping("/list/{projectId}/{protocol}")
|
||||
public List<ApiModuleDTO> getNodeByProjectId(@PathVariable String projectId,@PathVariable String protocol) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return apiModuleService.getNodeTreeByProjectId(projectId,protocol);
|
||||
}
|
||||
|
||||
@GetMapping("/list/plan/{planId}/{protocol}")
|
||||
public List<ApiModuleDTO> getNodeByPlanId(@PathVariable String planId, @PathVariable String protocol) {
|
||||
checkOwnerService.checkTestPlanOwner(planId);
|
||||
checkPermissionService.checkTestPlanOwner(planId);
|
||||
return apiModuleService.getNodeByPlanId(planId, protocol);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,13 @@ import io.metersphere.api.dto.automation.DragApiScenarioModuleRequest;
|
|||
import io.metersphere.api.service.ApiScenarioModuleService;
|
||||
import io.metersphere.base.domain.ApiScenarioModule;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RequestMapping("/api/automation/module")
|
||||
@RestController
|
||||
|
@ -22,11 +21,11 @@ public class ApiScenarioModuleController {
|
|||
@Resource
|
||||
ApiScenarioModuleService apiScenarioModuleService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiScenarioModuleDTO> getNodeByProjectId(@PathVariable String projectId) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return apiScenarioModuleService.getNodeTreeByProjectId(projectId);
|
||||
}
|
||||
|
||||
|
@ -44,7 +43,7 @@ public class ApiScenarioModuleController {
|
|||
|
||||
@GetMapping("/list/plan/{planId}")
|
||||
public List<ApiScenarioModuleDTO> getNodeByPlanId(@PathVariable String planId) {
|
||||
checkOwnerService.checkTestPlanOwner(planId);
|
||||
checkPermissionService.checkTestPlanOwner(planId);
|
||||
return apiScenarioModuleService.getNodeByPlanId(planId);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package io.metersphere.api.controller;
|
|||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -19,11 +19,11 @@ public class ApiTestEnvironmentController {
|
|||
@Resource
|
||||
ApiTestEnvironmentService apiTestEnvironmentService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiTestEnvironmentWithBLOBs> list(@PathVariable String projectId) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return apiTestEnvironmentService.list(projectId);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.metersphere.commons.utils.Pager;
|
|||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.ProjectRequest;
|
||||
import io.metersphere.dto.ProjectDTO;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
|
@ -24,7 +24,7 @@ public class ProjectController {
|
|||
@Resource
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@GetMapping("/listAll")
|
||||
public List<ProjectDTO> listAll() {
|
||||
|
@ -74,7 +74,7 @@ public class ProjectController {
|
|||
@GetMapping("/delete/{projectId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
|
||||
public void deleteProject(@PathVariable(value = "projectId") String projectId) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
projectService.deleteProject(projectId);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import io.metersphere.dto.DashboardTestDTO;
|
|||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.dto.ScheduleDao;
|
||||
import io.metersphere.performance.service.PerformanceTestService;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.service.FileService;
|
||||
import io.metersphere.track.request.testplan.*;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
|
@ -37,7 +37,7 @@ public class PerformanceTestController {
|
|||
@Resource
|
||||
private FileService fileService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@GetMapping("recent/{count}")
|
||||
public List<LoadTestDTO> recentTestPlans(@PathVariable int count) {
|
||||
|
@ -59,14 +59,14 @@ public class PerformanceTestController {
|
|||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<LoadTest> list(@PathVariable String projectId) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return performanceTestService.getLoadTestByProjectId(projectId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/state/get/{testId}")
|
||||
public LoadTest listByTestId(@PathVariable String testId) {
|
||||
checkOwnerService.checkPerformanceTestOwner(testId);
|
||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||
return performanceTestService.getLoadTestBytestId(testId);
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ public class PerformanceTestController {
|
|||
@RequestPart("request") SaveTestPlanRequest request,
|
||||
@RequestPart(value = "file") List<MultipartFile> files
|
||||
) {
|
||||
checkPermissionService.checkReadOnlyUser();
|
||||
return performanceTestService.save(request, files);
|
||||
}
|
||||
|
||||
|
@ -83,37 +84,39 @@ public class PerformanceTestController {
|
|||
@RequestPart("request") EditTestPlanRequest request,
|
||||
@RequestPart(value = "file", required = false) List<MultipartFile> files
|
||||
) {
|
||||
checkOwnerService.checkPerformanceTestOwner(request.getId());
|
||||
checkPermissionService.checkReadOnlyUser();
|
||||
checkPermissionService.checkPerformanceTestOwner(request.getId());
|
||||
return performanceTestService.edit(request, files);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{testId}")
|
||||
public LoadTestDTO get(@PathVariable String testId) {
|
||||
checkOwnerService.checkPerformanceTestOwner(testId);
|
||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||
return performanceTestService.get(testId);
|
||||
}
|
||||
|
||||
@GetMapping("/get-advanced-config/{testId}")
|
||||
public String getAdvancedConfiguration(@PathVariable String testId) {
|
||||
checkOwnerService.checkPerformanceTestOwner(testId);
|
||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||
return performanceTestService.getAdvancedConfiguration(testId);
|
||||
}
|
||||
|
||||
@GetMapping("/get-load-config/{testId}")
|
||||
public String getLoadConfiguration(@PathVariable String testId) {
|
||||
checkOwnerService.checkPerformanceTestOwner(testId);
|
||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||
return performanceTestService.getLoadConfiguration(testId);
|
||||
}
|
||||
|
||||
@GetMapping("/get-jmx-content/{testId}")
|
||||
public String getJmxContent(@PathVariable String testId) {
|
||||
checkOwnerService.checkPerformanceTestOwner(testId);
|
||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||
return performanceTestService.getJmxContent(testId);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestBody DeleteTestPlanRequest request) {
|
||||
checkOwnerService.checkPerformanceTestOwner(request.getId());
|
||||
checkPermissionService.checkReadOnlyUser();
|
||||
checkPermissionService.checkPerformanceTestOwner(request.getId());
|
||||
performanceTestService.delete(request);
|
||||
}
|
||||
|
||||
|
@ -129,7 +132,7 @@ public class PerformanceTestController {
|
|||
|
||||
@GetMapping("/file/metadata/{testId}")
|
||||
public List<FileMetadata> getFileMetadata(@PathVariable String testId) {
|
||||
checkOwnerService.checkPerformanceTestOwner(testId);
|
||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||
return fileService.getFileMetadataByTestId(testId);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import io.metersphere.commons.utils.SessionUtils;
|
|||
import io.metersphere.i18n.Translator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -18,7 +17,7 @@ import java.util.Set;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CheckOwnerService {
|
||||
public class CheckPermissionService {
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
@Resource
|
||||
|
@ -32,6 +31,20 @@ public class CheckOwnerService {
|
|||
@Resource
|
||||
private ExtTestCaseReviewMapper extTestCaseReviewMapper;
|
||||
|
||||
|
||||
public void checkReadOnlyUser() {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
Set<String> collect = Objects.requireNonNull(SessionUtils.getUser()).getUserRoles().stream()
|
||||
.filter(ur ->
|
||||
StringUtils.equals(ur.getRoleId(), RoleConstants.TEST_VIEWER))
|
||||
.map(UserRole::getSourceId)
|
||||
.filter(sourceId -> StringUtils.equals(currentWorkspaceId, sourceId))
|
||||
.collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(collect)) {
|
||||
throw new RuntimeException(Translator.get("check_owner_read_only"));
|
||||
}
|
||||
}
|
||||
|
||||
public void checkProjectOwner(String projectId) {
|
||||
Set<String> workspaceIds = getUserRelatedWorkspaceIds();
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
|
@ -42,7 +55,7 @@ public class CheckOwnerService {
|
|||
return;
|
||||
}
|
||||
if (!workspaceIds.contains(project.getWorkspaceId())) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_project"));
|
||||
throw new RuntimeException(Translator.get("check_owner_project"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +80,7 @@ public class CheckOwnerService {
|
|||
int result = extApiTestMapper.checkApiTestOwner(testId, workspaceIds);
|
||||
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_test"));
|
||||
throw new RuntimeException(Translator.get("check_owner_test"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +96,7 @@ public class CheckOwnerService {
|
|||
int result = extLoadTestMapper.checkLoadTestOwner(testId, workspaceIds);
|
||||
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_test"));
|
||||
throw new RuntimeException(Translator.get("check_owner_test"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +108,7 @@ public class CheckOwnerService {
|
|||
|
||||
int result = extTestCaseMapper.checkIsHave(caseId, workspaceIds);
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_case"));
|
||||
throw new RuntimeException(Translator.get("check_owner_case"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +119,7 @@ public class CheckOwnerService {
|
|||
}
|
||||
int result = extTestPlanMapper.checkIsHave(planId, workspaceIds);
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_plan"));
|
||||
throw new RuntimeException(Translator.get("check_owner_plan"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +130,7 @@ public class CheckOwnerService {
|
|||
}
|
||||
int result = extTestCaseReviewMapper.checkIsHave(reviewId, workspaceIds);
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_review"));
|
||||
throw new RuntimeException(Translator.get("check_owner_review"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import io.metersphere.commons.utils.PageUtils;
|
|||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.excel.domain.ExcelResponse;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.service.FileService;
|
||||
import io.metersphere.track.dto.TestCaseDTO;
|
||||
import io.metersphere.track.request.testcase.EditTestCaseRequest;
|
||||
|
@ -39,7 +39,7 @@ public class TestCaseController {
|
|||
@Resource
|
||||
TestCaseService testCaseService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class TestCaseController {
|
|||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<TestCaseDTO> list(@PathVariable String projectId) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
QueryTestCaseRequest request = new QueryTestCaseRequest();
|
||||
request.setProjectId(projectId);
|
||||
return testCaseService.listTestCase(request);
|
||||
|
@ -94,13 +94,13 @@ public class TestCaseController {
|
|||
|
||||
@GetMapping("/get/{testCaseId}")
|
||||
public TestCaseWithBLOBs getTestCase(@PathVariable String testCaseId) {
|
||||
checkOwnerService.checkTestCaseOwner(testCaseId);
|
||||
checkPermissionService.checkTestCaseOwner(testCaseId);
|
||||
return testCaseService.getTestCase(testCaseId);
|
||||
}
|
||||
|
||||
@GetMapping("/project/{testCaseId}")
|
||||
public Project getProjectByTestCaseId(@PathVariable String testCaseId) {
|
||||
checkOwnerService.checkTestCaseOwner(testCaseId);
|
||||
checkPermissionService.checkTestCaseOwner(testCaseId);
|
||||
return testCaseService.getProjectByTestCaseId(testCaseId);
|
||||
}
|
||||
|
||||
|
@ -119,14 +119,14 @@ public class TestCaseController {
|
|||
@PostMapping("/delete/{testCaseId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public int deleteTestCase(@PathVariable String testCaseId) {
|
||||
checkOwnerService.checkTestCaseOwner(testCaseId);
|
||||
checkPermissionService.checkTestCaseOwner(testCaseId);
|
||||
return testCaseService.deleteTestCase(testCaseId);
|
||||
}
|
||||
|
||||
@PostMapping("/import/{projectId}/{userId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public ExcelResponse testCaseImport(MultipartFile file, @PathVariable String projectId, @PathVariable String userId) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return testCaseService.testCaseImport(file, projectId, userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package io.metersphere.track.controller;
|
|||
|
||||
import io.metersphere.base.domain.TestCaseNode;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.track.dto.TestCaseNodeDTO;
|
||||
import io.metersphere.track.request.testcase.DragNodeRequest;
|
||||
import io.metersphere.track.request.testcase.QueryNodeRequest;
|
||||
|
@ -22,11 +22,11 @@ public class TestCaseNodeController {
|
|||
@Resource
|
||||
TestCaseNodeService testCaseNodeService;
|
||||
@Resource
|
||||
private CheckOwnerService checkOwnerService;
|
||||
private CheckPermissionService checkPermissionService;
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<TestCaseNodeDTO> getNodeByProjectId(@PathVariable String projectId) {
|
||||
checkOwnerService.checkProjectOwner(projectId);
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return testCaseNodeService.getNodeTreeByProjectId(projectId);
|
||||
}
|
||||
|
||||
|
@ -43,13 +43,13 @@ public class TestCaseNodeController {
|
|||
|
||||
@GetMapping("/list/plan/{planId}")
|
||||
public List<TestCaseNodeDTO> getNodeByPlanId(@PathVariable String planId) {
|
||||
checkOwnerService.checkTestPlanOwner(planId);
|
||||
checkPermissionService.checkTestPlanOwner(planId);
|
||||
return testCaseNodeService.getNodeByPlanId(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/review/{reviewId}")
|
||||
public List<TestCaseNodeDTO> getNodeByReviewId(@PathVariable String reviewId) {
|
||||
checkOwnerService.checkTestReviewOwner(reviewId);
|
||||
checkPermissionService.checkTestReviewOwner(reviewId);
|
||||
return testCaseNodeService.getNodeByReviewId(reviewId);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.metersphere.commons.constants.RoleConstants;
|
|||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.track.dto.TestCaseReviewDTO;
|
||||
import io.metersphere.track.dto.TestReviewDTOWithMetric;
|
||||
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
||||
|
@ -35,7 +35,7 @@ public class TestCaseReviewController {
|
|||
@Resource
|
||||
TestReviewProjectService testReviewProjectService;
|
||||
@Resource
|
||||
CheckOwnerService checkOwnerService;
|
||||
CheckPermissionService checkPermissionService;
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<TestCaseReviewDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryCaseReviewRequest request) {
|
||||
|
@ -75,7 +75,7 @@ public class TestCaseReviewController {
|
|||
@GetMapping("/delete/{reviewId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void deleteCaseReview(@PathVariable String reviewId) {
|
||||
checkOwnerService.checkTestReviewOwner(reviewId);
|
||||
checkPermissionService.checkTestReviewOwner(reviewId);
|
||||
testCaseReviewService.deleteCaseReview(reviewId);
|
||||
}
|
||||
|
||||
|
@ -107,14 +107,14 @@ public class TestCaseReviewController {
|
|||
|
||||
@GetMapping("/get/{reviewId}")
|
||||
public TestCaseReview getTestReview(@PathVariable String reviewId) {
|
||||
checkOwnerService.checkTestReviewOwner(reviewId);
|
||||
checkPermissionService.checkTestReviewOwner(reviewId);
|
||||
return testCaseReviewService.getTestReview(reviewId);
|
||||
}
|
||||
|
||||
@PostMapping("/edit/status/{reviewId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void editTestPlanStatus(@PathVariable String reviewId) {
|
||||
checkOwnerService.checkTestReviewOwner(reviewId);
|
||||
checkPermissionService.checkTestReviewOwner(reviewId);
|
||||
testCaseReviewService.editTestReviewStatus(reviewId);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import io.metersphere.commons.constants.RoleConstants;
|
|||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
import io.metersphere.track.dto.TestPlanDTOWithMetric;
|
||||
|
@ -34,7 +34,7 @@ public class TestPlanController {
|
|||
@Resource
|
||||
TestPlanProjectService testPlanProjectService;
|
||||
@Resource
|
||||
CheckOwnerService checkOwnerService;
|
||||
CheckPermissionService checkPermissionService;
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<TestPlanDTOWithMetric>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
|
||||
|
@ -73,7 +73,7 @@ public class TestPlanController {
|
|||
|
||||
@PostMapping("/get/{testPlanId}")
|
||||
public TestPlan getTestPlan(@PathVariable String testPlanId) {
|
||||
checkOwnerService.checkTestPlanOwner(testPlanId);
|
||||
checkPermissionService.checkTestPlanOwner(testPlanId);
|
||||
return testPlanService.getTestPlan(testPlanId);
|
||||
}
|
||||
|
||||
|
@ -92,14 +92,14 @@ public class TestPlanController {
|
|||
@PostMapping("/edit/status/{planId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void editTestPlanStatus(@PathVariable String planId) {
|
||||
checkOwnerService.checkTestPlanOwner(planId);
|
||||
checkPermissionService.checkTestPlanOwner(planId);
|
||||
testPlanService.editTestPlanStatus(planId);
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{testPlanId}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public int deleteTestPlan(@PathVariable String testPlanId) {
|
||||
checkOwnerService.checkTestPlanOwner(testPlanId);
|
||||
checkPermissionService.checkTestPlanOwner(testPlanId);
|
||||
return testPlanService.deleteTestPlan(testPlanId);
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ check_owner_case=The current user does not have permission to operate this use c
|
|||
check_owner_plan=The current user does not have permission to operate this plan
|
||||
check_owner_review=The current user does not have permission to operate this review
|
||||
check_owner_comment=The current user does not have permission to manipulate this comment
|
||||
check_owner_read_only=The current user in this workspace is a read-only user
|
||||
upload_content_is_null=Imported content is empty
|
||||
test_plan_notification=Test plan notification
|
||||
task_defect_notification=Task defect notification
|
||||
|
|
|
@ -165,6 +165,7 @@ check_owner_case=当前用户没有操作此用例的权限
|
|||
check_owner_plan=当前用户没有操作此计划的权限
|
||||
check_owner_review=当前用户没有操作此评审的权限
|
||||
check_owner_comment=当前用户没有操作此评论的权限
|
||||
check_owner_read_only=当前用户在此工作空间为只读用户
|
||||
upload_content_is_null=导入内容为空
|
||||
test_plan_notification=测试计划通知
|
||||
task_defect_notification=缺陷任务通知
|
||||
|
|
|
@ -166,6 +166,7 @@ check_owner_case=當前用戶沒有操作此用例的權限
|
|||
check_owner_plan=當前用戶沒有操作此計劃的權限
|
||||
check_owner_review=當前用戶沒有操作此評審的權限
|
||||
check_owner_comment=當前用戶沒有操作此評論的權限
|
||||
check_owner_read_only=當前用戶在此工作空間為只讀用戶
|
||||
upload_content_is_null=導入內容為空
|
||||
test_plan_notification=測試計畫通知
|
||||
task_defect_notification=缺陷任務通知
|
||||
|
|
Loading…
Reference in New Issue