Skip to content

Commit

Permalink
fix : user synchronizer if only reviewer and not both
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Nov 20, 2024
1 parent 6fea087 commit d0396ff
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ public void assertUser(CanonicalUser expected, User user) {
public UserGroup assertGroup(User user, CanonicalGroup belongsTo) {
GroupLink link = assertGroupLink(belongsTo);
Group group = link.getGeonetworkGroup();
Map<Integer, UserGroup> byGroupId = gnUserGroupRepository.findAll(UserGroupSpecs.hasUserId(user.getId()))
.stream().collect(Collectors.toMap(ug -> ug.getGroup().getId(), Function.identity()));
Map<Integer, List<UserGroup>> byGroupId = gnUserGroupRepository.findAll(UserGroupSpecs.hasUserId(user.getId()))
.stream().collect(Collectors.groupingBy(ug -> ug.getGroup().getId()));

UserGroup userGroup = byGroupId.get(group.getId());
UserGroup userGroup = byGroupId.get(group.getId()).get(0);
String msg = String.format("User '%s': link to group %s not found. Got: %s", user.getUsername(),
group.getName(),
user.getUsername() + " user's link to group " + group.getName() + " not found: " + byGroupId.values()
.stream().map(UserGroup::getGroup).map(Group::getName).collect(Collectors.joining(",")));
.stream().map(us -> us.get(0)).map(UserGroup::getGroup).map(Group::getName).collect(Collectors.joining(",")));
assertNotNull(msg, userGroup);
return userGroup;
}
Expand Down

0 comments on commit d0396ff

Please sign in to comment.