feat:(REQ-2524) 因为管理员角色不会配置权限点,所以不能排除

This commit is contained in:
lilong 2024-06-12 10:19:56 +08:00
parent 439573efa5
commit d7b36fb515

View File

@ -1113,14 +1113,19 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
}
// 权限点对应角色的单位类型要与权限点对应产品的单位类型一致才能算有权限
Map<Long, SaasProductModuleFeatureRelation> permissionProductMap = permissionProducts.stream()
.collect(Collectors.toMap(SaasProductModuleFeatureRelation::getFeatureId, Function.identity()));
Map<Long, List<String>> permissionProductMap = permissionProducts.stream()
.collect(Collectors.groupingBy(SaasProductModuleFeatureRelation::getFeatureId,
Collectors.mapping(SaasProductModuleFeatureRelation::getDictCode, Collectors.toList())));
for (SaasRoleUserV2DTO permissionRole : normalRoles) {
if (CollectionUtils.isEmpty(permissionRole.getSaasRole().getSaasPermissions())) {
continue;
}
Set<String> ouTypesOfProduct = permissionRole.getSaasRole().getSaasPermissions().stream()
.map(permissionProductMap::get)
.map(e -> permissionProductMap.get(e.getId()))
.filter(Objects::nonNull)
.map(SaasProductModuleFeatureRelation::getDictCode)
.flatMap(Collection::stream)
.collect(Collectors.toSet());
if (CollectionUtils.isEmpty(ouTypesOfProduct)) {
@ -1211,8 +1216,6 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
.build();
return saasRoleUserRelationService.listV2(listRoleUserRelationParam).stream()
.filter(e -> e.getSaasRole() != null)
// 角色没有需要鉴权的权限点也需要过滤
.filter(e -> !CollectionUtils.isEmpty(e.getSaasRole().getSaasPermissions()))
.collect(Collectors.toList());
}