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

Add a generic interface for ACL keys to Group and User #5761

Merged
merged 4 commits into from Jun 29, 2022
Merged

Conversation

marrus-sh
Copy link
Collaborator

Resumes work on #5439.

Adds a full set of tests for Hyrax::Group, and adds #agent_key and .from_agent_key as new methods on Hyrax::Group and [Hyrax::]User. In the latter case, these just fall back to #user_key and User.find_by_user_key.

The #to_sipity_agent tests on Hyrax::Group were mostly copied from the ones on Hyrax::User, and may warrant a closer look by someone more familiar with what they should be testing.

(If adding methods on User is undesirable, we could either ⓐ fallback to the existing #user_key and User.find_by_user_key if #agent_key and .from_agent_key are not defined, or ⓑ just implement #user_key and .find_by_user_key on Hyrax::Group directly. I’d probably prefer the first option, but neither of these solutions felt ideal to me.)

I’ll open a PR to backport this to 3.x-stable if this gets merged, as we would like it for our current experimental work on a hyrax-acl gem.

@samvera/hyrax-code-reviewers

tamsin johnson and others added 4 commits June 29, 2022 13:38
knowledge about how the ACL keys are handled for Groups is spread throughout the
codebase. treating this information as an attribute on the group seems cleaner.

`Hyrax::Group#user_key` is provided for easy compatibility with `::User`.
Also fixes an incorrect implementation of `Hyrax::Group.from_key`.

The Sipity specs were inspired by the similar specs for `Hyrax::User`.
These methods help reduce the amount of knowledge that ACLs require
regarding agents.

For Users, the default implementation is just to use `#user_key` and
`User.find_by_user_key`.

(An alternate approach would be just to implement `#user_key` and
`.find_by_user_key` directly on `Hyrax::Group`, but I’m not sure we
want Groups to be treatable as Users in all contexts where `#user_key`
might be used.)
@no-reply no-reply merged commit e5c1de5 into main Jun 29, 2022
@no-reply no-reply deleted the group-name branch June 29, 2022 22:16
@marrus-sh marrus-sh mentioned this pull request Jun 29, 2022
@dlpierce dlpierce added the notes-minor Release Notes: Non-breaking features label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-minor Release Notes: Non-breaking features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants