refactor(权限管理): 去掉requireroles 处理冲突

This commit is contained in:
Captain.B 2021-05-21 17:02:13 +08:00 committed by 刘瑞斌
parent fb69a5cf81
commit 689eedb216
40 changed files with 124 additions and 179 deletions

View File

@ -21,7 +21,6 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/api/report") @RequestMapping(value = "/api/report")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class APIReportController { public class APIReportController {
@Resource @Resource
@ -60,7 +59,6 @@ public class APIReportController {
} }
@PostMapping("/delete") @PostMapping("/delete")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
public void delete(@RequestBody DeleteAPIReportRequest request) { public void delete(@RequestBody DeleteAPIReportRequest request) {
apiReportService.delete(request); apiReportService.delete(request);
} }
@ -71,7 +69,6 @@ public class APIReportController {
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
public void deleteAPIReportBatch(@RequestBody DeleteAPIReportRequest reportRequest) { public void deleteAPIReportBatch(@RequestBody DeleteAPIReportRequest reportRequest) {
apiReportService.deleteAPIReportBatch(reportRequest); apiReportService.deleteAPIReportBatch(reportRequest);
} }

View File

@ -23,7 +23,6 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/api/scenario/report") @RequestMapping(value = "/api/scenario/report")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class APIScenarioReportController { public class APIScenarioReportController {
@Resource @Resource
@ -42,7 +41,6 @@ public class APIScenarioReportController {
} }
@PostMapping("/update") @PostMapping("/update")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public String update(@RequestBody APIScenarioReportResult node) { public String update(@RequestBody APIScenarioReportResult node) {
node.setExecuteType(ExecuteType.Saved.name()); node.setExecuteType(ExecuteType.Saved.name());
return apiReportService.update(node); return apiReportService.update(node);

View File

@ -41,7 +41,6 @@ import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
@RestController @RestController
@RequestMapping(value = "/api") @RequestMapping(value = "/api")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class APITestController { public class APITestController {
@Resource @Resource
private APITestService apiTestService; private APITestService apiTestService;
@ -159,7 +158,6 @@ public class APITestController {
} }
@PostMapping(value = "/import", consumes = {"multipart/form-data"}) @PostMapping(value = "/import", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public ApiTest testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) { public ApiTest testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) {
return apiTestService.apiTestImport(file, request); return apiTestService.apiTestImport(file, request);
} }

View File

@ -11,7 +11,7 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping(value = "/api/database") @RequestMapping(value = "/api/database")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
public class ApiDatabaseController { public class ApiDatabaseController {
@Resource @Resource

View File

@ -19,7 +19,6 @@ import java.util.List;
@RequestMapping("/api/module") @RequestMapping("/api/module")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public class ApiModuleController { public class ApiModuleController {
@Resource @Resource
@ -60,21 +59,18 @@ public class ApiModuleController {
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiModuleService.class) @MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiModuleService.class)
public String addNode(@RequestBody ApiModule node) { public String addNode(@RequestBody ApiModule node) {
return apiModuleService.addNode(node); return apiModuleService.addNode(node);
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiModuleService.class) @MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiModuleService.class)
public int editNode(@RequestBody DragModuleRequest node) { public int editNode(@RequestBody DragModuleRequest node) {
return apiModuleService.editNode(node); return apiModuleService.editNode(node);
} }
@PostMapping("/delete") @PostMapping("/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_definition", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#nodeIds)", msClass = ApiModuleService.class) @MsAuditLog(module = "api_definition", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#nodeIds)", msClass = ApiModuleService.class)
public int deleteNode(@RequestBody List<String> nodeIds) { public int deleteNode(@RequestBody List<String> nodeIds) {
//nodeIds 包含删除节点ID及其所有子节点ID //nodeIds 包含删除节点ID及其所有子节点ID
@ -82,7 +78,6 @@ public class ApiModuleController {
} }
@PostMapping("/drag") @PostMapping("/drag")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiModuleService.class) @MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiModuleService.class)
public void dragNode(@RequestBody DragModuleRequest node) { public void dragNode(@RequestBody DragModuleRequest node) {
apiModuleService.dragNode(node); apiModuleService.dragNode(node);

View File

@ -15,7 +15,6 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/api/monitor") @RequestMapping(value = "/api/monitor")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class ApiMonitorController { public class ApiMonitorController {
@Resource @Resource

View File

@ -17,7 +17,6 @@ import java.util.List;
@RequestMapping("/api/automation/module") @RequestMapping("/api/automation/module")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public class ApiScenarioModuleController { public class ApiScenarioModuleController {
@Resource @Resource
@ -32,14 +31,12 @@ public class ApiScenarioModuleController {
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_automation", type = OperLogConstants.CREATE, title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiScenarioModuleService.class) @MsAuditLog(module = "api_automation", type = OperLogConstants.CREATE, title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiScenarioModuleService.class)
public String addNode(@RequestBody ApiScenarioModule node) { public String addNode(@RequestBody ApiScenarioModule node) {
return apiScenarioModuleService.addNode(node); return apiScenarioModuleService.addNode(node);
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_automation", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiScenarioModuleService.class) @MsAuditLog(module = "api_automation", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiScenarioModuleService.class)
public int editNode(@RequestBody DragApiScenarioModuleRequest node) { public int editNode(@RequestBody DragApiScenarioModuleRequest node) {
return apiScenarioModuleService.editNode(node); return apiScenarioModuleService.editNode(node);
@ -52,7 +49,6 @@ public class ApiScenarioModuleController {
} }
@PostMapping("/delete") @PostMapping("/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_automation", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#nodeIds)", msClass = ApiScenarioModuleService.class) @MsAuditLog(module = "api_automation", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#nodeIds)", msClass = ApiScenarioModuleService.class)
public int deleteNode(@RequestBody List<String> nodeIds) { public int deleteNode(@RequestBody List<String> nodeIds) {
//nodeIds 包含删除节点ID及其所有子节点ID //nodeIds 包含删除节点ID及其所有子节点ID
@ -60,7 +56,6 @@ public class ApiScenarioModuleController {
} }
@PostMapping("/drag") @PostMapping("/drag")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_automation", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiScenarioModuleService.class) @MsAuditLog(module = "api_automation", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = ApiScenarioModuleService.class)
public void dragNode(@RequestBody DragApiScenarioModuleRequest node) { public void dragNode(@RequestBody DragApiScenarioModuleRequest node) {
apiScenarioModuleService.dragNode(node); apiScenarioModuleService.dragNode(node);

View File

@ -26,7 +26,6 @@ import java.util.Map;
@RestController @RestController
@RequestMapping(value = "/api/testcase") @RequestMapping(value = "/api/testcase")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class ApiTestCaseController { public class ApiTestCaseController {
@Resource @Resource
@ -119,13 +118,11 @@ public class ApiTestCaseController {
} }
@PostMapping("/batch/edit") @PostMapping("/batch/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editApiBath(@RequestBody ApiCaseBatchRequest request) { public void editApiBath(@RequestBody ApiCaseBatchRequest request) {
apiTestCaseService.editApiBath(request); apiTestCaseService.editApiBath(request);
} }
@PostMapping("/batch/editByParam") @PostMapping("/batch/editByParam")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class) @MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
public void editApiBathByParam(@RequestBody ApiTestBatchRequest request) { public void editApiBathByParam(@RequestBody ApiTestBatchRequest request) {
apiTestCaseService.editApiBathByParam(request); apiTestCaseService.editApiBathByParam(request);

View File

@ -24,7 +24,6 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/api/environment") @RequestMapping(value = "/api/environment")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class ApiTestEnvironmentController { public class ApiTestEnvironmentController {
@Resource @Resource
@ -65,27 +64,23 @@ public class ApiTestEnvironmentController {
@PostMapping(value = "/get/entry") @PostMapping(value = "/get/entry")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
public List<KeyStoreEntry> getEntry(@RequestPart("request") String password, @RequestPart(value = "file") MultipartFile sslFiles) { public List<KeyStoreEntry> getEntry(@RequestPart("request") String password, @RequestPart(value = "file") MultipartFile sslFiles) {
return commandService.get(password, sslFiles); return commandService.get(password, sslFiles);
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_environment_setting", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#apiTestEnvironmentWithBLOBs.id)", msClass = ApiTestEnvironmentService.class) @MsAuditLog(module = "project_environment_setting", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#apiTestEnvironmentWithBLOBs.id)", msClass = ApiTestEnvironmentService.class)
public String create(@RequestPart("request") ApiTestEnvironmentDTO apiTestEnvironmentWithBLOBs, @RequestPart(value = "files") List<MultipartFile> sslFiles) { public String create(@RequestPart("request") ApiTestEnvironmentDTO apiTestEnvironmentWithBLOBs, @RequestPart(value = "files") List<MultipartFile> sslFiles) {
return apiTestEnvironmentService.add(apiTestEnvironmentWithBLOBs, sslFiles); return apiTestEnvironmentService.add(apiTestEnvironmentWithBLOBs, sslFiles);
} }
@PostMapping(value = "/update") @PostMapping(value = "/update")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_environment_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#apiTestEnvironment.id)", content = "#msClass.getLogDetails(#apiTestEnvironment.id)", msClass = ApiTestEnvironmentService.class) @MsAuditLog(module = "project_environment_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#apiTestEnvironment.id)", content = "#msClass.getLogDetails(#apiTestEnvironment.id)", msClass = ApiTestEnvironmentService.class)
public void update(@RequestPart("request") ApiTestEnvironmentDTO apiTestEnvironment, @RequestPart(value = "files") List<MultipartFile> sslFiles) { public void update(@RequestPart("request") ApiTestEnvironmentDTO apiTestEnvironment, @RequestPart(value = "files") List<MultipartFile> sslFiles) {
apiTestEnvironmentService.update(apiTestEnvironment, sslFiles); apiTestEnvironmentService.update(apiTestEnvironment, sslFiles);
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_environment_setting", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestEnvironmentService.class) @MsAuditLog(module = "project_environment_setting", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestEnvironmentService.class)
public void delete(@PathVariable String id) { public void delete(@PathVariable String id) {
apiTestEnvironmentService.delete(id); apiTestEnvironmentService.delete(id);

View File

@ -19,7 +19,7 @@ import java.util.List;
@RequestMapping("custom/field") @RequestMapping("custom/field")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public class CustomFieldController { public class CustomFieldController {
@Resource @Resource

View File

@ -16,7 +16,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("custom/field/template") @RequestMapping("custom/field/template")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public class CustomFieldTemplateController { public class CustomFieldTemplateController {
@Resource @Resource

View File

@ -21,7 +21,7 @@ import java.util.List;
@RequestMapping("field/template/issue") @RequestMapping("field/template/issue")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public class IssueTemplateController { public class IssueTemplateController {
@Resource @Resource
private IssueTemplateService issueTemplateService; private IssueTemplateService issueTemplateService;

View File

@ -19,14 +19,14 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/jar") @RequestMapping(value = "/jar")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class JarConfigController { public class JarConfigController {
@Resource @Resource
JarConfigService JarConfigService; JarConfigService JarConfigService;
@PostMapping("list/{goPage}/{pageSize}") @PostMapping("list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ORG_ADMIN)
public Pager<List<JarConfig>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody JarConfig request) { public Pager<List<JarConfig>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody JarConfig request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, JarConfigService.list(request)); return PageUtils.setPageInfo(page, JarConfigService.list(request));
@ -48,21 +48,21 @@ public class JarConfigController {
} }
@PostMapping(value = "/add", consumes = {"multipart/form-data"}) @PostMapping(value = "/add", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_jar", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = JarConfigService.class) @MsAuditLog(module = "project_project_jar", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = JarConfigService.class)
public String add(@RequestPart("request") JarConfig request, @RequestPart(value = "file") MultipartFile file) { public String add(@RequestPart("request") JarConfig request, @RequestPart(value = "file") MultipartFile file) {
return JarConfigService.add(request, file); return JarConfigService.add(request, file);
} }
@PostMapping(value = "/update", consumes = {"multipart/form-data"}) @PostMapping(value = "/update", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_jar", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = JarConfigService.class) @MsAuditLog(module = "project_project_jar", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = JarConfigService.class)
public void update(@RequestPart("request") JarConfig request, @RequestPart(value = "file", required = false) MultipartFile file) { public void update(@RequestPart("request") JarConfig request, @RequestPart(value = "file", required = false) MultipartFile file) {
JarConfigService.update(request, file); JarConfigService.update(request, file);
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_jar", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = JarConfigService.class) @MsAuditLog(module = "project_project_jar", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = JarConfigService.class)
public void delete(@PathVariable String id) { public void delete(@PathVariable String id) {
JarConfigService.delete(id); JarConfigService.delete(id);

View File

@ -31,7 +31,7 @@ public class OrganizationController {
private UserService userService; private UserService userService;
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_organization", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#organization.id)", msClass = OrganizationService.class) @MsAuditLog(module = "system_organization", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#organization.id)", msClass = OrganizationService.class)
public Organization addOrganization(@RequestBody Organization organization) { public Organization addOrganization(@RequestBody Organization organization) {
organization.setId(UUID.randomUUID().toString()); organization.setId(UUID.randomUUID().toString());
@ -39,20 +39,20 @@ public class OrganizationController {
} }
@GetMapping("/list") @GetMapping("/list")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<Organization> getOrganizationList() { public List<Organization> getOrganizationList() {
return organizationService.getOrganizationList(new OrganizationRequest()); return organizationService.getOrganizationList(new OrganizationRequest());
} }
@PostMapping("/list/{goPage}/{pageSize}") @PostMapping("/list/{goPage}/{pageSize}")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public Pager<List<Organization>> getOrganizationList(@RequestBody OrganizationRequest request, @PathVariable int goPage, @PathVariable int pageSize) { public Pager<List<Organization>> getOrganizationList(@RequestBody OrganizationRequest request, @PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, organizationService.getOrganizationList(request)); return PageUtils.setPageInfo(page, organizationService.getOrganizationList(request));
} }
@GetMapping("/delete/{organizationId}") @GetMapping("/delete/{organizationId}")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_organization", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#organizationId)", msClass = OrganizationService.class) @MsAuditLog(module = "system_organization", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#organizationId)", msClass = OrganizationService.class)
public void deleteOrganization(@PathVariable(value = "organizationId") String organizationId) { public void deleteOrganization(@PathVariable(value = "organizationId") String organizationId) {
userService.refreshSessionUser("organization", organizationId); userService.refreshSessionUser("organization", organizationId);
@ -60,7 +60,7 @@ public class OrganizationController {
} }
@PostMapping("/update") @PostMapping("/update")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
@MsAuditLog(module = "system_organization", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#organization.id)", content = "#msClass.getLogDetails(#organization.id)", msClass = OrganizationService.class) @MsAuditLog(module = "system_organization", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#organization.id)", content = "#msClass.getLogDetails(#organization.id)", msClass = OrganizationService.class)
public void updateOrganization(@RequestBody Organization organization) { public void updateOrganization(@RequestBody Organization organization) {
organizationService.updateOrganization(organization); organizationService.updateOrganization(organization);
@ -72,8 +72,8 @@ public class OrganizationController {
} }
@PostMapping("/member/update") @PostMapping("/member/update")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
@MsAuditLog(module = "organization_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = OrganizationService.class) @MsAuditLog(module = "organization_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO.id)", content = "#msClass.getLogDetails(#memberDTO.id)", msClass = OrganizationService.class)
public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) { public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) {
organizationService.updateOrgMember(memberDTO); organizationService.updateOrgMember(memberDTO);
} }

View File

@ -53,7 +53,6 @@ public class ProjectController {
} }
@GetMapping("/recent/{count}") @GetMapping("/recent/{count}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<Project> recentProjects(@PathVariable int count) { public List<Project> recentProjects(@PathVariable int count) {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
ProjectRequest request = new ProjectRequest(); ProjectRequest request = new ProjectRequest();
@ -69,7 +68,6 @@ public class ProjectController {
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_manager", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#project.id)", msClass = ProjectService.class) @MsAuditLog(module = "project_project_manager", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#project.id)", msClass = ProjectService.class)
public Project addProject(@RequestBody AddProjectRequest project, HttpServletRequest request) { public Project addProject(@RequestBody AddProjectRequest project, HttpServletRequest request) {
Project returnModel = projectService.addProject(project); Project returnModel = projectService.addProject(project);
@ -93,7 +91,6 @@ public class ProjectController {
} }
@GetMapping("/delete/{projectId}") @GetMapping("/delete/{projectId}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_manager", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#projectId)", msClass = ProjectService.class) @MsAuditLog(module = "project_project_manager", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#projectId)", msClass = ProjectService.class)
public void deleteProject(@PathVariable(value = "projectId") String projectId) { public void deleteProject(@PathVariable(value = "projectId") String projectId) {
checkPermissionService.checkProjectOwner(projectId); checkPermissionService.checkProjectOwner(projectId);
@ -101,7 +98,6 @@ public class ProjectController {
} }
@PostMapping("/update") @PostMapping("/update")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_manager", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#Project.id)", content = "#msClass.getLogDetails(#Project.id)", msClass = ProjectService.class) @MsAuditLog(module = "project_project_manager", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#Project.id)", content = "#msClass.getLogDetails(#Project.id)", msClass = ProjectService.class)
public void updateProject(@RequestBody Project Project) { public void updateProject(@RequestBody Project Project) {
projectService.updateProject(Project); projectService.updateProject(Project);

View File

@ -14,13 +14,13 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping(value = "/resource") @RequestMapping(value = "/resource")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class ResourceController { public class ResourceController {
@Resource @Resource
ResourceService resourceService; ResourceService resourceService;
@PostMapping(value = "/md/upload", consumes = {"multipart/form-data"}) @PostMapping(value = "/md/upload", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
public void upload(@RequestPart(value = "request") MdUploadRequest request, @RequestPart(value = "file") MultipartFile file) { public void upload(@RequestPart(value = "request") MdUploadRequest request, @RequestPart(value = "file") MultipartFile file) {
resourceService.mdUpload(request, file); resourceService.mdUpload(request, file);
} }
@ -31,7 +31,7 @@ public class ResourceController {
} }
@GetMapping("/md/delete/{fileName}") @GetMapping("/md/delete/{fileName}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
public void delete(@PathVariable("fileName") String fileName) { public void delete(@PathVariable("fileName") String fileName) {
resourceService.mdDelete(fileName); resourceService.mdDelete(fileName);
} }

View File

@ -25,7 +25,7 @@ public class RoleController {
} }
@GetMapping("/all") @GetMapping("/all")
@RequiresRoles(RoleConstants.ADMIN)
public List<Role> getAllRole() { public List<Role> getAllRole() {
return roleService.getAllRole(); return roleService.getAllRole();
} }

View File

@ -26,14 +26,12 @@ public class SystemParameterController {
private SystemParameterService SystemParameterService; private SystemParameterService SystemParameterService;
@PostMapping("/edit/email") @PostMapping("/edit/email")
@RequiresRoles(value = {RoleConstants.ADMIN})
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置") @MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置")
public void editMail(@RequestBody List<SystemParameter> systemParameter) { public void editMail(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.editMail(systemParameter); SystemParameterService.editMail(systemParameter);
} }
@PostMapping("/testConnection") @PostMapping("/testConnection")
@RequiresRoles(value = {RoleConstants.ADMIN})
public void testConnection(@RequestBody HashMap<String, String> hashMap) { public void testConnection(@RequestBody HashMap<String, String> hashMap) {
SystemParameterService.testConnection(hashMap); SystemParameterService.testConnection(hashMap);
} }
@ -49,7 +47,6 @@ public class SystemParameterController {
} }
@GetMapping("/mail/info") @GetMapping("/mail/info")
@RequiresRoles(value = {RoleConstants.ADMIN})
public MailInfo mailInfo() { public MailInfo mailInfo() {
return SystemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue()); return SystemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
} }
@ -65,21 +62,18 @@ public class SystemParameterController {
} }
@PostMapping("/save/base") @PostMapping("/save/base")
@RequiresRoles(value = {RoleConstants.ADMIN})
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "基本配置") @MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "基本配置")
public void saveBaseInfo(@RequestBody List<SystemParameter> systemParameter) { public void saveBaseInfo(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.saveBaseInfo(systemParameter); SystemParameterService.saveBaseInfo(systemParameter);
} }
@PostMapping("/save/ldap") @PostMapping("/save/ldap")
@RequiresRoles(value = {RoleConstants.ADMIN})
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "LDAP设置") @MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "LDAP设置")
public void saveLdap(@RequestBody List<SystemParameter> systemParameter) { public void saveLdap(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.saveLdap(systemParameter); SystemParameterService.saveLdap(systemParameter);
} }
@GetMapping("/ldap/info") @GetMapping("/ldap/info")
@RequiresRoles(value = {RoleConstants.ADMIN})
public LdapInfo getLdapInfo() { public LdapInfo getLdapInfo() {
return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue()); return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
} }

View File

@ -22,7 +22,7 @@ import java.util.List;
@RequestMapping("field/template/case") @RequestMapping("field/template/case")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public class TestCaseTemplateController { public class TestCaseTemplateController {
@Resource @Resource
@ -35,7 +35,7 @@ public class TestCaseTemplateController {
} }
@PostMapping("/list/{goPage}/{pageSize}") @PostMapping("/list/{goPage}/{pageSize}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public Pager<List<TestCaseTemplateWithBLOBs>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseQueryRequest request) { public Pager<List<TestCaseTemplateWithBLOBs>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseQueryRequest request) {
Page<List<TestCaseTemplateWithBLOBs>> page = PageHelper.startPage(goPage, pageSize, true); Page<List<TestCaseTemplateWithBLOBs>> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseTemplateService.list(request)); return PageUtils.setPageInfo(page, testCaseTemplateService.list(request));
@ -54,13 +54,13 @@ public class TestCaseTemplateController {
} }
@GetMapping("/option/{workspaceId}") @GetMapping("/option/{workspaceId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<TestCaseTemplate> list(@PathVariable String workspaceId) { public List<TestCaseTemplate> list(@PathVariable String workspaceId) {
return testCaseTemplateService.getOption(workspaceId); return testCaseTemplateService.getOption(workspaceId);
} }
@GetMapping("/get/relate/{projectId}") @GetMapping("/get/relate/{projectId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public TestCaseTemplateDao getTemplate(@PathVariable String projectId) { public TestCaseTemplateDao getTemplate(@PathVariable String projectId) {
return testCaseTemplateService.getTemplate(projectId); return testCaseTemplateService.getTemplate(projectId);
} }

View File

@ -20,7 +20,7 @@ import java.util.List;
@RequestMapping("testresourcepool") @RequestMapping("testresourcepool")
@RestController @RestController
@RequiresRoles(RoleConstants.ADMIN)
public class TestResourcePoolController { public class TestResourcePoolController {
@Resource @Resource
@ -62,13 +62,13 @@ public class TestResourcePoolController {
} }
@GetMapping("list/all/valid") @GetMapping("list/all/valid")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<TestResourcePoolDTO> listValidResourcePools() { public List<TestResourcePoolDTO> listValidResourcePools() {
return testResourcePoolService.listValidResourcePools(); return testResourcePoolService.listValidResourcePools();
} }
@GetMapping("list/quota/valid") @GetMapping("list/quota/valid")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<TestResourcePoolDTO> listValidQuotaResourcePools() { public List<TestResourcePoolDTO> listValidQuotaResourcePools() {
return testResourcePoolService.listValidQuotaResourcePools(); return testResourcePoolService.listValidQuotaResourcePools();
} }

View File

@ -53,6 +53,8 @@ public class UserController {
private CheckPermissionService checkPermissionService; private CheckPermissionService checkPermissionService;
@PostMapping("/special/add") @PostMapping("/special/add")
@MsAuditLog(module = "system_user", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_user", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#user)", msClass = UserService.class) @MsAuditLog(module = "system_user", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#user)", msClass = UserService.class)
public UserDTO insertUser(@RequestBody UserRequest user) { public UserDTO insertUser(@RequestBody UserRequest user) {
@ -60,26 +62,26 @@ public class UserController {
} }
@PostMapping("/special/list/{goPage}/{pageSize}") @PostMapping("/special/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN)
public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody io.metersphere.controller.request.UserRequest request) { public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody io.metersphere.controller.request.UserRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request)); return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request));
} }
@GetMapping("/special/user/role/{userId}") @GetMapping("/special/user/role/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
public UserRoleDTO getUserRole(@PathVariable("userId") String userId) { public UserRoleDTO getUserRole(@PathVariable("userId") String userId) {
return userService.getUserRole(userId); return userService.getUserRole(userId);
} }
@GetMapping("/special/user/group/{userId}") @GetMapping("/special/user/group/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
public UserGroupPermissionDTO getUserGroup(@PathVariable("userId") String userId) { public UserGroupPermissionDTO getUserGroup(@PathVariable("userId") String userId) {
return userService.getUserGroup(userId); return userService.getUserGroup(userId);
} }
@GetMapping("/special/delete/{userId}") @GetMapping("/special/delete/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_user", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class) @MsAuditLog(module = "system_user", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class)
public void deleteUser(@PathVariable(value = "userId") String userId) { public void deleteUser(@PathVariable(value = "userId") String userId) {
userService.deleteUser(userId); userService.deleteUser(userId);
@ -88,69 +90,69 @@ public class UserController {
} }
@PostMapping("/special/update") @PostMapping("/special/update")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_user", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user)", content = "#msClass.getLogDetails(#user)", msClass = UserService.class) @MsAuditLog(module = "system_user", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
public void updateUser(@RequestBody UserRequest user) { public void updateUser(@RequestBody UserRequest user) {
userService.updateUserRole(user); userService.updateUserRole(user);
} }
@PostMapping("/special/update_status") @PostMapping("/special/update_status")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_user", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class) @MsAuditLog(module = "system_user", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
public void updateStatus(@RequestBody User user) { public void updateStatus(@RequestBody User user) {
userService.updateUser(user); userService.updateUser(user);
} }
@PostMapping("/special/ws/member/list/{goPage}/{pageSize}") @PostMapping("/special/ws/member/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN)
public Pager<List<User>> getMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) { public Pager<List<User>> getMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getMemberList(request)); return PageUtils.setPageInfo(page, userService.getMemberList(request));
} }
@PostMapping("/special/ws/member/list/all") @PostMapping("/special/ws/member/list/all")
@RequiresRoles(RoleConstants.ADMIN)
public List<User> getMemberListByAdmin(@RequestBody QueryMemberRequest request) { public List<User> getMemberListByAdmin(@RequestBody QueryMemberRequest request) {
return userService.getMemberList(request); return userService.getMemberList(request);
} }
@PostMapping("/special/ws/member/add") @PostMapping("/special/ws/member/add")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "workspace_member", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = WorkspaceService.class) @MsAuditLog(module = "workspace_member", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = WorkspaceService.class)
public void addMemberByAdmin(@RequestBody AddMemberRequest request) { public void addMemberByAdmin(@RequestBody AddMemberRequest request) {
userService.addMember(request); userService.addMember(request);
} }
@GetMapping("/special/ws/member/delete/{workspaceId}/{userId}") @GetMapping("/special/ws/member/delete/{workspaceId}/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "workspace_member", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class) @MsAuditLog(module = "workspace_member", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class)
public void deleteMemberByAdmin(@PathVariable String workspaceId, @PathVariable String userId) { public void deleteMemberByAdmin(@PathVariable String workspaceId, @PathVariable String userId) {
userService.deleteMember(workspaceId, userId); userService.deleteMember(workspaceId, userId);
} }
@PostMapping("/special/org/member/add") @PostMapping("/special/org/member/add")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = OrganizationService.class) @MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = OrganizationService.class)
public void addOrganizationMemberByAdmin(@RequestBody AddOrgMemberRequest request) { public void addOrganizationMemberByAdmin(@RequestBody AddOrgMemberRequest request) {
userService.addOrganizationMember(request); userService.addOrganizationMember(request);
} }
@GetMapping("/special/org/member/delete/{organizationId}/{userId}") @GetMapping("/special/org/member/delete/{organizationId}/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "organization_member", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class) @MsAuditLog(module = "organization_member", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class)
public void delOrganizationMemberByAdmin(@PathVariable String organizationId, @PathVariable String userId) { public void delOrganizationMemberByAdmin(@PathVariable String organizationId, @PathVariable String userId) {
userService.delOrganizationMember(organizationId, userId); userService.delOrganizationMember(organizationId, userId);
} }
@PostMapping("/special/org/member/list/{goPage}/{pageSize}") @PostMapping("/special/org/member/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN)
public Pager<List<User>> getOrgMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) { public Pager<List<User>> getOrgMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getOrgMemberList(request)); return PageUtils.setPageInfo(page, userService.getOrgMemberList(request));
} }
@PostMapping("/special/org/member/list/all") @PostMapping("/special/org/member/list/all")
@RequiresRoles(RoleConstants.ADMIN)
public List<User> getOrgMemberListByAdmin(@RequestBody QueryOrgMemberRequest request) { public List<User> getOrgMemberListByAdmin(@RequestBody QueryOrgMemberRequest request) {
return userService.getOrgMemberList(request); return userService.getOrgMemberList(request);
} }
@ -174,14 +176,12 @@ public class UserController {
} }
@PostMapping("/switch/source/org/{sourceId}") @PostMapping("/switch/source/org/{sourceId}")
@RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER, RoleConstants.TEST_USER}, logical = Logical.OR)
public UserDTO switchOrganization(@PathVariable(value = "sourceId") String sourceId) { public UserDTO switchOrganization(@PathVariable(value = "sourceId") String sourceId) {
userService.switchUserRole("organization", sourceId); userService.switchUserRole("organization", sourceId);
return SessionUtils.getUser(); return SessionUtils.getUser();
} }
@PostMapping("/switch/source/ws/{sourceId}") @PostMapping("/switch/source/ws/{sourceId}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER, RoleConstants.TEST_USER}, logical = Logical.OR)
public UserDTO switchWorkspace(@PathVariable(value = "sourceId") String sourceId) { public UserDTO switchWorkspace(@PathVariable(value = "sourceId") String sourceId) {
userService.switchUserRole("workspace", sourceId); userService.switchUserRole("workspace", sourceId);
return SessionUtils.getUser(); return SessionUtils.getUser();
@ -205,8 +205,6 @@ public class UserController {
* 获取工作空间成员用户 * 获取工作空间成员用户
*/ */
@PostMapping("/ws/member/list/{goPage}/{pageSize}") @PostMapping("/ws/member/list/{goPage}/{pageSize}")
@RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER,
RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public Pager<List<User>> getMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) { public Pager<List<User>> getMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getMemberList(request)); return PageUtils.setPageInfo(page, userService.getMemberList(request));
@ -222,8 +220,6 @@ public class UserController {
* 获取工作空间成员用户 不分页 * 获取工作空间成员用户 不分页
*/ */
@PostMapping("/ws/member/list/all") @PostMapping("/ws/member/list/all")
@RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER,
RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<User> getMemberList(@RequestBody QueryMemberRequest request) { public List<User> getMemberList(@RequestBody QueryMemberRequest request) {
return userService.getMemberList(request); return userService.getMemberList(request);
} }
@ -232,7 +228,6 @@ public class UserController {
* 添加工作空间成员 * 添加工作空间成员
*/ */
@PostMapping("/ws/member/add") @PostMapping("/ws/member/add")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
@MsAuditLog(module = "workspace_member", type = OperLogConstants.CREATE, title = "添加工作空间成员") @MsAuditLog(module = "workspace_member", type = OperLogConstants.CREATE, title = "添加工作空间成员")
public void addMember(@RequestBody AddMemberRequest request) { public void addMember(@RequestBody AddMemberRequest request) {
String wsId = request.getWorkspaceId(); String wsId = request.getWorkspaceId();
@ -251,7 +246,6 @@ public class UserController {
* 删除工作空间成员 * 删除工作空间成员
*/ */
@GetMapping("/ws/member/delete/{workspaceId}/{userId}") @GetMapping("/ws/member/delete/{workspaceId}/{userId}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
@MsAuditLog(module = "workspace_member", type = OperLogConstants.DELETE, title = "删除工作空间成员") @MsAuditLog(module = "workspace_member", type = OperLogConstants.DELETE, title = "删除工作空间成员")
public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) { public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) {
// workspaceService.checkWorkspaceOwner(workspaceId); // workspaceService.checkWorkspaceOwner(workspaceId);
@ -277,8 +271,7 @@ public class UserController {
* 添加组织成员 * 添加组织成员
*/ */
@PostMapping("/org/member/add") @PostMapping("/org/member/add")
@RequiresRoles(RoleConstants.ORG_ADMIN) @MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, title = "添加组织成员")
@MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, title = "'添加组织成员-'+#request.userIds")
public void addOrganizationMember(@RequestBody AddOrgMemberRequest request) { public void addOrganizationMember(@RequestBody AddOrgMemberRequest request) {
organizationService.checkOrgOwner(request.getOrganizationId()); organizationService.checkOrgOwner(request.getOrganizationId());
userService.addOrganizationMember(request); userService.addOrganizationMember(request);
@ -288,7 +281,6 @@ public class UserController {
* 删除组织成员 * 删除组织成员
*/ */
@GetMapping("/org/member/delete/{organizationId}/{userId}") @GetMapping("/org/member/delete/{organizationId}/{userId}")
@RequiresRoles(RoleConstants.ORG_ADMIN)
@MsAuditLog(module = "organization_member", type = OperLogConstants.DELETE, title = "删除组织成员") @MsAuditLog(module = "organization_member", type = OperLogConstants.DELETE, title = "删除组织成员")
public void delOrganizationMember(@PathVariable String organizationId, @PathVariable String userId) { public void delOrganizationMember(@PathVariable String organizationId, @PathVariable String userId) {
organizationService.checkOrgOwner(organizationId); organizationService.checkOrgOwner(organizationId);
@ -303,7 +295,7 @@ public class UserController {
* 查询组织成员列表 * 查询组织成员列表
*/ */
@PostMapping("/org/member/list/{goPage}/{pageSize}") @PostMapping("/org/member/list/{goPage}/{pageSize}")
@RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public Pager<List<User>> getOrgMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) { public Pager<List<User>> getOrgMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getOrgMemberList(request)); return PageUtils.setPageInfo(page, userService.getOrgMemberList(request));
@ -313,7 +305,7 @@ public class UserController {
* 组织成员列表不分页 * 组织成员列表不分页
*/ */
@PostMapping("/org/member/list/all") @PostMapping("/org/member/list/all")
@RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<User> getOrgMemberList(@RequestBody QueryOrgMemberRequest request) { public List<User> getOrgMemberList(@RequestBody QueryOrgMemberRequest request) {
return userService.getOrgMemberList(request); return userService.getOrgMemberList(request);
} }
@ -343,33 +335,31 @@ public class UserController {
* 获取工作空间成员用户 不分页 * 获取工作空间成员用户 不分页
*/ */
@PostMapping("/ws/member/tester/list") @PostMapping("/ws/member/tester/list")
@RequiresRoles(value = {RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER,
RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<User> getTestManagerAndTestUserList(@RequestBody QueryMemberRequest request) { public List<User> getTestManagerAndTestUserList(@RequestBody QueryMemberRequest request) {
return userService.getTestManagerAndTestUserList(request); return userService.getTestManagerAndTestUserList(request);
} }
@GetMapping("/search/{condition}") @GetMapping("/search/{condition}")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<User> searchUser(@PathVariable String condition) { public List<User> searchUser(@PathVariable String condition) {
return userService.searchUser(condition); return userService.searchUser(condition);
} }
@GetMapping("/export/template") @GetMapping("/export/template")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void testCaseTemplateExport(HttpServletResponse response) { public void testCaseTemplateExport(HttpServletResponse response) {
userService.userTemplateExport(response); userService.userTemplateExport(response);
} }
@PostMapping("/import/{userId}") @PostMapping("/import/{userId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "system_user", type = OperLogConstants.IMPORT) public ExcelResponse testCaseImport(MultipartFile file, @PathVariable String userId) {
public ExcelResponse testCaseImport(MultipartFile file, @PathVariable String userId, HttpServletRequest request) { return userService.userImport(file, userId);
return userService.userImport(file, userId,request);
} }
@PostMapping("/special/batchProcessUserInfo") @PostMapping("/special/batchProcessUserInfo")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER})
@MsAuditLog(module = "system_user", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request)", content = "#msClass.getLogDetails(#request)", msClass = UserService.class) @MsAuditLog(module = "system_user", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request)", content = "#msClass.getLogDetails(#request)", msClass = UserService.class)
public String batchProcessUserInfo(@RequestBody UserBatchProcessRequest request) { public String batchProcessUserInfo(@RequestBody UserBatchProcessRequest request) {
String returnString = "success"; String returnString = "success";

View File

@ -21,7 +21,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("user/key") @RequestMapping("user/key")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public class UserKeysController { public class UserKeysController {
@Resource @Resource

View File

@ -22,19 +22,19 @@ public class UserRoleController {
private UserRoleService userRoleService; private UserRoleService userRoleService;
@GetMapping("/list/org/{orgId}/{userId}") @GetMapping("/list/org/{orgId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public List<Role> getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) { public List<Role> getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) {
return userRoleService.getOrganizationMemberRoles(orgId, userId); return userRoleService.getOrganizationMemberRoles(orgId, userId);
} }
@GetMapping("/list/ws/{workspaceId}/{userId}") @GetMapping("/list/ws/{workspaceId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) { public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) {
return userRoleService.getWorkspaceMemberRoles(workspaceId, userId); return userRoleService.getWorkspaceMemberRoles(workspaceId, userId);
} }
@GetMapping("/all/{userId}") @GetMapping("/all/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
public List<Map<String, Object>> getUserRole(@PathVariable("userId") String userId) { public List<Map<String, Object>> getUserRole(@PathVariable("userId") String userId) {
return userRoleService.getUserRole(userId); return userRoleService.getUserRole(userId);
} }

View File

@ -33,7 +33,7 @@ public class WorkspaceController {
private UserService userService; private UserService userService;
@PostMapping("add") @PostMapping("add")
@RequiresRoles(RoleConstants.ORG_ADMIN)
@MsAuditLog(module = "system_workspace", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class) @MsAuditLog(module = "system_workspace", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class)
public Workspace addWorkspace(@RequestBody Workspace workspace) { public Workspace addWorkspace(@RequestBody Workspace workspace) {
String currentOrganizationId = SessionUtils.getCurrentOrganizationId(); String currentOrganizationId = SessionUtils.getCurrentOrganizationId();
@ -47,14 +47,14 @@ public class WorkspaceController {
} }
@PostMapping("special/add") @PostMapping("special/add")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_workspace", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class) @MsAuditLog(module = "system_workspace", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class)
public Workspace addWorkspaceByAdmin(@RequestBody Workspace workspace) { public Workspace addWorkspaceByAdmin(@RequestBody Workspace workspace) {
return workspaceService.addWorkspaceByAdmin(workspace); return workspaceService.addWorkspaceByAdmin(workspace);
} }
@PostMapping("update") @PostMapping("update")
@RequiresRoles(RoleConstants.ORG_ADMIN)
@MsAuditLog(module = "system_workspace", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#workspace.id)", content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class) @MsAuditLog(module = "system_workspace", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#workspace.id)", content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class)
public Workspace updateWorkspace(@RequestBody Workspace workspace) { public Workspace updateWorkspace(@RequestBody Workspace workspace) {
// workspaceService.checkWorkspaceOwnerByOrgAdmin(workspace.getId()); // workspaceService.checkWorkspaceOwnerByOrgAdmin(workspace.getId());
@ -62,14 +62,14 @@ public class WorkspaceController {
} }
@PostMapping("special/update") @PostMapping("special/update")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_workspace", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#workspace.id)", content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class) @MsAuditLog(module = "system_workspace", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#workspace.id)", content = "#msClass.getLogDetails(#workspace.id)", msClass = WorkspaceService.class)
public void updateWorkspaceByAdmin(@RequestBody Workspace workspace) { public void updateWorkspaceByAdmin(@RequestBody Workspace workspace) {
workspaceService.updateWorkspaceByAdmin(workspace); workspaceService.updateWorkspaceByAdmin(workspace);
} }
@GetMapping("special/delete/{workspaceId}") @GetMapping("special/delete/{workspaceId}")
@RequiresRoles(RoleConstants.ADMIN)
@MsAuditLog(module = "system_workspace", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#workspaceId)", msClass = WorkspaceService.class) @MsAuditLog(module = "system_workspace", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#workspaceId)", msClass = WorkspaceService.class)
public void deleteWorkspaceByAdmin(@PathVariable String workspaceId) { public void deleteWorkspaceByAdmin(@PathVariable String workspaceId) {
userService.refreshSessionUser("workspace", workspaceId); userService.refreshSessionUser("workspace", workspaceId);
@ -77,7 +77,7 @@ public class WorkspaceController {
} }
@GetMapping("delete/{workspaceId}") @GetMapping("delete/{workspaceId}")
@RequiresRoles(RoleConstants.ORG_ADMIN)
@MsAuditLog(module = "system_workspace", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#workspaceId)", msClass = WorkspaceService.class) @MsAuditLog(module = "system_workspace", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#workspaceId)", msClass = WorkspaceService.class)
public void deleteWorkspace(@PathVariable String workspaceId) { public void deleteWorkspace(@PathVariable String workspaceId) {
// workspaceService.checkWorkspaceOwnerByOrgAdmin(workspaceId); // workspaceService.checkWorkspaceOwnerByOrgAdmin(workspaceId);
@ -86,7 +86,7 @@ public class WorkspaceController {
} }
@PostMapping("list/{goPage}/{pageSize}") @PostMapping("list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ORG_ADMIN)
public Pager<List<Workspace>> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody WorkspaceRequest request) { public Pager<List<Workspace>> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody WorkspaceRequest request) {
request.setOrganizationId(SessionUtils.getCurrentOrganizationId()); request.setOrganizationId(SessionUtils.getCurrentOrganizationId());
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
@ -94,7 +94,7 @@ public class WorkspaceController {
} }
@PostMapping("list/all/{goPage}/{pageSize}") @PostMapping("list/all/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN)
public Pager<List<WorkspaceDTO>> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody WorkspaceRequest request) { public Pager<List<WorkspaceDTO>> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody WorkspaceRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList(request)); return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList(request));
@ -112,8 +112,8 @@ public class WorkspaceController {
} }
@PostMapping("/member/update") @PostMapping("/member/update")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = WorkspaceService.class) @MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, title = "#memberDTO.name")
public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) { public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) {
workspaceService.updateWorkspaceMember(memberDTO); workspaceService.updateWorkspaceMember(memberDTO);
} }

View File

@ -18,7 +18,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/operating/log") @RequestMapping(value = "/operating/log")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class OperatingLogController { public class OperatingLogController {
@Resource @Resource
private OperatingLogService operatingLogService; private OperatingLogService operatingLogService;

View File

@ -1,13 +1,10 @@
package io.metersphere.track.controller; package io.metersphere.track.controller;
import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.dto.TestCaseCommentDTO; import io.metersphere.track.dto.TestCaseCommentDTO;
import io.metersphere.track.request.testreview.SaveCommentRequest; import io.metersphere.track.request.testreview.SaveCommentRequest;
import io.metersphere.track.service.TestCaseCommentService; import io.metersphere.track.service.TestCaseCommentService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -34,7 +31,6 @@ public class TestCaseCommentController {
} }
@GetMapping("/delete/{commentId}") @GetMapping("/delete/{commentId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#commentId)", msClass = TestCaseCommentService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#commentId)", msClass = TestCaseCommentService.class)
public void deleteComment(@PathVariable String commentId) { public void deleteComment(@PathVariable String commentId) {
testCaseCommentService.delete(commentId); testCaseCommentService.delete(commentId);

View File

@ -38,7 +38,7 @@ import java.util.UUID;
@RequestMapping("/test/case") @RequestMapping("/test/case")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public class TestCaseController { public class TestCaseController {
@Resource @Resource
@ -127,7 +127,7 @@ public class TestCaseController {
} }
@PostMapping(value = "/add", consumes = {"multipart/form-data"}) @PostMapping(value = "/add", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class)
public String addTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) { public String addTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) {
request.setId(UUID.randomUUID().toString()); request.setId(UUID.randomUUID().toString());
@ -135,21 +135,21 @@ public class TestCaseController {
} }
@PostMapping(value = "/edit", consumes = {"multipart/form-data"}) @PostMapping(value = "/edit", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class)
public String editTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) { public String editTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) {
return testCaseService.edit(request, files); return testCaseService.edit(request, files);
} }
@PostMapping(value = "/edit/testPlan", consumes = {"multipart/form-data"}) @PostMapping(value = "/edit/testPlan", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogBeforeDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogBeforeDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class)
public String editTestCaseByTestPlan(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) { public String editTestCaseByTestPlan(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) {
return testCaseService.editTestCase(request, files); return testCaseService.editTestCase(request, files);
} }
@PostMapping("/delete/{testCaseId}") @PostMapping("/delete/{testCaseId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testCaseId)", msClass = TestCaseService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testCaseId)", msClass = TestCaseService.class)
public int deleteTestCase(@PathVariable String testCaseId) { public int deleteTestCase(@PathVariable String testCaseId) {
checkPermissionService.checkTestCaseOwner(testCaseId); checkPermissionService.checkTestCaseOwner(testCaseId);
@ -157,7 +157,7 @@ public class TestCaseController {
} }
@PostMapping("/import/{projectId}/{userId}") @PostMapping("/import/{projectId}/{userId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.IMPORT, project = "#projectId") @MsAuditLog(module = "track_test_case", type = OperLogConstants.IMPORT, project = "#projectId")
public ExcelResponse testCaseImport(MultipartFile file, @PathVariable String projectId, @PathVariable String userId, HttpServletRequest request) { public ExcelResponse testCaseImport(MultipartFile file, @PathVariable String projectId, @PathVariable String userId, HttpServletRequest request) {
checkPermissionService.checkProjectOwner(projectId); checkPermissionService.checkProjectOwner(projectId);
@ -165,7 +165,7 @@ public class TestCaseController {
} }
@PostMapping("/importIgnoreError/{projectId}/{userId}") @PostMapping("/importIgnoreError/{projectId}/{userId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.IMPORT, project = "#projectId") @MsAuditLog(module = "track_test_case", type = OperLogConstants.IMPORT, project = "#projectId")
public ExcelResponse testCaseImportIgnoreError(MultipartFile file, @PathVariable String projectId, @PathVariable String userId, HttpServletRequest request) { public ExcelResponse testCaseImportIgnoreError(MultipartFile file, @PathVariable String projectId, @PathVariable String userId, HttpServletRequest request) {
checkPermissionService.checkProjectOwner(projectId); checkPermissionService.checkProjectOwner(projectId);
@ -173,33 +173,33 @@ public class TestCaseController {
} }
@GetMapping("/export/template") @GetMapping("/export/template")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void testCaseTemplateExport(HttpServletResponse response) { public void testCaseTemplateExport(HttpServletResponse response) {
testCaseService.testCaseTemplateExport(response); testCaseService.testCaseTemplateExport(response);
} }
@GetMapping("/export/xmindTemplate") @GetMapping("/export/xmindTemplate")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void xmindTemplate(HttpServletResponse response) { public void xmindTemplate(HttpServletResponse response) {
testCaseService.testCaseXmindTemplateExport(response); testCaseService.testCaseXmindTemplateExport(response);
} }
@PostMapping("/export/testcase") @PostMapping("/export/testcase")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.EXPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId") @MsAuditLog(module = "track_test_case", type = OperLogConstants.EXPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId")
public void testCaseExport(HttpServletResponse response, @RequestBody TestCaseBatchRequest request) { public void testCaseExport(HttpServletResponse response, @RequestBody TestCaseBatchRequest request) {
testCaseService.testCaseExport(response, request); testCaseService.testCaseExport(response, request);
} }
@PostMapping("/batch/edit") @PostMapping("/batch/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class)
public void editTestCaseBath(@RequestBody TestCaseBatchRequest request) { public void editTestCaseBath(@RequestBody TestCaseBatchRequest request) {
testCaseService.editTestCaseBath(request); testCaseService.editTestCaseBath(request);
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class)
public void deleteTestCaseBath(@RequestBody TestCaseBatchRequest request) { public void deleteTestCaseBath(@RequestBody TestCaseBatchRequest request) {
testCaseService.deleteTestCaseBath(request); testCaseService.deleteTestCaseBath(request);
@ -236,7 +236,7 @@ public class TestCaseController {
} }
@PostMapping("/minder/edit") @PostMapping("/minder/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_UPDATE, project = "#request.projectId", beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.BATCH_UPDATE, project = "#request.projectId", beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestCaseService.class)
public void minderEdit(@RequestBody TestCaseMinderEditRequest request) { public void minderEdit(@RequestBody TestCaseMinderEditRequest request) {
testCaseService.minderEdit(request); testCaseService.minderEdit(request);

View File

@ -19,7 +19,6 @@ import java.util.List;
@RequestMapping("/case/node") @RequestMapping("/case/node")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public class TestCaseNodeController { public class TestCaseNodeController {
@Resource @Resource
@ -72,21 +71,18 @@ public class TestCaseNodeController {
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.CREATE, title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = TestCaseNodeService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.CREATE, title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = TestCaseNodeService.class)
public String addNode(@RequestBody TestCaseNode node) { public String addNode(@RequestBody TestCaseNode node) {
return testCaseNodeService.addNode(node); return testCaseNodeService.addNode(node);
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = TestCaseNodeService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = TestCaseNodeService.class)
public int editNode(@RequestBody DragNodeRequest node) { public int editNode(@RequestBody DragNodeRequest node) {
return testCaseNodeService.editNode(node); return testCaseNodeService.editNode(node);
} }
@PostMapping("/delete") @PostMapping("/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#nodeIds)", msClass = TestCaseNodeService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#nodeIds)", msClass = TestCaseNodeService.class)
public int deleteNode(@RequestBody List<String> nodeIds) { public int deleteNode(@RequestBody List<String> nodeIds) {
//nodeIds 包含删除节点ID及其所有子节点ID //nodeIds 包含删除节点ID及其所有子节点ID
@ -94,7 +90,6 @@ public class TestCaseNodeController {
} }
@PostMapping("/drag") @PostMapping("/drag")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = TestCaseNodeService.class) @MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#node)", title = "#node.name", content = "#msClass.getLogDetails(#node)", msClass = TestCaseNodeService.class)
public void dragNode(@RequestBody DragNodeRequest node) { public void dragNode(@RequestBody DragNodeRequest node) {
testCaseNodeService.dragNode(node); testCaseNodeService.dragNode(node);

View File

@ -32,7 +32,7 @@ public class TestCaseReportController {
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseReportService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseReportService.class)
public String addByTemplateId(@RequestBody CreateReportRequest request) { public String addByTemplateId(@RequestBody CreateReportRequest request) {
request.setId(UUID.randomUUID().toString()); request.setId(UUID.randomUUID().toString());
@ -40,14 +40,14 @@ public class TestCaseReportController {
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#TestCaseReport.id)", content = "#msClass.getLogDetails(#TestCaseReport.id)", msClass = TestCaseReportService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#TestCaseReport.id)", content = "#msClass.getLogDetails(#TestCaseReport.id)", msClass = TestCaseReportService.class)
public void edit(@RequestBody TestCaseReport TestCaseReport) { public void edit(@RequestBody TestCaseReport TestCaseReport) {
testCaseReportService.editTestCaseReport(TestCaseReport); testCaseReportService.editTestCaseReport(TestCaseReport);
} }
@PostMapping("/delete/{id}") @PostMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseReportService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseReportService.class)
public int delete(@PathVariable String id) { public int delete(@PathVariable String id) {
return testCaseReportService.deleteTestCaseReport(id); return testCaseReportService.deleteTestCaseReport(id);

View File

@ -31,21 +31,21 @@ public class TestCaseReportTemplateController {
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, title = "#testCaseReportTemplate.name",sourceId = "#testCaseReportTemplate.id") @MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, title = "#testCaseReportTemplate.name",sourceId = "#testCaseReportTemplate.id")
public void add(@RequestBody TestCaseReportTemplate testCaseReportTemplate) { public void add(@RequestBody TestCaseReportTemplate testCaseReportTemplate) {
testCaseReportTemplateService.addTestCaseReportTemplate(testCaseReportTemplate); testCaseReportTemplateService.addTestCaseReportTemplate(testCaseReportTemplate);
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, title = "#testCaseReportTemplate.name",sourceId = "#testCaseReportTemplate.id") @MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, title = "#testCaseReportTemplate.name",sourceId = "#testCaseReportTemplate.id")
public void edit(@RequestBody TestCaseReportTemplate testCaseReportTemplate) { public void edit(@RequestBody TestCaseReportTemplate testCaseReportTemplate) {
testCaseReportTemplateService.editTestCaseReportTemplate(testCaseReportTemplate); testCaseReportTemplateService.editTestCaseReportTemplate(testCaseReportTemplate);
} }
@PostMapping("/delete/{id}") @PostMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseReportTemplateService.class) @MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseReportTemplateService.class)
public int delete(@PathVariable String id) { public int delete(@PathVariable String id) {
return testCaseReportTemplateService.deleteTestCaseReportTemplate(id); return testCaseReportTemplateService.deleteTestCaseReportTemplate(id);

View File

@ -37,19 +37,19 @@ public class TestCaseReviewApiCaseController {
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public int deleteTestCase(@PathVariable String id) { public int deleteTestCase(@PathVariable String id) {
return testCaseReviewApiCaseService.delete(id); return testCaseReviewApiCaseService.delete(id);
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void deleteApiCaseBath(@RequestBody TestReviewApiCaseBatchRequest request) { public void deleteApiCaseBath(@RequestBody TestReviewApiCaseBatchRequest request) {
testCaseReviewApiCaseService.deleteApiCaseBath(request); testCaseReviewApiCaseService.deleteApiCaseBath(request);
} }
@PostMapping("/batch/update/env") @PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void batchUpdateEnv(@RequestBody TestPlanApiCaseBatchRequest request) { public void batchUpdateEnv(@RequestBody TestPlanApiCaseBatchRequest request) {
testCaseReviewApiCaseService.batchUpdateEnv(request); testCaseReviewApiCaseService.batchUpdateEnv(request);
} }

View File

@ -30,7 +30,7 @@ import java.util.UUID;
@RequestMapping("/test/case/review") @RequestMapping("/test/case/review")
@RestController @RestController
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class TestCaseReviewController { public class TestCaseReviewController {
@Resource @Resource
@ -47,7 +47,7 @@ public class TestCaseReviewController {
} }
@PostMapping("/save") @PostMapping("/save")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.CREATE, title = "#reviewRequest.name", content = "#msClass.getLogDetails(#reviewRequest.id)", msClass = TestCaseReviewService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.CREATE, title = "#reviewRequest.name", content = "#msClass.getLogDetails(#reviewRequest.id)", msClass = TestCaseReviewService.class)
public String saveCaseReview(@RequestBody SaveTestCaseReviewRequest reviewRequest) { public String saveCaseReview(@RequestBody SaveTestCaseReviewRequest reviewRequest) {
reviewRequest.setId(UUID.randomUUID().toString()); reviewRequest.setId(UUID.randomUUID().toString());
@ -72,14 +72,14 @@ public class TestCaseReviewController {
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testCaseReview.id)", title = "#testCaseReview.name", content = "#msClass.getLogDetails(#testCaseReview.id)", msClass = TestCaseReviewService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testCaseReview.id)", title = "#testCaseReview.name", content = "#msClass.getLogDetails(#testCaseReview.id)", msClass = TestCaseReviewService.class)
public String editCaseReview(@RequestBody SaveTestCaseReviewRequest testCaseReview) { public String editCaseReview(@RequestBody SaveTestCaseReviewRequest testCaseReview) {
return testCaseReviewService.editCaseReview(testCaseReview); return testCaseReviewService.editCaseReview(testCaseReview);
} }
@GetMapping("/delete/{reviewId}") @GetMapping("/delete/{reviewId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#reviewId)", msClass = TestCaseReviewService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#reviewId)", msClass = TestCaseReviewService.class)
public void deleteCaseReview(@PathVariable String reviewId) { public void deleteCaseReview(@PathVariable String reviewId) {
checkPermissionService.checkTestReviewOwner(reviewId); checkPermissionService.checkTestReviewOwner(reviewId);
@ -120,7 +120,7 @@ public class TestCaseReviewController {
} }
@PostMapping("/edit/status/{reviewId}") @PostMapping("/edit/status/{reviewId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestPlanStatus(@PathVariable String reviewId) { public void editTestPlanStatus(@PathVariable String reviewId) {
checkPermissionService.checkTestReviewOwner(reviewId); checkPermissionService.checkTestReviewOwner(reviewId);
testCaseReviewService.editTestReviewStatus(reviewId); testCaseReviewService.editTestReviewStatus(reviewId);

View File

@ -38,13 +38,13 @@ public class TestCaseReviewScenarioCaseController {
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public int deleteTestCase(@PathVariable String id) { public int deleteTestCase(@PathVariable String id) {
return testCaseReviewScenarioCaseService.delete(id); return testCaseReviewScenarioCaseService.delete(id);
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void deleteApiCaseBath(@RequestBody TestPlanApiCaseBatchRequest request) { public void deleteApiCaseBath(@RequestBody TestPlanApiCaseBatchRequest request) {
testCaseReviewScenarioCaseService.deleteApiCaseBath(request); testCaseReviewScenarioCaseService.deleteApiCaseBath(request);
} }
@ -56,7 +56,7 @@ public class TestCaseReviewScenarioCaseController {
} }
@PostMapping("/batch/update/env") @PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) { public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) {
testCaseReviewScenarioCaseService.batchUpdateEnv(request); testCaseReviewScenarioCaseService.batchUpdateEnv(request);
} }

View File

@ -44,21 +44,21 @@ public class TestPlanApiCaseController {
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanApiCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanApiCaseService.class)
public int deleteTestCase(@PathVariable String id) { public int deleteTestCase(@PathVariable String id) {
return testPlanApiCaseService.delete(id); return testPlanApiCaseService.delete(id);
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanApiCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanApiCaseService.class)
public void deleteApiCaseBath(@RequestBody TestPlanApiCaseBatchRequest request) { public void deleteApiCaseBath(@RequestBody TestPlanApiCaseBatchRequest request) {
testPlanApiCaseService.deleteApiCaseBath(request); testPlanApiCaseService.deleteApiCaseBath(request);
} }
@PostMapping("/batch/update/env") @PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanApiCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanApiCaseService.class)
public void batchUpdateEnv(@RequestBody TestPlanApiCaseBatchRequest request) { public void batchUpdateEnv(@RequestBody TestPlanApiCaseBatchRequest request) {
testPlanApiCaseService.batchUpdateEnv(request); testPlanApiCaseService.batchUpdateEnv(request);

View File

@ -86,7 +86,7 @@ public class TestPlanController {
} }
@PostMapping("/add") @PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.CREATE, title = "#testPlan.name", content = "#msClass.getLogDetails(#testPlan.id)", msClass = TestPlanService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.CREATE, title = "#testPlan.name", content = "#msClass.getLogDetails(#testPlan.id)", msClass = TestPlanService.class)
public String addTestPlan(@RequestBody AddTestPlanRequest testPlan) { public String addTestPlan(@RequestBody AddTestPlanRequest testPlan) {
testPlan.setId(UUID.randomUUID().toString()); testPlan.setId(UUID.randomUUID().toString());
@ -95,14 +95,14 @@ public class TestPlanController {
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testPlanDTO.id)", content = "#msClass.getLogDetails(#testPlanDTO.id)", msClass = TestPlanService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testPlanDTO.id)", content = "#msClass.getLogDetails(#testPlanDTO.id)", msClass = TestPlanService.class)
public String editTestPlan(@RequestBody TestPlanDTO testPlanDTO) { public String editTestPlan(@RequestBody TestPlanDTO testPlanDTO) {
return testPlanService.editTestPlan(testPlanDTO, true); return testPlanService.editTestPlan(testPlanDTO, true);
} }
@PostMapping("/edit/status/{planId}") @PostMapping("/edit/status/{planId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#planId)", content = "#msClass.getLogDetails(#planId)", msClass = TestPlanService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#planId)", content = "#msClass.getLogDetails(#planId)", msClass = TestPlanService.class)
public void editTestPlanStatus(@PathVariable String planId) { public void editTestPlanStatus(@PathVariable String planId) {
checkPermissionService.checkTestPlanOwner(planId); checkPermissionService.checkTestPlanOwner(planId);
@ -110,7 +110,7 @@ public class TestPlanController {
} }
@PostMapping("/delete/{testPlanId}") @PostMapping("/delete/{testPlanId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanId)", msClass = TestPlanService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanId)", msClass = TestPlanService.class)
public int deleteTestPlan(@PathVariable String testPlanId) { public int deleteTestPlan(@PathVariable String testPlanId) {
checkPermissionService.checkTestPlanOwner(testPlanId); checkPermissionService.checkTestPlanOwner(testPlanId);

View File

@ -46,14 +46,14 @@ public class TestPlanScenarioCaseController {
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanScenarioCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanScenarioCaseService.class)
public int deleteTestCase(@PathVariable String id) { public int deleteTestCase(@PathVariable String id) {
return testPlanScenarioCaseService.delete(id); return testPlanScenarioCaseService.delete(id);
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanScenarioCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanScenarioCaseService.class)
public void deleteApiCaseBath(@RequestBody TestPlanScenarioCaseBatchRequest request) { public void deleteApiCaseBath(@RequestBody TestPlanScenarioCaseBatchRequest request) {
testPlanScenarioCaseService.deleteApiCaseBath(request); testPlanScenarioCaseService.deleteApiCaseBath(request);
@ -76,7 +76,7 @@ public class TestPlanScenarioCaseController {
} }
@PostMapping("/batch/update/env") @PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanScenarioCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanScenarioCaseService.class)
public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) { public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) {
testPlanScenarioCaseService.batchUpdateEnv(request); testPlanScenarioCaseService.batchUpdateEnv(request);

View File

@ -106,35 +106,35 @@ public class TestPlanTestCaseController {
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#testPlanTestCase.id)", msClass = TestPlanTestCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#testPlanTestCase.id)", msClass = TestPlanTestCaseService.class)
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) { public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {
testPlanTestCaseService.editTestCase(testPlanTestCase); testPlanTestCaseService.editTestCase(testPlanTestCase);
} }
@PostMapping("/minder/edit") @PostMapping("/minder/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getCaseLogDetails(#testPlanTestCases)", msClass = TestPlanTestCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getCaseLogDetails(#testPlanTestCases)", msClass = TestPlanTestCaseService.class)
public void editTestCaseForMinder(@RequestBody List<TestPlanTestCaseWithBLOBs> testPlanTestCases) { public void editTestCaseForMinder(@RequestBody List<TestPlanTestCaseWithBLOBs> testPlanTestCases) {
testPlanTestCaseService.editTestCaseForMinder(testPlanTestCases); testPlanTestCaseService.editTestCaseForMinder(testPlanTestCases);
} }
@PostMapping("/batch/edit") @PostMapping("/batch/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanTestCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanTestCaseService.class)
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) { public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
testPlanTestCaseService.editTestCaseBath(request); testPlanTestCaseService.editTestCaseBath(request);
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanTestCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanTestCaseService.class)
public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) { public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
testPlanTestCaseService.deleteTestCaseBath(request); testPlanTestCaseService.deleteTestCaseBath(request);
} }
@PostMapping("/delete/{id}") @PostMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanTestCaseService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanTestCaseService.class)
public int deleteTestCase(@PathVariable String id) { public int deleteTestCase(@PathVariable String id) {
return testPlanTestCaseService.deleteTestCase(id); return testPlanTestCaseService.deleteTestCase(id);

View File

@ -34,28 +34,28 @@ public class TestReviewTestCaseController {
} }
@PostMapping("/delete") @PostMapping("/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class)
public int deleteTestCase(@RequestBody DeleteRelevanceRequest request) { public int deleteTestCase(@RequestBody DeleteRelevanceRequest request) {
return testReviewTestCaseService.deleteTestCase(request); return testReviewTestCaseService.deleteTestCase(request);
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class)
public void deleteTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) { public void deleteTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) {
testReviewTestCaseService.deleteTestCaseBatch(request); testReviewTestCaseService.deleteTestCaseBatch(request);
} }
@PostMapping("/batch/edit/status") @PostMapping("/batch/edit/status")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request)", content = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request)", content = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class)
public void editTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) { public void editTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) {
testReviewTestCaseService.editTestCaseBatchStatus(request); testReviewTestCaseService.editTestCaseBatchStatus(request);
} }
@PostMapping("/minder/edit") @PostMapping("/minder/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#testCases)", msClass = TestReviewTestCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#testCases)", msClass = TestReviewTestCaseService.class)
public void editTestCaseForMinder(@RequestBody List<TestCaseReviewTestCase> testCases) { public void editTestCaseForMinder(@RequestBody List<TestCaseReviewTestCase> testCases) {
testReviewTestCaseService.editTestCaseForMinder(testCases); testReviewTestCaseService.editTestCaseForMinder(testCases);
@ -67,20 +67,20 @@ public class TestReviewTestCaseController {
} }
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.REVIEW, content = "#msClass.getLogDetails(#testCaseReviewTestCase)", msClass = TestReviewTestCaseService.class) @MsAuditLog(module = "track_test_case_review", type = OperLogConstants.REVIEW, content = "#msClass.getLogDetails(#testCaseReviewTestCase)", msClass = TestReviewTestCaseService.class)
public void editTestCase(@RequestBody TestCaseReviewTestCase testCaseReviewTestCase) { public void editTestCase(@RequestBody TestCaseReviewTestCase testCaseReviewTestCase) {
testReviewTestCaseService.editTestCase(testCaseReviewTestCase); testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
} }
@GetMapping("/get/{reviewId}") @GetMapping("/get/{reviewId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public TestReviewCaseDTO get(@PathVariable String reviewId) { public TestReviewCaseDTO get(@PathVariable String reviewId) {
return testReviewTestCaseService.get(reviewId); return testReviewTestCaseService.get(reviewId);
} }
@PostMapping("/list/ids") @PostMapping("/list/ids")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<TestReviewCaseDTO> getTestReviewCaseList(@RequestBody QueryCaseReviewRequest request) { public List<TestReviewCaseDTO> getTestReviewCaseList(@RequestBody QueryCaseReviewRequest request) {
return testReviewTestCaseService.getTestCaseReviewDTOList(request); return testReviewTestCaseService.getTestCaseReviewDTOList(request);
} }

View File

@ -22,7 +22,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/track") @RequestMapping("/track")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public class TrackController { public class TrackController {
@Resource @Resource

@ -1 +1 @@
Subproject commit 2cd34f2f9588672a8c3a3f6c4a74bcbdcad49ac8 Subproject commit 9925f59ecdaed93a4365d83f8473d6788a233c4b