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

[IDP-1182] Add endpoint for updating groups_external #355

Merged
merged 15 commits into from
Aug 21, 2024

Conversation

forevermatt
Copy link
Contributor

IDP-1182 Provide a way to set user.groups_external


Added

  • Add an API endpoint (with documentation and tests) for updating a prefix-specific subset of a User's list of external groups

Feature PR Checklist

  • Documentation (README, local.env.dist, etc.)
  • Tests created or updated
  • Run make composershow
  • Run make psr2

@forevermatt forevermatt requested a review from a team August 20, 2024 20:41
Copy link

sonarcloud bot commented Aug 20, 2024

Copy link
Contributor

@briskt briskt left a comment

Choose a reason for hiding this comment

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

Nicely organized implementation. My only question: what will be calling this endpoint?

Comment on lines +62 to +63
"app_prefix": "myapp",
"groups": ["myapp-users", "myapp-managers"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the prefix included as a separate property as well as included in the group names themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new sync process (yet to be written) will have a single, set prefix (per instance), so that a given copy of the new sync process can only affect external groups with that prefix.

The current need is for syncing from a Google Sheet controlled by some of the REAP admins, to enable them to add "reap-____" groups to users signing into REAP (because the new platform, Preservica, requires the use of SAML-provided groups for controlling authorization). This will let them add specific groups to specific users in specific IDPs, to control what those users are allowed to do in REAP. The app_prefix will be controlled by us, who set up and run the instance of the new sync process. The groups are controlled by the REAP admins (via the Google Sheet), so this is just another way to ensure the data they provide meets the constraints we have established for this new part of our system.

I hope that made sense. Feel free to ask more questions and/or review the parent YouTrack issue (IDP-1153) for more details.

Comment on lines +1008 to +1019
foreach ($appExternalGroups as $appExternalGroup) {
if (! str_starts_with($appExternalGroup, $appPrefix . '-')) {
$this->addErrors([
'groups_external' => sprintf(
'The given group %s does not start with the given prefix (%s)',
json_encode($appExternalGroup),
json_encode($appPrefix)
),
]);
return false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If the incoming group names omitted the prefix or the separate prefix property was omitted, this validation wouldn't be necessary. Doing so would remove one possible failure scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. I considered that option, but I'd like the group names (as typed into the Google Sheet) to exactly match the group names that REAP will receive via SAML, to help make it more intuitive.

If I had them simply type in everything after the prefix (on the Google Sheet), then they would type in something like "europe" and have to know/remember that it will come to REAP via SAML as "reap-europe". It seemed better to keep that prefix as visible as possible, so that they don't set up rules for a "europe" group and then be confused when it doesn't work.

@forevermatt
Copy link
Contributor Author

Nicely organized implementation. My only question: what will be calling this endpoint?

I'll be writing a new custom sync process (unless one we already have will suffice) for syncing from a Google Sheet to this new field, via this new API endpoint.

@forevermatt forevermatt merged commit e6557b7 into develop Aug 21, 2024
3 checks passed
@forevermatt forevermatt deleted the feature/IDP-1182-update-groups-external branch August 21, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants