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

Update role based sync #298

Merged
merged 2 commits into from
Jun 24, 2024
Merged

Update role based sync #298

merged 2 commits into from
Jun 24, 2024

Conversation

f-necas
Copy link
Collaborator

@f-necas f-necas commented Jun 21, 2024

This PR is a refactoring of roles based sync which allows to directly set privilege to associated.

Documentation will be update in georchestra/georchestra#4256

geOrchestra/geonetwork checklist

  • PR only involves cherry-picked commits from upstream.
  • PR contains custom code which will soon be available in an upstream release and can be overriden => mention core-geonetwork version if possible.
  • PR contains custom geOrchestra code, which need to be verified during future migrations.

@landryb
Copy link
Member

landryb commented Jun 24, 2024

nice ! cant pretend i understand the code changes, but as long as it properly syncs as discussed in lille.. and i see there are proper tests.

Copy link
Member

@pmauduit pmauduit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, I was wondering if it will also address georchestra/georchestra#4202

Comment on lines +46 to +48
static final Set<String> georchestraDefaultRoleNames = Set.of("SUPERUSER","ORGADMIN","MAPSTORE_ADMIN","REFERENT","EMAILPROXY",
"ADMINISTRATOR", "IMPORT", "USER", "GN_EDITOR", "GN_REVIEWER", "GN_ADMIN");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have expected that such a set would have been defined somewhere into georchestra/georchestra (ldap-account-mgmt, georchestra-commons, or security-proxy-spring-integration), but it does not look like it's actually the case, so, fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's https://github.com/georchestra/datadir/blob/master/console/protectedroles.properties ... but so far only used by the console. So that would be two lists to sync ? or move those to default.properties ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that would be two lists to sync ? or move those to default.properties ?

I think such a constant should be defined into one of the shared geOrchestra libraries across components, but this is another topic (georchestra/georchestra#4031) ; here, since we already are into a GN module specific to geOrchestra, I think it's fine to leave it as it is.

@@ -71,7 +71,7 @@ public RolesBasedGroupSynchronizer(CanonicalAccountsRepository canonicalAccounts
*/
public @Override List<CanonicalGroup> fetchCanonicalGroups() {
List<CanonicalGroup> roles = canonicalAccounts.findAllRoles();
Stream<CanonicalGroup> matches = roles.stream().filter(this::matchesRoleNameFilter);
Stream<CanonicalGroup> matches = roles.stream().filter(this::notMatchesGeorchestraDefaultRoleNameFilter).filter(this::matchesRoleNameFilter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/notMatches/noMatches/ or doesNotMatch... ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was tired 😄 doesNotMatch is better, I fix this

@f-necas f-necas merged commit c12cfbb into georchestra-gn4.2.x Jun 24, 2024
1 check passed
Copy link

💚 All backports created successfully

Status Branch Result
georchestra-gn4.2.x-23.0.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

github-actions bot added a commit that referenced this pull request Jun 24, 2024
…-23.0.x/pr-298

[georchestra-gn4.2.x-23.0.x] Merge pull request #298 from georchestra/roles-sync-update
@f-necas f-necas deleted the roles-sync-update branch June 24, 2024 08:16
@landryb
Copy link
Member

landryb commented Jun 26, 2024

im a bit lost with what is supposed to happen, but in orgs syncmode, now only the organizations console api is polled at each sync interval, while previously in 23.0 both users & orgs apis were called. Not saying this is due to this change, but it feels strange because user role membership (eg testuser being part of GN_EDITOR group or not) isnt synced to GN.

edit ive looked at the history of debian updates on the demo, and the /console/internal/users API isnt called since the monster update from 4.2.4 to 4.2.7 in #260.

2023-12-08 09:16:03 upgrade georchestra-geonetwork:all 4.2.4-georchestra.20230602084527~143e841 4.2.7-georchestra.20231208072725~2dad0f8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants