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

Add per-tenant Bulkrax field mappings #2384

Merged
merged 5 commits into from
Nov 21, 2024

Conversation

bkiahstroud
Copy link
Collaborator

@bkiahstroud bkiahstroud commented Nov 20, 2024

Summary

In multi-tenant Hyku applications, different tenants can have different requirements for field mappings. This is usually fine for the :from setting; if one tenant has a column named title_alpha and another title_beta, both can be added to the title's field mapping :from setting.

However, conflicts arise when tenants have different requirements for other settings, such as :split or deciding which field should be considered the source_identifier. In those cases, having a single, static field mapping config doesn't work.

This PR introduces a new Account settings as well as an override to Bulkrax to allow for configuring field mappings completely independently on a per-tenant basis.

Screenshots

New account default settings image
Override possible by admins within tenant image
JSON validation

image

Importer uses tenant field mappings image

@samvera/hyku-code-reviewers

Add a new Account setting that will override Bulkrax's default field
mappings. This is laying out the groundwork that will allow each tenant
to have its own unique field mappings
@bkiahstroud bkiahstroud added the minor-ver for release notes label Nov 20, 2024
Copy link

github-actions bot commented Nov 20, 2024

Test Results

    3 files  ±0      3 suites  ±0   18m 18s ⏱️ +19s
2 047 tests +7  1 997 ✅ +7  50 💤 ±0  0 ❌ ±0 
2 074 runs  +7  2 022 ✅ +7  52 💤 ±0  0 ❌ ±0 

Results for commit 7802691. ± Comparison against base commit 2ea73b9.

This pull request removes 42 and adds 49 tests. Note that renamed tests count towards both.
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to destroy 41f860dc-5377-44b5-afe7-c219233d157c
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to edit 00c81bee-60c8-4965-a3bc-f491078ffdb9
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to read 809b1def-0a6d-4079-bd97-45383a7a10d4
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to update 4a7f6a2a-2cad-4445-9db5-dd6184e6f87f
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to destroy 52b2c4c3-41d0-4d78-b921-2e040231086f
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to edit 46047960-610f-412f-bd22-12fd2fefecc3
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to read 3c2180b6-62c8-4200-a8da-91aa950a8bed
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to update d4f702cb-e5b6-4c35-8de2-c3badb8d9581
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor GenericWork permissions is expected not to be able to destroy 3ca1598a-fbfe-49a2-aac7-7821d2dffaac
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor GenericWork permissions is expected not to be able to edit ee2e2cea-c450-47a2-8287-2b1bb3a2227d
…
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to destroy 61e03ffa-d09f-4203-9959-c896aed57a95
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to edit 5a7ff8fa-9aaf-438c-a7b5-39fad17e5bf0
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to read 8a4a8333-327a-4bf0-b496-98fee42470a4
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor Etd permissions is expected not to be able to update e976b9e0-6735-4f90-9925-224909e8012d
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to destroy 4d917f28-044b-4142-bdb5-93ce0927a05b
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to edit ec2a3aea-d1fe-4ebe-8e4f-aa75c9fb0380
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to read 5815197a-9d76-4f38-9a9b-86d177566838
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor FileSet permissions is expected not to be able to update 5345588c-2019-4db5-a31e-3ad51c584f19
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor GenericWork permissions is expected not to be able to destroy 4dc07117-6ee7-479d-aae8-37daec688a27
spec.abilities.work_ability_spec ‑ Hyrax::Ability::WorkAbility when work depositor GenericWork permissions is expected not to be able to edit 211e7150-f652-4fe1-ae48-5861b8abaa42
…

♻️ This comment has been updated with latest results.

@bkiahstroud bkiahstroud merged commit 73214ba into main Nov 21, 2024
8 checks passed
@bkiahstroud bkiahstroud deleted the i286-add-per-tenant-bulkrax-field-mapping-editor branch November 21, 2024 17:17
laritakr added a commit to scientist-softserv/palni_palci_knapsack that referenced this pull request Nov 21, 2024
PR samvera/hyku#2384 added a new account setting.
bkiahstroud added a commit that referenced this pull request Nov 22, 2024
A recent Hyku feature introduced the ability to configure Bulkrax field
mappings on a per-tenant basis. It also introduced a bug that impacted
existing Hyku applications who had custom field mappings. Since the
feature fell back on Bulkrax's default field mappings if an Account
hadn't explicitly set their own, the existing field mapping
customizations in the Bulkrax initializer were ignored.

To solve that issue, as well as the question of "what if I want all my
tenants to have the same field mappings, but don't want to customize
them all by hand?", this commit introduces the idea of a set of default
field mappings at the Hyku application level.

This means that when Bulkrax looks for field mappings, it will discover
them in this order (depending on presence):

Account setting? -> Hyku defaults? -> Bulkrax defaults

There are a couple reasons why I decided to put this in the Hyku module
instead of just using Hyku's Bulkrax initializer:
1. Since they're Hyku's defaults, it makes sense to denote them as such
   semantically and conceptually
2. Since the ultimate fallback is Bulkrax's default field mappings, it
   makes sense not to alter the field mappings that Bulkrax "manages"
   with this feature
3. When adding hyku_knapsack into the mix, their often ends up being
   three separate Bulkrax config files (the knapsack's
   config/initializers/bulkrax.rb, Hyku's
   config/initializers/bulkrax.rb, and Bulkrax's lib/bulkrax.rb). This
   gets very muddy very quickly with how knapsack works technically

Ref:
- #2384
laritakr pushed a commit that referenced this pull request Nov 26, 2024
* move Bulkrax field mappings to Hyku

A recent Hyku feature introduced the ability to configure Bulkrax field
mappings on a per-tenant basis. It also introduced a bug that impacted
existing Hyku applications who had custom field mappings. Since the
feature fell back on Bulkrax's default field mappings if an Account
hadn't explicitly set their own, the existing field mapping
customizations in the Bulkrax initializer were ignored.

To solve that issue, as well as the question of "what if I want all my
tenants to have the same field mappings, but don't want to customize
them all by hand?", this commit introduces the idea of a set of default
field mappings at the Hyku application level.

This means that when Bulkrax looks for field mappings, it will discover
them in this order (depending on presence):

Account setting? -> Hyku defaults? -> Bulkrax defaults

There are a couple reasons why I decided to put this in the Hyku module
instead of just using Hyku's Bulkrax initializer:
1. Since they're Hyku's defaults, it makes sense to denote them as such
   semantically and conceptually
2. Since the ultimate fallback is Bulkrax's default field mappings, it
   makes sense not to alter the field mappings that Bulkrax "manages"
   with this feature
3. When adding hyku_knapsack into the mix, their often ends up being
   three separate Bulkrax config files (the knapsack's
   config/initializers/bulkrax.rb, Hyku's
   config/initializers/bulkrax.rb, and Bulkrax's lib/bulkrax.rb). This
   gets very muddy very quickly with how knapsack works technically

Ref:
- #2384

* add setter for Hyku.default_bulkrax_field_mappings

This can be used by a hyku_knapsack app initializer to override the
default Hyku application field mappings

* add spec coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor-ver for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants