feat(REQ-3714): 处理管理员校验

This commit is contained in:
zhanghonghao 2025-03-12 14:50:24 +08:00
parent 89f2f81692
commit 12f3d89efd

View File

@ -237,14 +237,13 @@ public class NodeUserCheckServiceImpl implements NodeUserCheckService {
// 判断是否拥有admin角色 判断是否是分包管理员
List<Long> adminRoleIds = getSpecialRole();
PageRoleUserReq roleUserParam = PageRoleUserReq.builder().build();
PageRoleUserReq.WorkspaceOuPair workspaceOuPair = new PageRoleUserReq.WorkspaceOuPair();
workspaceOuPair.setWorkspaceId(req.getWorkspaceId());
workspaceOuPair.setOuId(req.getOuId());
roleUserParam.setWorkspaceOuPairs(Collections.singletonList(workspaceOuPair));
List<PageRoleUserReq.WorkspaceOuPair> workspaceOuPairList = transformWorkspaceOuPair(nodeUsers);
roleUserParam.setWorkspaceOuPairs(workspaceOuPairList);
roleUserParam.setPersonIds(req.getPersonIds());
roleUserParam.setNeedRole(true);
List<RoleUserResp> saasRoleUserInfo = roleUserGateway.pageAll(roleUserParam);
saasRoleUserInfo = saasRoleUserInfo.stream().filter(e -> Objects.nonNull(e.getRole())).collect(Collectors.toList());
saasRoleUserInfo.forEach(e -> {
Optional<RoleTypeEnum> roleTypeEnumOptional = RoleTypeEnum.fromValue(e.getRole().getRoleType());
RoleTypeEnum roleTypeEnum = RoleTypeEnum.AUTO_OWN;
@ -271,6 +270,15 @@ public class NodeUserCheckServiceImpl implements NodeUserCheckService {
return resultList;
}
private List<PageRoleUserReq.WorkspaceOuPair> transformWorkspaceOuPair(List<NodeUserDTO> nodeUsers) {
return nodeUsers.stream().map(e -> {
PageRoleUserReq.WorkspaceOuPair ouPair = new PageRoleUserReq.WorkspaceOuPair();
ouPair.setWorkspaceId(e.getWorkspaceId());
ouPair.setOuId(e.getOrganizationalUnitId());
return ouPair;
}).collect(Collectors.toList());
}
private static void transformFailMap(Map<Long, List<BatchDeleteNodeUserCheckResp.CheckFailInfo>> failInfoMap, List<BatchDeleteNodeUserCheckResp> resultList) {
if (CollUtil.isNotEmpty(failInfoMap)) {
failInfoMap.forEach((failPerson, checkFailInfos) -> {