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

Delete PermissionTemplate when destroying a Hyrax::AdministrativeSet or Hyrax collection #6917

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

dmolesUC
Copy link
Contributor

@dmolesUC dmolesUC commented Oct 8, 2024

Fixes

Fixes #6916

Summary

Adds a workflow step to destroy the associated PermissionTemplate when destroying a Hyrax::AdministrativeSet or Hyrax collection.

Type of change (for release notes)

  • notes-bugfix Bug Fixes

Detailed Description

I couldn't find an exact analogue for this -- the closest was DeleteAccessControl transaction, so I modeled the behavior on that with a corresponding DeletePermissionTemplate step. Note that the tests are a little more involved than the corresponding test for AdminSet, as I found there were PermissionTemplate records being created by side effect during the transaction call (e.g. creating the default AdministrativeSet, while checking to make sure the AdministrativeSet we're deleting wasn't it). I didn't want to mess with that behavior, but I'm open to suggestions about ways to make the tests cleaner.

Changes proposed in this pull request:

AdminSetDestroy and CollectionDestroy now destroy the associated PermissionTemplate along with the AdministrativeSet or collection.

@samvera/hyrax-code-reviewers

Copy link
Member

@orangewolf orangewolf left a comment

Choose a reason for hiding this comment

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

excellent work here. thank you for this

Copy link

Test Results

    17 files  ± 0      17 suites  ±0   2h 19m 29s ⏱️ - 3m 58s
 6 713 tests + 8   6 416 ✅ + 9  297 💤 ±0  0 ❌  - 1 
13 195 runs  +15  12 800 ✅ +16  395 💤 ±0  0 ❌  - 1 

Results for commit 091fe49. ± Comparison against base commit aeb5e3e.

This pull request removes 273 and adds 281 tests. Note that renamed tests count towards both.
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f39b6666ce0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f9a569da150>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f39b169d0d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f9a569d2e50>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 3e8a0519-ed79-4620-bc0b-84073d96bf65
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 896cfbfd-d06f-404a-8ab8-1ae773ceeb48
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 9595958b-2024-4e22-a6da-9c4882795465
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 92ca3c6f-0f07-4563-bdfc-ee5d7c6cc42b
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: 7dc360a3-7b52-4a54-8c7f-72f90188ad64
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 8ba06708-afd3-4e73-a1e8-d235a46ad5cf
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f9f577cf648>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fbdf4fb58d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f9f5890fac0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fbdf5102588>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: ca51677f-1ab3-4bdb-b99f-da9a1990c55f
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: a6d3c8c9-da46-461b-837d-12edc73aa6a0
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 0037c852-9628-4be3-ad76-942c0a0a7673
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 827f72f8-ea0c-4eff-9056-898c530f9ad4
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: bf13cf36-147b-4e3b-8928-c5f3c14c9a8a
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: d96223be-6e37-48ab-9435-92b9c0c9c258
…

@orangewolf orangewolf merged commit 3e8c633 into samvera:main Oct 14, 2024
22 checks passed
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.

Deleting a Valkyrie-based AdministrativeSet or collection doesn't delete the associated PermissionTemplate
3 participants