Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override only desc and name on role based sync #301

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading