补充权限集作用范围筛选逻辑
This commit is contained in:
parent
2ff21391e8
commit
5a49466f0d
@ -3,7 +3,7 @@ package cn.axzo.tyr.client.feign;
|
|||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限集作用范围 TODO
|
* 权限集作用范围
|
||||||
*/
|
*/
|
||||||
@FeignClient(name = "tyr", url = "${axzo.service.tyr:http://tyr:8080/api/saasPermissionGroup}")
|
@FeignClient(name = "tyr", url = "${axzo.service.tyr:http://tyr:8080/api/saasPermissionGroup}")
|
||||||
public interface SaasPermissionGroupScopeApi {
|
public interface SaasPermissionGroupScopeApi {
|
||||||
|
|||||||
@ -106,21 +106,20 @@ public class PermissionGroupImpl implements PermissionGroupService {
|
|||||||
.list();
|
.list();
|
||||||
// 过滤权限集作用范围
|
// 过滤权限集作用范围
|
||||||
List<SaasPermissionGroupScope> saasPermissionGroupScopes = saasPermissionGroupScopesSource.stream().filter(e -> {
|
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())
|
if (PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())) {
|
||||||
&& PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())
|
if (CollectionUtils.isNotEmpty(workspaceIdWithOutCommon) && ! workspaceIdWithOutCommon.contains(e.getScopeId())) {
|
||||||
&& req.getWorkspaceId().contains(e.getScopeId())) {
|
|
||||||
req.getWorkspaceId().contains(e.getScopeId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 过滤出选中的单位
|
|
||||||
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 false;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
// 过滤出选中的单位
|
||||||
|
if (CollectionUtils.isNotEmpty(ouIdWithOutCommon) && ! ouIdWithOutCommon.contains(e.getScopeId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
// 组装填充字段
|
// 组装填充字段
|
||||||
List<PermissionPointTreeNode> finalFeature = feature;
|
List<PermissionPointTreeNode> finalFeature = feature;
|
||||||
@ -192,21 +191,20 @@ public class PermissionGroupImpl implements PermissionGroupService {
|
|||||||
.list();
|
.list();
|
||||||
// 过滤权限集作用范围
|
// 过滤权限集作用范围
|
||||||
List<SaasPermissionGroupScope> saasPermissionGroupScopes = saasPermissionGroupScopesSource.stream().filter(e -> {
|
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())
|
if (PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())) {
|
||||||
&& PermissionScopeType.WORKSPACE.getCode().equals(e.getScopeType())
|
if (CollectionUtils.isNotEmpty(workspaceIdWithOutCommon) && ! workspaceIdWithOutCommon.contains(e.getScopeId())) {
|
||||||
&& req.getWorkspaceId().contains(e.getScopeId())) {
|
|
||||||
req.getWorkspaceId().contains(e.getScopeId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 过滤出选中的单位
|
|
||||||
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 false;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
// 过滤出选中的单位
|
||||||
|
if (CollectionUtils.isNotEmpty(ouIdWithOutCommon) && ! ouIdWithOutCommon.contains(e.getScopeId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
// 组装填充字段
|
// 组装填充字段
|
||||||
List<PermissionPointTreeNode> finalFeature = feature;
|
List<PermissionPointTreeNode> finalFeature = feature;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user