diff --git a/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/AbstractGroupSynchronizer.java b/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/AbstractGroupSynchronizer.java index 8a7fa3083f..2e819eb0d0 100644 --- a/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/AbstractGroupSynchronizer.java +++ b/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/AbstractGroupSynchronizer.java @@ -202,7 +202,7 @@ private Map getExistingGroupLinksById() { private void deleteGoneGroups(final Map currentLinks, final Set canonicalGroupIds) { final Set deleteCandidateIds = Sets.difference(currentLinks.keySet(), canonicalGroupIds); if (deleteCandidateIds.isEmpty()) { - log.info("No organizations were deleted."); + log.debug("No organizations were deleted."); return; } for (String groupId : deleteCandidateIds) { diff --git a/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/UserSynchronizer.java b/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/UserSynchronizer.java index 44a2b79e07..f5e8680cf3 100644 --- a/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/UserSynchronizer.java +++ b/georchestra-integration/externalized-accounts/src/main/java/org/geonetwork/security/external/integration/UserSynchronizer.java @@ -20,12 +20,7 @@ import static java.util.Objects.requireNonNull; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -99,7 +94,7 @@ public void synchronizeAll() { log.debug("Fetching canonical user definitions..."); List canonicalUsers = findCanonicalUsers(); synchronizeAll(canonicalUsers); - log.info("Users synchronization complete."); + log.debug("Users synchronization complete."); } @Transactional @@ -108,7 +103,7 @@ public void synchronizeAll(List canonical) { requireNonNull(canonical); canonical.forEach(u -> requireNonNull(u, "null references not accepted in user's list")); - log.debug("Syncrhonizing {} canonical user definitions...", canonical.size()); + log.debug("Synchronizing {} canonical user definitions...", canonical.size()); try { final Set canonicalIds = canonical.stream().map(CanonicalUser::getId).collect(Collectors.toSet()); final Map currentLinks = getExistingUserLinksById(); @@ -125,7 +120,7 @@ public void synchronizeAll(List canonical) { * Ensures a GeoNetwork {@link User} exists matching the {@code canonical} * (externally defined) user properties and authorization settings. *

- * + * */ @Transactional public UserLink synchronize(CanonicalUser canonical) { @@ -152,8 +147,15 @@ private void synchronizeUserGroups(User user, List privileges) { } private List resolveNewPrivileges(User user, List actual) { - - return actual.stream()// + List editors = actual.stream().filter(privilege -> privilege.getProfile() == Profile.Reviewer)// + .map(privilege -> { + log.debug("User {} is a reviewer of group {}", user.getUsername(), + privilege.getGroup().getName()); + return new Privilege(privilege.getGroup(), Profile.Editor); + }).collect(Collectors.toList()); + editors.addAll(actual); + + return editors.stream()// .map(privilege -> newUserGroup(user, privilege))// .collect(Collectors.toList()); }