hyrax
hyrax copied to clipboard
An admin's changes are not persisted on the Work Sharing tab when Admin Set does not allow access grants
Descriptive summary
Admins always have access to the Sharing tab on the work form, even if the Admin Set the work is deposited in doesn't allow access grants. When an admin fills out the Add Sharing form and submits it, the UI indicates it submits successfully; however, the change does not get persisted.
This is because the permissions parameters get silently thrown out of the request if the admin set does not allow access grants (see WorkForm.sanitize_params).
This bug has been reproduced in HEAD (as of a0f8455) on Nurax.
Rationale
There is a mismatch in what the UI says the user has access to, and what the user can actually do. The UI should be consistent with the user's ability.
Expected behavior
Two options:
- An admin should not be able to see a work's sharing tab (or should get an error in the UI) if the work's admin set does not allow access grants
- An admin's changes to a work's sharing should persist, even if the work's admin set does not allow access grants
Actual behavior
An admin's changes to a work's sharing do not get persisted when the work's admin set does not allow access grants.
Steps to reproduce the behavior
- Login as an admin
- Create a new Admin Set with a mediated deposit workflow
- Deposit a new Work into the Admin Set created in step 2
- Edit the work
- Click on the Sharing tab
- Under "Add Sharing", select any group/user/access and click Add
- Click the "Save changes" button
- Edit the work again
- Click on the Sharing tab
- Verify the change you just made was not persisted under the "Currently Shared With" section
Related work
To my understanding, admins should always have access to the Sharing tab on the work form as evidenced by #4898. Does this mean the second option under Expected Behavior is the correct path forward?
Question: what should the expected behavior be?
As an admin user, I would expect to have access to the sharing tab regardless of the admin set settings, so option 2 seems to be the best way forward.
Verified this is still happening in Hyrax 5.0.0 on the following work: https://dev.nurax.samvera.org/concern/generic_works/0v838086x?locale=en
This work is created in an admin set that uses mediated deposit workflow. The work is supposed to be shared with another user but that Add Sharing will not save.