-
Notifications
You must be signed in to change notification settings - Fork 0
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
Limit importers and exporters by user #201
Conversation
Refs - #123 Prior work limited the ability to view the importer and exporter pages by user role, but did not limit what importers and exporters could be seen. With this work, only admin users can see all importers and exporters, while other users can only see importers and exporters they have created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this PR introduces complex permissions surround importers and exporters, I think writing CanCanCan
rules is probably the way we want to go (as opposed to the current #check_permissions
overrides). Especially if this feature gets pushed back to Hyku.
In my head, this would look like:
- Creating a
#bulkrax_permissions
method somewhere (either in Bulkrax itself,app/models/ability.rb
, or an ability concern likeapp/models/concerns/hyrax/ability/collection_ability.rb
in Hyku) - Define
can
rules pertaining to importers and exporters1 - Add
:bulkrax_permissions
toAbility.ability_logic
1 E.g.
can :read, Bulkrax::Importer, user_id: current_user.id
In principle I really do agree with this. And this was our initial assumed approach. But once we articulated that approach, it felt like a lot of work, so we looked at how we could shorten that time. However, there are a few complicating facts:
I believe the correct approach is to file an issue surrounding this behavior. Further complicating the entire fact is the index action's filter of Exporters and Importers is something that should be bulkrax configurable (e.g. a custom lambda) because CanCan does not understand filtering rules for query sets. |
Also fix incorrect copy/paste error in exporters decorator.
Fixed items, made bulkrax ticket for cancan work.
rake hyku:roles:create_default_roles_and_groups |
Story
Refs
Prior work limited the ability to view the importer and exporter pages by user role, but did not limit what importers and exporters could be seen.
With this work, only admin users can see all importers and exporters, while other users can only see importers and exporters they have created.
Expected Behavior Before Changes
Users with advanced depositor role can see all importers and exporters.
Expected Behavior After Changes
Only admin can see all importers and exporters. Advanced depositors can only see what they have created.
Screenshots / Video
Notes