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

Adds Valkyrie native permissions and ACL handling #3900

Closed
wants to merge 4 commits into from

Conversation

no-reply
Copy link
Contributor

Adds Hyrax::Permission and Hyrax::AccessControlList as an initial implementation of ACLs and read/edit/discover grants for objects in Valkyrie.

A simple grant/revoke DSL is added to encapsulate the most common practice of granting or revoking a particular access mode for a given user or group.

For now, this is only working against the abstract Valkyrie interface; further work is needed to allow the Wings adapter to translate the Valkyrie native approach to ActiveFedora-compatible data/operations.

This moves work forward toward #3584.

Changes proposed in this pull request:

  • Build out low-level infrastructure for Valkyrie handling of permissions

Guidance for testing, such as acceptance criteria or new user interface behaviors:

  • none; impact of this work is limited to internals.

@samvera/hyrax-code-reviewers

Tom Johnson added 4 commits July 24, 2019 10:39
The actor stack should persist arbitrary permissions. This behavior is untested
elsewhere, and may be at risk during the transition to Wings.
This is the beginning of a larger effort to establish Valkyrie-native permission
management/ACLs.
Adds support for editing ACLs for a given resource using Valkyrie interfaces.
Adds a simple DSL for adding and removing permissions by mode/user pairs. This
reduces the overhead/possibility for error in manually creating ACL policies by
directly managing `Hyrax::Permission` objects.
Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

It looks like the approach here is to store each Hyrax::Permission as it's own object. Is this deliberate to mirror hydra-access-controls? If it doesn't need to mirror the existing fedora modeling, would collapsing them into the ACL so there is only one ACL object persisted for all Permissions be more performant?

@no-reply
Copy link
Contributor Author

Is this deliberate to mirror hydra-access-controls?

More or less. We definitely want Permissions (or ACLs) to point back to resources, to avoid writing to curation objects when application-specific permissions change. I'm hypothesizing for now that leaving AccessControlList as a utility service, rather than a model, will make life easier for Wings. I'm working on that now.

If it doesn't need to mirror the existing fedora modeling, would collapsing them into the ACL so there is only one ACL object persisted for all Permissions be more performant?

Possibly. If so, this benefit won't be accessible until after Wings is deprecated (Wings must continue to save Permissions in the same way ActiveFedora does). If performance issues materialize, it should be easy to convert AccessControlList to a model and save permissions as nested resources. I think this decision is best delayed until the optimization becomes concrete.

@cjcolvar
Copy link
Member

The switch to nested resources in the future might require a data migration though hence my interest in pushing for the ideal at the outset. But it is probably too early to see what is going to be best and my suggestion might just be premature optimization.

@no-reply
Copy link
Contributor Author

The switch to nested resources in the future might require a data migration though hence my interest in pushing for the ideal at the outset.

i think whether this is the case will depend on the specific adapter. for now, with only Wings supported, the data layout will be the same regardless.

do you feel confident the change will be an optimization for, e.g., the sequel adapter, in normal/real-world usage patterns? i'm not sure how to get a feel for that until some of the production code is ported and we can support additional adapters, but if you feel sure it will have an eventual payoff, i'm open to making the change now.

@cjcolvar
Copy link
Member

Maybe it would be useful to ask some other valkyrie developers for their opinion?

@no-reply
Copy link
Contributor Author

it seems like maybe i should just develop this further before submitting?

it doesn't feel productive to me to explore optimizations at this point, since this approach doesn't yet support round-tripping via Wings, so can't be used in production.


additions << permission

true
Copy link
Contributor

Choose a reason for hiding this comment

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

Why return boolean value instead of additions array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

additions and deletions are internal implementation details that i don't expect to survive sustained development. it seems likely this code will use a ChangeSet or similar eventually.

For this reason, exposing them via the API seemed fragile.

additions.delete(permission)
deletions << permission

true
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question, why return boolean value instead of deletions array?

@cjcolvar
Copy link
Member

it seems like maybe i should just develop this further before submitting?

it doesn't feel productive to me to explore optimizations at this point, since this approach doesn't yet support round-tripping via Wings, so can't be used in production.

👍 I don't want to block Wings work over this. Maybe we could review this / think about optimization when it is getting closer to production-ready?

@no-reply no-reply closed this Jul 29, 2019
@no-reply no-reply deleted the valk-permissions branch October 8, 2019 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants