补充权限集作用范围筛选逻辑

This commit is contained in:
陈维伟 2023-09-13 16:45:28 +08:00
parent 2ff21391e8
commit 5a49466f0d
2 changed files with 25 additions and 27 deletions

View File

@ -3,7 +3,7 @@ package cn.axzo.tyr.client.feign;
import org.springframework.cloud.openfeign.FeignClient;
/**
* 权限集作用范围 TODO
* 权限集作用范围
*/
@FeignClient(name = "tyr", url = "${axzo.service.tyr:http://tyr:8080/api/saasPermissionGroup}")
public interface SaasPermissionGroupScopeApi {

View File

@ -106,21 +106,20 @@ public class PermissionGroupImpl implements PermissionGroupService {
.list();
// 过滤权限集作用范围
List<SaasPermissionGroupScope> saasPermissionGroupScopes = saasPermissionGroupScopesSource.stream().filter(e -> {
List<Long> workspaceIdWithOutCommon = req.getWorkspaceId().stream().filter(workspaceId -> !workspaceId.equals(-1l)).collect(Collectors.toList());
List<Long> ouIdWithOutCommon = req.getOuId().stream().filter(ouId -> !ouId.equals(-1l)).collect(Collectors.toList());
// 过滤出选中的工作台
if (CollectionUtils.isNotEmpty(req.getWorkspaceId())
&& PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())
&& req.getWorkspaceId().contains(e.getScopeId())) {
req.getWorkspaceId().contains(e.getScopeId());
return true;
if (PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())) {
if (CollectionUtils.isNotEmpty(workspaceIdWithOutCommon) && ! workspaceIdWithOutCommon.contains(e.getScopeId())) {
return false;
}
}else {
// 过滤出选中的单位
if (CollectionUtils.isNotEmpty(ouIdWithOutCommon) && ! ouIdWithOutCommon.contains(e.getScopeId())) {
return false;
}
}
// 过滤出选中的单位
if (CollectionUtils.isNotEmpty(req.getOuId())
&& PermissionScopeType.OU.getCode().equals(e.getScopeType())
&& req.getOuId().contains(e.getScopeId())) {
req.getWorkspaceId().contains(e.getScopeId());
return true;
}
return false;
return true;
}).collect(Collectors.toList());
// 组装填充字段
List<PermissionPointTreeNode> finalFeature = feature;
@ -192,21 +191,20 @@ public class PermissionGroupImpl implements PermissionGroupService {
.list();
// 过滤权限集作用范围
List<SaasPermissionGroupScope> saasPermissionGroupScopes = saasPermissionGroupScopesSource.stream().filter(e -> {
List<Long> workspaceIdWithOutCommon = req.getWorkspaceId().stream().filter(workspaceId -> !workspaceId.equals(-1l)).collect(Collectors.toList());
List<Long> ouIdWithOutCommon = req.getOuId().stream().filter(ouId -> !ouId.equals(-1l)).collect(Collectors.toList());
// 过滤出选中的工作台
if (CollectionUtils.isNotEmpty(req.getWorkspaceId())
&& PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())
&& req.getWorkspaceId().contains(e.getScopeId())) {
req.getWorkspaceId().contains(e.getScopeId());
return true;
if (PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())) {
if (CollectionUtils.isNotEmpty(workspaceIdWithOutCommon) && ! workspaceIdWithOutCommon.contains(e.getScopeId())) {
return false;
}
}else {
// 过滤出选中的单位
if (CollectionUtils.isNotEmpty(ouIdWithOutCommon) && ! ouIdWithOutCommon.contains(e.getScopeId())) {
return false;
}
}
// 过滤出选中的单位
if (CollectionUtils.isNotEmpty(req.getOuId())
&& PermissionScopeType.OU.getCode().equals(e.getScopeType())
&& req.getOuId().contains(e.getScopeId())) {
req.getWorkspaceId().contains(e.getScopeId());
return true;
}
return false;
return true;
}).collect(Collectors.toList());
// 组装填充字段
List<PermissionPointTreeNode> finalFeature = feature;