fix: 🐛 Added missing return values when RPC disabled

pull/1580/head
Dominik Frantisek Bucik 2022-04-11 12:13:10 +02:00
parent e1f5cd2ea8
commit 733597a473
No known key found for this signature in database
GPG Key ID: 73F752BEC0709845
1 changed files with 13 additions and 2 deletions

View File

@ -851,7 +851,11 @@ public class PerunAdapterRpc extends PerunAdapterWithMappingServices implements
@Override @Override
public boolean isValidMemberInGroupsAndVos(Long userId, Set<Long> mandatoryVos, Set<Long> mandatoryGroups, public boolean isValidMemberInGroupsAndVos(Long userId, Set<Long> mandatoryVos, Set<Long> mandatoryGroups,
Set<Long> envVos, Set<Long> envGroups) { Set<Long> envVos, Set<Long> envGroups)
{
if (!this.connectorRpc.isEnabled()) {
return false;
}
List<Member> members = getMembersByUser(userId); List<Member> members = getMembersByUser(userId);
Set<Long> foundVoIds = new HashSet<>(); Set<Long> foundVoIds = new HashSet<>();
Set<Long> foundGroupIds = new HashSet<>(); Set<Long> foundGroupIds = new HashSet<>();
@ -869,7 +873,11 @@ public class PerunAdapterRpc extends PerunAdapterWithMappingServices implements
} }
@Override @Override
public boolean isValidMemberInGroupsAndVos(Long userId, Set<Long> vos, Set<Long> groups) { public boolean isValidMemberInGroupsAndVos(Long userId, Set<Long> vos, Set<Long> groups)
{
if (!this.connectorRpc.isEnabled()) {
return false;
}
List<Member> members = getMembersByUser(userId); List<Member> members = getMembersByUser(userId);
Set<Long> foundVoIds = new HashSet<>(); Set<Long> foundVoIds = new HashSet<>();
Set<Long> foundGroupIds = new HashSet<>(); Set<Long> foundGroupIds = new HashSet<>();
@ -889,6 +897,9 @@ public class PerunAdapterRpc extends PerunAdapterWithMappingServices implements
@Override @Override
public boolean isUserInVo(Long userId, String voShortName) { public boolean isUserInVo(Long userId, String voShortName) {
if (!this.connectorRpc.isEnabled()) {
return false;
}
if (userId == null) { if (userId == null) {
throw new IllegalArgumentException("No userId"); throw new IllegalArgumentException("No userId");
} else if (!StringUtils.hasText(voShortName)) { } else if (!StringUtils.hasText(voShortName)) {