hyrax icon indicating copy to clipboard operation
hyrax copied to clipboard

Resource permission persisting

Open cjcolvar opened this issue 2 years ago • 3 comments

Introduces handling of permissions_attributes params that come from the controller in the SaveAccessControl transaction step. The step converts the params into Hyrax::Permission objects and adds them to the ACL of the object being saved.

Also in the PR is change to the works controller to pass the step arg to make use of this new functionality.

In support of #5797

Steps for testing:

  1. Go to dashboard
  2. Go to works
  3. Click Add new work button
  4. Fill in required metadata
  5. Go to Sharing tab
  6. Choose group 'admin' with 'Edit' access and click Add
  7. Click deposit agreement
  8. Click Save button
  9. Click Edit button
  10. Go to Sharing tab
  11. Look for group 'admin' in 'Currently Shared With' table

cjcolvar avatar Sep 14 '22 21:09 cjcolvar

This is failing features/edit_work_resource_spec.rb because the permissions_attributes parameter is not including the agent.

dlpierce avatar Sep 19 '22 18:09 dlpierce

@dlpierce Thanks. I made some changes to guard for missing params (probably due to unused fields on the page still being posted). This should be ready for review as long as CI goes green.

cjcolvar avatar Sep 19 '22 19:09 cjcolvar

This fails when trying to edit a work and add a permission in koppie. It looks like Hyrax::PermissionController needs to change to Hyrax::Resource in its load_resource call. Strangely, when I setup the feature test to add a permission and save it, it does not fail when run in the koppie container.

dlpierce avatar Sep 20 '22 19:09 dlpierce