throw error when assigning role to a user who is not found in the aai registry
This commit is contained in:
parent
bae9a132cb
commit
0ad86025b3
|
@ -88,6 +88,9 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
throw new ResourceNotFoundException("Cannot find CouId for role: " + role);
|
throw new ResourceNotFoundException("Cannot find CouId for role: " + role);
|
||||||
}
|
}
|
||||||
List<Integer> coPersonIds = aaiRegistryService.getCoPersonIdsByEmail(email);
|
List<Integer> coPersonIds = aaiRegistryService.getCoPersonIdsByEmail(email);
|
||||||
|
if (coPersonIds.isEmpty()) {
|
||||||
|
throw new ResourceNotFoundException("User with email '%s' could not be found..");
|
||||||
|
}
|
||||||
for (Integer coPersonId : coPersonIds) {
|
for (Integer coPersonId : coPersonIds) {
|
||||||
assert coPersonId != null;
|
assert coPersonId != null;
|
||||||
aaiRegistryService.assignMemberRole(coPersonId, couId);
|
aaiRegistryService.assignMemberRole(coPersonId, couId);
|
||||||
|
|
Loading…
Reference in New Issue