Skip to content

Commit

Permalink
Merge pull request #303 from georchestra/backport/georchestra-gn4.2.x…
Browse files Browse the repository at this point in the history
…-24.0/pr-301

[georchestra-gn4.2.x-24.0] Merge pull request #301 from georchestra/fix-role-based-sync
  • Loading branch information
github-actions[bot] authored Aug 12, 2024
2 parents 1b79684 + 143dab6 commit 6a1d527
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,19 @@ public GroupLink synchronize(CanonicalGroup canonical) {
updateLabelTranslations(canonical, group);
}

link = externalGroupLinks.save(getSyncElements(group, canonical, link));
assert link.isUpToDateWith(canonical);

return link;
}

protected GroupLink getSyncElements(Group group, CanonicalGroup canonical, GroupLink link) {
logoUpdater.synchronize(canonical.getId(), group);
group.setName(canonical.getName());
group.setDescription(canonical.getDescription());
group.setWebsite(canonical.getLinkage());
group.setEmail(canonical.getMail());
link.setCanonical(canonical);
link = externalGroupLinks.save(link);
assert link.isUpToDateWith(canonical);

return link;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;

import org.fao.geonet.domain.Group;
import org.geonetwork.security.external.configuration.ExternalizedSecurityProperties;
import org.geonetwork.security.external.model.CanonicalGroup;
import org.geonetwork.security.external.model.CanonicalUser;
Expand Down Expand Up @@ -124,4 +125,11 @@ private boolean doesNotMatchesGeorchestraDefaultRoleNameFilter(CanonicalGroup ro
return doesNotMatchesGeorchestraDefaultRoleNameFilter(role.getName());
}

@Override
protected GroupLink getSyncElements(Group group, CanonicalGroup canonical, GroupLink link) {
group.setName(canonical.getName());
group.setDescription(canonical.getDescription());
link.setCanonical(canonical);
return link;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ public GroupLink assertGroupLink(CanonicalGroup expected) {
public void assertGroup(CanonicalGroup expected, Group actual) {
assertEquals(expected.getName(), actual.getName());
assertEquals(expected.getDescription(), actual.getDescription());
assertEquals(expected.getLinkage(), actual.getWebsite());
if (!getConfig().getSyncMode().equals(GroupSyncMode.roles)) {
assertEquals(expected.getLinkage(), actual.getWebsite());
}
}

public void addGeonetworkGroup(CanonicalGroup g) {
Expand Down

0 comments on commit 6a1d527

Please sign in to comment.