fix(系统设置):系统设置相关权限问题处理

--bug=1027201 --user=王旭 【系统设置】工作空间管理员-删除项目成员失败 https://www.tapd.cn/55049933/s/1383584

--bug=1027199 --user=王旭 【系统设置】工作空间成员-环境管理-可点击批量添加到环境组 https://www.tapd.cn/55049933/s/1383642

--bug=1027198 --user=王旭 【系统设置】工作空间成员-分配了配额管理和操作日志查询权限-点击均提示无权限 https://www.tapd.cn/55049933/s/1383652

--bug=1027204 --user=王旭 【系统设置】工作空间管理员-环境管理-批量添加到环境组失败 https://www.tapd.cn/55049933/s/1383630
This commit is contained in:
WangXu10 2023-06-19 21:02:58 +08:00 committed by 刘瑞斌
parent 6ae894913a
commit abe075ec27
6 changed files with 14 additions and 9 deletions

View File

@ -52,6 +52,9 @@ public class PermissionConstants {
public static final String WORKSPACE_PROJECT_MANAGER_READ_CREATE = "WORKSPACE_PROJECT_MANAGER:READ+CREATE"; public static final String WORKSPACE_PROJECT_MANAGER_READ_CREATE = "WORKSPACE_PROJECT_MANAGER:READ+CREATE";
public static final String WORKSPACE_PROJECT_MANAGER_READ_EDIT = "WORKSPACE_PROJECT_MANAGER:READ+EDIT"; public static final String WORKSPACE_PROJECT_MANAGER_READ_EDIT = "WORKSPACE_PROJECT_MANAGER:READ+EDIT";
public static final String WORKSPACE_PROJECT_MANAGER_READ_DELETE = "WORKSPACE_PROJECT_MANAGER:READ+DELETE"; public static final String WORKSPACE_PROJECT_MANAGER_READ_DELETE = "WORKSPACE_PROJECT_MANAGER:READ+DELETE";
public static final String WORKSPACE_PROJECT_MANAGER_READ_DELETE_USER = "WORKSPACE_PROJECT_MANAGER:READ+DELETE_USER";
public static final String WORKSPACE_QUOTA_READ = "WORKSPACE_QUOTA:READ";
public static final String WORKSPACE_QUOTA_READ_EDIT = "WORKSPACE_QUOTA:READ+EDIT";
public static final String WORKSPACE_PROJECT_MANAGER_READ_ADD_USER = "WORKSPACE_PROJECT_MANAGER:READ+ADD_USER"; public static final String WORKSPACE_PROJECT_MANAGER_READ_ADD_USER = "WORKSPACE_PROJECT_MANAGER:READ+ADD_USER";
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ = "WORKSPACE_PROJECT_ENVIRONMENT:READ"; public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ = "WORKSPACE_PROJECT_ENVIRONMENT:READ";

View File

@ -31,7 +31,7 @@ public class OperatingLogController {
} }
@GetMapping("/get/{id}") @GetMapping("/get/{id}")
@RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ) @RequiresPermissions(value={PermissionConstants.SYSTEM_OPERATING_LOG_READ, PermissionConstants.WORKSPACE_OPERATING_LOG_READ}, logical = Logical.OR)
public OperatingLogDTO get(@PathVariable String id) { public OperatingLogDTO get(@PathVariable String id) {
return operatingLogService.get(id); return operatingLogService.get(id);
} }

View File

@ -30,7 +30,7 @@ public class EnvironmentGroupController {
} }
@PostMapping("/batch/add") @PostMapping("/batch/add")
@RequiresPermissions(PermissionConstants.WORKSPACE_PROJECT_ENVIRONMENT_READ_CREATE) @RequiresPermissions(PermissionConstants.WORKSPACE_PROJECT_ENVIRONMENT_GROUP_EDIT)
public void batchAdd(@RequestBody EnvironmentGroupRequest request) { public void batchAdd(@RequestBody EnvironmentGroupRequest request) {
environmentGroupService.batchAdd(request); environmentGroupService.batchAdd(request);
} }

View File

@ -13,6 +13,7 @@ import io.metersphere.dto.UpdatePoolDTO;
import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.request.resourcepool.QueryResourcePoolRequest; import io.metersphere.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.service.TestResourcePoolService; import io.metersphere.service.TestResourcePoolService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -46,7 +47,7 @@ public class TestResourcePoolController {
@PostMapping("/update") @PostMapping("/update")
@MsAuditLog(module = OperLogModule.SYSTEM_TEST_RESOURCE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testResourcePoolDTO.id)", content = "#msClass.getLogDetails(#testResourcePoolDTO.id)", msClass = TestResourcePoolService.class) @MsAuditLog(module = OperLogModule.SYSTEM_TEST_RESOURCE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testResourcePoolDTO.id)", content = "#msClass.getLogDetails(#testResourcePoolDTO.id)", msClass = TestResourcePoolService.class)
@CacheNode // 把监控节点缓存起来 @CacheNode // 把监控节点缓存起来
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ_EDIT) @RequiresPermissions(value={PermissionConstants.SYSTEM_TEST_POOL_READ, PermissionConstants.WORKSPACE_QUOTA_READ_EDIT}, logical = Logical.OR)
public void updateTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) { public void updateTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
testResourcePoolService.updateTestResourcePool(testResourcePoolDTO); testResourcePoolService.updateTestResourcePool(testResourcePoolDTO);
} }
@ -54,7 +55,7 @@ public class TestResourcePoolController {
@GetMapping("/update/{poolId}/{status}") @GetMapping("/update/{poolId}/{status}")
@MsAuditLog(module = OperLogModule.SYSTEM_TEST_RESOURCE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#poolId)", content = "#msClass.getLogDetails(#poolId)", msClass = TestResourcePoolService.class) @MsAuditLog(module = OperLogModule.SYSTEM_TEST_RESOURCE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#poolId)", content = "#msClass.getLogDetails(#poolId)", msClass = TestResourcePoolService.class)
@CacheNode // 把监控节点缓存起来 @CacheNode // 把监控节点缓存起来
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ_EDIT) @RequiresPermissions(value={PermissionConstants.SYSTEM_TEST_POOL_READ, PermissionConstants.WORKSPACE_QUOTA_READ_EDIT}, logical = Logical.OR)
public void updateTestResourcePoolStatus(@PathVariable String poolId, @PathVariable String status) { public void updateTestResourcePoolStatus(@PathVariable String poolId, @PathVariable String status) {
testResourcePoolService.updateTestResourcePoolStatus(poolId, status); testResourcePoolService.updateTestResourcePoolStatus(poolId, status);
} }
@ -65,14 +66,14 @@ public class TestResourcePoolController {
} }
@PostMapping("list/{goPage}/{pageSize}") @PostMapping("list/{goPage}/{pageSize}")
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ) @RequiresPermissions(value={PermissionConstants.SYSTEM_TEST_POOL_READ, PermissionConstants.WORKSPACE_QUOTA_READ}, logical = Logical.OR)
public Pager<List<TestResourcePoolDTO>> listResourcePools(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryResourcePoolRequest request) { public Pager<List<TestResourcePoolDTO>> listResourcePools(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryResourcePoolRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request)); return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
} }
@GetMapping("/list/quota/ws/valid/{workspaceId}") @GetMapping("/list/quota/ws/valid/{workspaceId}")
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ) @RequiresPermissions(value={PermissionConstants.SYSTEM_TEST_POOL_READ, PermissionConstants.WORKSPACE_QUOTA_READ}, logical = Logical.OR)
public List<TestResourcePoolDTO> listWsValidQuotaResourcePools(@PathVariable String workspaceId) { public List<TestResourcePoolDTO> listWsValidQuotaResourcePools(@PathVariable String workspaceId) {
return testResourcePoolService.listWsValidQuotaResourcePools(workspaceId); return testResourcePoolService.listWsValidQuotaResourcePools(workspaceId);
} }

View File

@ -185,7 +185,7 @@ public class UserController {
} }
@GetMapping("/project/member/delete/{projectId}/{userId}") @GetMapping("/project/member/delete/{projectId}/{userId}")
@RequiresPermissions(value={PermissionConstants.PROJECT_USER_READ_DELETE}, logical = Logical.OR) @RequiresPermissions(value={PermissionConstants.PROJECT_USER_READ_DELETE, PermissionConstants.WORKSPACE_PROJECT_MANAGER_READ_DELETE_USER}, logical = Logical.OR)
@MsRequestLog(module = OperLogModule.PROJECT_PROJECT_MEMBER) @MsRequestLog(module = OperLogModule.PROJECT_PROJECT_MEMBER)
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();

View File

@ -202,7 +202,8 @@ export default {
selectDataCounts: 0, selectDataCounts: 0,
buttons: [ buttons: [
{ {
name: this.$t('workspace.env_group.batch_add_to_ws'), handleClick: this.batchAddToGroup name: this.$t('workspace.env_group.batch_add_to_ws'), handleClick: this.batchAddToGroup,
permissions: ['WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT_GROUP'],
}, },
], ],
ifCreate: false, // ifCreate: false, //
@ -486,7 +487,7 @@ export default {
return false; return false;
} }
let map = new Map(); let map = new Map();
this.selectRow.forEach(row => { this.selectRows.forEach(row => {
map.set(row.projectId, row.id); map.set(row.projectId, row.id);
}) })
batchAddEnvGroup({map: strMapToObj(map), groupIds: value}).then(() => { batchAddEnvGroup({map: strMapToObj(map), groupIds: value}).then(() => {