fix: 修复工作空间权限相关问题
This commit is contained in:
parent
3b2f876e0f
commit
6337d932ce
|
@ -3,10 +3,12 @@ package io.metersphere.controller;
|
||||||
import io.metersphere.base.domain.ServiceIntegration;
|
import io.metersphere.base.domain.ServiceIntegration;
|
||||||
import io.metersphere.commons.constants.OperLogConstants;
|
import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.constants.OperLogModule;
|
import io.metersphere.commons.constants.OperLogModule;
|
||||||
|
import io.metersphere.commons.constants.PermissionConstants;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.log.annotation.MsAuditLog;
|
import io.metersphere.log.annotation.MsAuditLog;
|
||||||
import io.metersphere.request.IntegrationRequest;
|
import io.metersphere.request.IntegrationRequest;
|
||||||
import io.metersphere.service.BaseIntegrationService;
|
import io.metersphere.service.BaseIntegrationService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -21,22 +23,26 @@ public class ServiceIntegrationController {
|
||||||
|
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#service.workspaceId, #service.platform)", content = "#msClass.getLogDetails(#service.workspaceId, #service.platform)", msClass = BaseIntegrationService.class)
|
@MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#service.workspaceId, #service.platform)", content = "#msClass.getLogDetails(#service.workspaceId, #service.platform)", msClass = BaseIntegrationService.class)
|
||||||
|
@RequiresPermissions(PermissionConstants.WORKSPACE_SERVICE_READ_EDIT)
|
||||||
public ServiceIntegration save(@RequestBody ServiceIntegration service) {
|
public ServiceIntegration save(@RequestBody ServiceIntegration service) {
|
||||||
return baseIntegrationService.save(service);
|
return baseIntegrationService.save(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/type")
|
@PostMapping("/type")
|
||||||
|
@RequiresPermissions(PermissionConstants.WORKSPACE_SERVICE_READ)
|
||||||
public ServiceIntegration getByPlatform(@RequestBody IntegrationRequest request) {
|
public ServiceIntegration getByPlatform(@RequestBody IntegrationRequest request) {
|
||||||
return baseIntegrationService.get(request);
|
return baseIntegrationService.get(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, title = "#request.platform", type = OperLogConstants.DELETE, msClass = BaseIntegrationService.class)
|
@MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, title = "#request.platform", type = OperLogConstants.DELETE, msClass = BaseIntegrationService.class)
|
||||||
|
@RequiresPermissions(PermissionConstants.WORKSPACE_SERVICE_READ_EDIT)
|
||||||
public void delete(@RequestBody IntegrationRequest request) {
|
public void delete(@RequestBody IntegrationRequest request) {
|
||||||
baseIntegrationService.delete(request);
|
baseIntegrationService.delete(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
|
@RequiresPermissions(PermissionConstants.WORKSPACE_SERVICE_READ)
|
||||||
public List<ServiceIntegration> getAll() {
|
public List<ServiceIntegration> getAll() {
|
||||||
return baseIntegrationService.getAll(SessionUtils.getCurrentWorkspaceId());
|
return baseIntegrationService.getAll(SessionUtils.getCurrentWorkspaceId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,6 +174,7 @@ public class UserController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/ws/member/delete/{workspaceId}/{userId}")
|
@GetMapping("/ws/member/delete/{workspaceId}/{userId}")
|
||||||
@MsAuditLog(module = OperLogModule.WORKSPACE_MEMBER, type = OperLogConstants.DELETE, title = "删除工作空间成员")
|
@MsAuditLog(module = OperLogModule.WORKSPACE_MEMBER, type = OperLogConstants.DELETE, title = "删除工作空间成员")
|
||||||
|
@RequiresPermissions(PermissionConstants.WORKSPACE_USER_READ_DELETE)
|
||||||
public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) {
|
public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) {
|
||||||
// workspaceService.checkWorkspaceOwner(workspaceId);
|
// workspaceService.checkWorkspaceOwner(workspaceId);
|
||||||
String currentUserId = SessionUtils.getUser().getId();
|
String currentUserId = SessionUtils.getUser().getId();
|
||||||
|
@ -185,6 +186,7 @@ public class UserController {
|
||||||
|
|
||||||
@GetMapping("/project/member/delete/{projectId}/{userId}")
|
@GetMapping("/project/member/delete/{projectId}/{userId}")
|
||||||
// @MsAuditLog(module = "workspace_member", type = OperLogConstants.DELETE, title = "删除工作空间成员")
|
// @MsAuditLog(module = "workspace_member", type = OperLogConstants.DELETE, title = "删除工作空间成员")
|
||||||
|
@RequiresPermissions(value={PermissionConstants.PROJECT_USER_READ_DELETE}, logical = Logical.OR)
|
||||||
public void deleteProjectMember(@PathVariable String projectId, @PathVariable String userId) {
|
public void deleteProjectMember(@PathVariable String projectId, @PathVariable String userId) {
|
||||||
String currentUserId = SessionUtils.getUser().getId();
|
String currentUserId = SessionUtils.getUser().getId();
|
||||||
if (StringUtils.equals(userId, currentUserId)) {
|
if (StringUtils.equals(userId, currentUserId)) {
|
||||||
|
|
Loading…
Reference in New Issue