From 22af025fb1c11aa06a12e0cbe5c2c3f8c2b03f38 Mon Sep 17 00:00:00 2001 From: "B. Seeger" Date: Fri, 16 Jul 2021 11:32:38 -0400 Subject: [PATCH] Address field_access_terms tickets and a few minor things (#178) * Makes member_of field a single value field. * Updates tests to handle a single member_of field. * Makes field_access_terms a public field (for now) * Moves "field_access_terms" out of the default display for repository item and collection object --- .env | 2 +- ...display.node.collection_object.default.yml | 29 +++--- ..._display.node.islandora_object.default.yml | 11 +-- ...d.field.media.audio.field_access_terms.yml | 8 +- ...ield.media.document.field_access_terms.yml | 8 +- ...edia.extracted_text.field_access_terms.yml | 8 +- ...ld.field.media.file.field_access_terms.yml | 8 +- ...d.field.media.image.field_access_terms.yml | 8 +- ....media.remote_video.field_access_terms.yml | 8 +- ...d.field.media.video.field_access_terms.yml | 8 +- ...e.collection_object.field_access_terms.yml | 2 +- ...de.islandora_object.field_access_terms.yml | 2 +- ...field.storage.media.field_access_terms.yml | 2 +- .../field.storage.node.field_access_terms.yml | 2 +- .../field.storage.node.field_member_of.yml | 2 +- ...lus.migration.idc_ingest_contact_email.yml | 3 +- ..._plus.migration.idc_ingest_media_audio.yml | 15 ++++ ...us.migration.idc_ingest_media_document.yml | 15 ++++ ...ration.idc_ingest_media_extracted_text.yml | 15 ++++ ...e_plus.migration.idc_ingest_media_file.yml | 15 ++++ ..._plus.migration.idc_ingest_media_image.yml | 15 ++++ ...igration.idc_ingest_media_remote_video.yml | 15 ++++ ..._plus.migration.idc_ingest_media_video.yml | 15 ++++ ...te_plus.migration.idc_ingest_new_items.yml | 4 - codebase/config/sync/user.role.anonymous.yml | 2 - .../config/sync/user.role.authenticated.yml | 2 - .../sync/user.role.collection_level_admin.yml | 5 -- .../config/sync/user.role.global_admin.yml | 5 -- .../testcafe/migrate_tests.spec.js | 11 +++ .../testcafe/migrations/islandora_object.csv | 2 +- .../testcafe/migrations/media-accessterms.csv | 3 + .../testcafe/migrations/media-audio.csv | 4 +- .../testcafe/migrations/media-collection.csv | 4 +- .../testcafe/migrations/media-document.csv | 6 +- .../migrations/media-extracted_text.csv | 4 +- .../testcafe/migrations/media-file.csv | 4 +- .../testcafe/migrations/media-image.csv | 4 +- .../migrations/media-islandora_object.csv | 6 +- .../migrations/media-remote_video.csv | 4 +- .../testcafe/migrations/media-video.csv | 4 +- .../verification/expected/collection-01.json | 4 +- .../verification/expected/collection-03.json | 4 +- .../verification/expected/item-01.json | 5 +- .../verification/expected/media-audio.json | 4 + .../verification/expected/media-document.json | 4 + .../expected/media-extracted_text.json | 4 + .../verification/expected/media-file.json | 4 + .../verification/expected/media-image.json | 4 + .../expected/media-remote_video.json | 6 +- .../verification/expected/media-video.json | 4 + .../verification/expected_json_types_test.go | 5 +- .../verification/jsonapi_types_test.go | 7 +- .../verification/verify_migrations_test.go | 88 ++++++++++++++----- 53 files changed, 314 insertions(+), 119 deletions(-) create mode 100644 tests/10-migration-backend-tests/testcafe/migrations/media-accessterms.csv diff --git a/.env b/.env index c983bb627..fcfeee774 100644 --- a/.env +++ b/.env @@ -73,7 +73,7 @@ REPOSITORY=ghcr.io/jhu-sheridan-libraries/idc-isle-dc TAG=upstream-20200824-f8d1e8e-27-g6cd914d # Docker image and tag for snapshot image -SNAPSHOT_TAG=upstream-20201007-739693ae-314-gcd7a706.1623675453 +SNAPSHOT_TAG=upstream-20201007-739693ae-334-g9cd3d81.1625231210 # IdP, SP entity URIs and base URLs SP_BASEURL=https://islandora-idc.traefik.me diff --git a/codebase/config/sync/core.entity_view_display.node.collection_object.default.yml b/codebase/config/sync/core.entity_view_display.node.collection_object.default.yml index 0625b7e81..fbbb90458 100644 --- a/codebase/config/sync/core.entity_view_display.node.collection_object.default.yml +++ b/codebase/config/sync/core.entity_view_display.node.collection_object.default.yml @@ -35,14 +35,6 @@ content: region: content settings: { } third_party_settings: { } - field_access_terms: - weight: 102 - label: above - settings: - link: true - third_party_settings: { } - type: entity_reference_label - region: content field_alternative_title: type: reference_value_formatter weight: 6 @@ -53,7 +45,7 @@ content: invalid_reference_label: '' third_party_settings: { } field_citable_url: - weight: 12 + weight: 11 label: above settings: trim_length: 80 @@ -65,7 +57,7 @@ content: type: link region: content field_collection_contact_email: - weight: 17 + weight: 15 label: above settings: { } third_party_settings: { } @@ -80,7 +72,7 @@ content: type: string region: content field_collection_number: - weight: 10 + weight: 9 label: above settings: link_to_entity: false @@ -97,7 +89,7 @@ content: invalid_reference_label: '' third_party_settings: { } field_featured_item: - weight: 13 + weight: 12 label: above settings: format: default @@ -107,7 +99,7 @@ content: type: boolean region: content field_finding_aid: - weight: 11 + weight: 10 label: above settings: trim_length: 80 @@ -119,7 +111,7 @@ content: type: link region: content field_member_of: - weight: 14 + weight: 13 label: above settings: link: true @@ -127,7 +119,7 @@ content: type: entity_reference_label region: content field_model: - weight: 101 + weight: 17 label: above settings: link: true @@ -143,17 +135,17 @@ content: type: entity_reference_label region: content islandora_fits_checksum: - weight: 100 + weight: 16 + region: content settings: { } third_party_settings: { } - region: content links: weight: 4 region: content settings: { } third_party_settings: { } openseadragon_media_evas_entity_view_1: - weight: 15 + weight: 14 region: content settings: { } third_party_settings: { } @@ -170,6 +162,7 @@ content: hidden: display_media_entity_view_2: true display_media_thumbnail: true + field_access_terms: true langcode: true openseadragon_media_evas_entity_view_2: true pdfjs_media_evas_entity_view_1: true diff --git a/codebase/config/sync/core.entity_view_display.node.islandora_object.default.yml b/codebase/config/sync/core.entity_view_display.node.islandora_object.default.yml index b1159cbb1..eea9fbd00 100644 --- a/codebase/config/sync/core.entity_view_display.node.islandora_object.default.yml +++ b/codebase/config/sync/core.entity_view_display.node.islandora_object.default.yml @@ -85,14 +85,6 @@ content: third_party_settings: { } type: entity_reference_label region: content - field_access_terms: - weight: 42 - label: above - settings: - link: true - third_party_settings: { } - type: entity_reference_label - region: content field_alternative_title: weight: 3 label: above @@ -155,7 +147,7 @@ content: type: typed_relation_default region: content field_custodial_history: - weight: 43 + weight: 42 label: above settings: display_invalid_reference: 1 @@ -460,6 +452,7 @@ hidden: display_media_entity_view_1: true display_media_entity_view_2: true display_media_thumbnail: true + field_access_terms: true field_display_hints: true field_gemini_uri: true field_model: true diff --git a/codebase/config/sync/field.field.media.audio.field_access_terms.yml b/codebase/config/sync/field.field.media.audio.field_access_terms.yml index 4d740ff3a..333519c41 100644 --- a/codebase/config/sync/field.field.media.audio.field_access_terms.yml +++ b/codebase/config/sync/field.field.media.audio.field_access_terms.yml @@ -6,6 +6,12 @@ dependencies: - field.storage.media.field_access_terms - media.type.audio - taxonomy.vocabulary.islandora_access + module: + - epp +third_party_settings: + epp: + value: '' + on_update: 1 _core: default_config_hash: zMylfN-fI9CYLY9HkVelF4387LDjMjcxAueAg6LVf8w id: media.audio.field_access_terms @@ -14,7 +20,7 @@ entity_type: media bundle: audio label: 'Access terms' description: 'Terms that define who has access to view/edit this resource.' -required: false +required: true translatable: false default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.media.document.field_access_terms.yml b/codebase/config/sync/field.field.media.document.field_access_terms.yml index c462f07c5..be5a48964 100644 --- a/codebase/config/sync/field.field.media.document.field_access_terms.yml +++ b/codebase/config/sync/field.field.media.document.field_access_terms.yml @@ -6,6 +6,12 @@ dependencies: - field.storage.media.field_access_terms - media.type.document - taxonomy.vocabulary.islandora_access + module: + - epp +third_party_settings: + epp: + value: '' + on_update: 1 _core: default_config_hash: 7iLOcVFpCq9jtezHP8AeS8EG-Yk5EHQ0wsV7ygNYxeI id: media.document.field_access_terms @@ -14,7 +20,7 @@ entity_type: media bundle: document label: 'Access terms' description: 'Terms that define who has access to view/edit this resource.' -required: false +required: true translatable: true default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.media.extracted_text.field_access_terms.yml b/codebase/config/sync/field.field.media.extracted_text.field_access_terms.yml index b1f01875a..a7dbd2ebc 100644 --- a/codebase/config/sync/field.field.media.extracted_text.field_access_terms.yml +++ b/codebase/config/sync/field.field.media.extracted_text.field_access_terms.yml @@ -6,13 +6,19 @@ dependencies: - field.storage.media.field_access_terms - media.type.extracted_text - taxonomy.vocabulary.islandora_access + module: + - epp +third_party_settings: + epp: + value: '' + on_update: 1 id: media.extracted_text.field_access_terms field_name: field_access_terms entity_type: media bundle: extracted_text label: 'Access terms' description: '' -required: false +required: true translatable: true default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.media.file.field_access_terms.yml b/codebase/config/sync/field.field.media.file.field_access_terms.yml index 8531ab9ae..f8f0685bb 100644 --- a/codebase/config/sync/field.field.media.file.field_access_terms.yml +++ b/codebase/config/sync/field.field.media.file.field_access_terms.yml @@ -6,6 +6,12 @@ dependencies: - field.storage.media.field_access_terms - media.type.file - taxonomy.vocabulary.islandora_access + module: + - epp +third_party_settings: + epp: + value: '' + on_update: 1 _core: default_config_hash: 4J_HfSex6RG0DqvYnL64GW2PPdCE9LTI_wcJbVBPTJA id: media.file.field_access_terms @@ -14,7 +20,7 @@ entity_type: media bundle: file label: 'Access terms' description: 'Terms that define who has access to view/edit this resource.' -required: false +required: true translatable: true default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.media.image.field_access_terms.yml b/codebase/config/sync/field.field.media.image.field_access_terms.yml index a2da15035..904275488 100644 --- a/codebase/config/sync/field.field.media.image.field_access_terms.yml +++ b/codebase/config/sync/field.field.media.image.field_access_terms.yml @@ -6,6 +6,12 @@ dependencies: - field.storage.media.field_access_terms - media.type.image - taxonomy.vocabulary.islandora_access + module: + - epp +third_party_settings: + epp: + value: '' + on_update: 1 _core: default_config_hash: '-lMjqsiKVP3LjspOgRdrckFRFXKfyOkqAnPAxuE7K5w' id: media.image.field_access_terms @@ -14,7 +20,7 @@ entity_type: media bundle: image label: 'Access terms' description: 'Terms that define who has access to view/edit this resource.' -required: false +required: true translatable: false default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.media.remote_video.field_access_terms.yml b/codebase/config/sync/field.field.media.remote_video.field_access_terms.yml index c3492e6d1..b0e3de47c 100644 --- a/codebase/config/sync/field.field.media.remote_video.field_access_terms.yml +++ b/codebase/config/sync/field.field.media.remote_video.field_access_terms.yml @@ -6,13 +6,19 @@ dependencies: - field.storage.media.field_access_terms - media.type.remote_video - taxonomy.vocabulary.islandora_access + module: + - epp +third_party_settings: + epp: + value: '' + on_update: 1 id: media.remote_video.field_access_terms field_name: field_access_terms entity_type: media bundle: remote_video label: 'Access terms' description: '' -required: false +required: true translatable: true default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.media.video.field_access_terms.yml b/codebase/config/sync/field.field.media.video.field_access_terms.yml index 0d0ec8c4c..a72f265f1 100644 --- a/codebase/config/sync/field.field.media.video.field_access_terms.yml +++ b/codebase/config/sync/field.field.media.video.field_access_terms.yml @@ -6,6 +6,12 @@ dependencies: - field.storage.media.field_access_terms - media.type.video - taxonomy.vocabulary.islandora_access + module: + - epp +third_party_settings: + epp: + value: '' + on_update: 1 _core: default_config_hash: rQJGaUMqAT7XoaBgoFeFJfRfVOjxlPl9TuA_lcUdqy4 id: media.video.field_access_terms @@ -14,7 +20,7 @@ entity_type: media bundle: video label: 'Access terms' description: 'Terms that define who has access to view/edit this resource.' -required: false +required: true translatable: false default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.node.collection_object.field_access_terms.yml b/codebase/config/sync/field.field.node.collection_object.field_access_terms.yml index d9f710d23..389345209 100644 --- a/codebase/config/sync/field.field.node.collection_object.field_access_terms.yml +++ b/codebase/config/sync/field.field.node.collection_object.field_access_terms.yml @@ -18,7 +18,7 @@ entity_type: node bundle: collection_object label: 'Access Terms' description: '' -required: false +required: true translatable: false default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.field.node.islandora_object.field_access_terms.yml b/codebase/config/sync/field.field.node.islandora_object.field_access_terms.yml index 872e15775..d44e24c52 100644 --- a/codebase/config/sync/field.field.node.islandora_object.field_access_terms.yml +++ b/codebase/config/sync/field.field.node.islandora_object.field_access_terms.yml @@ -18,7 +18,7 @@ entity_type: node bundle: islandora_object label: 'Access Terms' description: '' -required: false +required: true translatable: true default_value: { } default_value_callback: '' diff --git a/codebase/config/sync/field.storage.media.field_access_terms.yml b/codebase/config/sync/field.storage.media.field_access_terms.yml index 0acccff4a..4a9046d14 100644 --- a/codebase/config/sync/field.storage.media.field_access_terms.yml +++ b/codebase/config/sync/field.storage.media.field_access_terms.yml @@ -8,7 +8,7 @@ dependencies: - taxonomy third_party_settings: field_permissions: - permission_type: private + permission_type: public _core: default_config_hash: wJ27ZPLCi9CKnGI4gwKjMBuAAtXPgxaJoiecuALirdY id: media.field_access_terms diff --git a/codebase/config/sync/field.storage.node.field_access_terms.yml b/codebase/config/sync/field.storage.node.field_access_terms.yml index 81c8cf424..98211509c 100644 --- a/codebase/config/sync/field.storage.node.field_access_terms.yml +++ b/codebase/config/sync/field.storage.node.field_access_terms.yml @@ -8,7 +8,7 @@ dependencies: - taxonomy third_party_settings: field_permissions: - permission_type: custom + permission_type: public id: node.field_access_terms field_name: field_access_terms entity_type: node diff --git a/codebase/config/sync/field.storage.node.field_member_of.yml b/codebase/config/sync/field.storage.node.field_member_of.yml index 31d562547..515a6d665 100644 --- a/codebase/config/sync/field.storage.node.field_member_of.yml +++ b/codebase/config/sync/field.storage.node.field_member_of.yml @@ -21,7 +21,7 @@ settings: target_type: node module: core locked: false -cardinality: -1 +cardinality: 1 translatable: true indexes: { } persist_with_no_fields: false diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_contact_email.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_contact_email.yml index b485c44db..e61fabde0 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_contact_email.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_contact_email.yml @@ -1,7 +1,8 @@ +uuid: 3c864df1-d3e1-470c-ae40-439268277ba6 langcode: en status: true dependencies: { } -id: idc_ingest_new_contact_email +id: idc_ingest_contact_email class: null field_plugin_method: null cck_plugin_method: null diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_audio.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_audio.yml index 22f87e037..c81b33529 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_audio.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_audio.yml @@ -56,6 +56,21 @@ process: source: - constants/DRUPAL_FS - '@_destination_filepath' + field_access_terms: + - + plugin: skip_on_empty + method: process + source: access_terms + - + plugin: explode + delimiter: '|' + strict: false + - + plugin: entity_lookup + bundle_key: vid + bundle: islandora_access + entity_type: taxonomy_term + value_key: name field_original_name: original_name field_media_audio_file/target_id: plugin: file_import diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_document.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_document.yml index 5addc25cc..1b6270d9e 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_document.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_document.yml @@ -56,6 +56,21 @@ process: source: - constants/DRUPAL_FS - '@_destination_filepath' + field_access_terms: + - + plugin: skip_on_empty + method: process + source: access_terms + - + plugin: explode + delimiter: '|' + strict: false + - + plugin: entity_lookup + bundle_key: vid + bundle: islandora_access + entity_type: taxonomy_term + value_key: name field_original_name: original_name field_media_document/target_id: plugin: file_import diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_extracted_text.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_extracted_text.yml index 839642174..fdabecbf2 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_extracted_text.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_extracted_text.yml @@ -57,6 +57,21 @@ process: source: - constants/DRUPAL_FS - '@_destination_filepath' + field_access_terms: + - + plugin: skip_on_empty + method: process + source: access_terms + - + plugin: explode + delimiter: '|' + strict: false + - + plugin: entity_lookup + bundle_key: vid + bundle: islandora_access + entity_type: taxonomy_term + value_key: name field_media_file/target_id: plugin: file_import source: '@_download_filepath' diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_file.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_file.yml index adcfc666c..474942a19 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_file.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_file.yml @@ -56,6 +56,21 @@ process: source: - constants/DRUPAL_FS - '@_destination_filepath' + field_access_terms: + - + plugin: skip_on_empty + method: process + source: access_terms + - + plugin: explode + delimiter: '|' + strict: false + - + plugin: entity_lookup + bundle_key: vid + bundle: islandora_access + entity_type: taxonomy_term + value_key: name field_original_name: original_name field_media_file/target_id: plugin: file_import diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_image.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_image.yml index d9491419f..8dce965eb 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_image.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_image.yml @@ -56,6 +56,21 @@ process: source: - constants/DRUPAL_FS - '@_destination_filepath' + field_access_terms: + - + plugin: skip_on_empty + method: process + source: access_terms + - + plugin: explode + delimiter: '|' + strict: false + - + plugin: entity_lookup + bundle_key: vid + bundle: islandora_access + entity_type: taxonomy_term + value_key: name field_original_name: original_name field_media_image/target_id: plugin: file_import diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_remote_video.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_remote_video.yml index c722da42b..17104578d 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_remote_video.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_remote_video.yml @@ -22,6 +22,21 @@ source: TMP_FS: /tmp/ process: name: name + field_access_terms: + - + plugin: skip_on_empty + method: process + source: access_terms + - + plugin: explode + delimiter: '|' + strict: false + - + plugin: entity_lookup + bundle_key: vid + bundle: islandora_access + entity_type: taxonomy_term + value_key: name field_media_oembed_video: url field_media_of: plugin: parse_entity_lookup diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_video.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_video.yml index 38692bd3f..35ca17a91 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_media_video.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_media_video.yml @@ -56,6 +56,21 @@ process: source: - constants/DRUPAL_FS - '@_destination_filepath' + field_access_terms: + - + plugin: skip_on_empty + method: process + source: access_terms + - + plugin: explode + delimiter: '|' + strict: false + - + plugin: entity_lookup + bundle_key: vid + bundle: islandora_access + entity_type: taxonomy_term + value_key: name field_original_name: original_name field_media_video_file/target_id: plugin: file_import diff --git a/codebase/config/sync/migrate_plus.migration.idc_ingest_new_items.yml b/codebase/config/sync/migrate_plus.migration.idc_ingest_new_items.yml index da2313a8f..48e01107c 100644 --- a/codebase/config/sync/migrate_plus.migration.idc_ingest_new_items.yml +++ b/codebase/config/sync/migrate_plus.migration.idc_ingest_new_items.yml @@ -487,10 +487,6 @@ process: plugin: skip_on_empty method: process source: member_of - - - plugin: explode - delimiter: '|' - strict: false - plugin: parse_entity_lookup defaults: diff --git a/codebase/config/sync/user.role.anonymous.yml b/codebase/config/sync/user.role.anonymous.yml index 94a17e7cf..c7f3cf565 100644 --- a/codebase/config/sync/user.role.anonymous.yml +++ b/codebase/config/sync/user.role.anonymous.yml @@ -14,10 +14,8 @@ permissions: - 'restful get oai_pmh' - 'search content' - 'use text format restricted_html' - - 'view field_access_terms' - 'view field_citable_url' - 'view field_model' - 'view media' - - 'view own field_access_terms' - 'view own field_citable_url' - 'view own field_model' diff --git a/codebase/config/sync/user.role.authenticated.yml b/codebase/config/sync/user.role.authenticated.yml index d3b0671a9..675b2f884 100644 --- a/codebase/config/sync/user.role.authenticated.yml +++ b/codebase/config/sync/user.role.authenticated.yml @@ -16,10 +16,8 @@ permissions: - 'restful get oai_pmh' - 'search content' - 'use text format basic_html' - - 'view field_access_terms' - 'view field_citable_url' - 'view field_model' - 'view media' - - 'view own field_access_terms' - 'view own field_citable_url' - 'view own field_model' diff --git a/codebase/config/sync/user.role.collection_level_admin.yml b/codebase/config/sync/user.role.collection_level_admin.yml index e836c413f..8acbd0a2c 100644 --- a/codebase/config/sync/user.role.collection_level_admin.yml +++ b/codebase/config/sync/user.role.collection_level_admin.yml @@ -20,7 +20,6 @@ permissions: - 'create document media' - 'create extracted_text media' - 'create field_access_control' - - 'create field_access_terms' - 'create field_model' - 'create file media' - 'create fits_technical_metadata media' @@ -50,14 +49,12 @@ permissions: - 'edit any remote_video media' - 'edit any video media' - 'edit field_access_control' - - 'edit field_access_terms' - 'edit field_model' - 'edit own audio media' - 'edit own collection_object content' - 'edit own document media' - 'edit own extracted_text media' - 'edit own field_access_control' - - 'edit own field_access_terms' - 'edit own field_model' - 'edit own file media' - 'edit own fits_technical_metadata media' @@ -90,10 +87,8 @@ permissions: - 'view checksums' - 'view collection_object revisions' - 'view field_access_control' - - 'view field_access_terms' - 'view islandora_object revisions' - 'view own field_access_control' - - 'view own field_access_terms' - 'view own unpublished content' - 'view own unpublished media' - 'view the administration theme' diff --git a/codebase/config/sync/user.role.global_admin.yml b/codebase/config/sync/user.role.global_admin.yml index 8c483b7fc..7df9ada8c 100644 --- a/codebase/config/sync/user.role.global_admin.yml +++ b/codebase/config/sync/user.role.global_admin.yml @@ -33,7 +33,6 @@ permissions: - 'create extracted_text media' - 'create field_access_control' - 'create field_access_group' - - 'create field_access_terms' - 'create field_model' - 'create file media' - 'create fits_technical_metadata media' @@ -76,7 +75,6 @@ permissions: - 'edit any video media' - 'edit field_access_control' - 'edit field_access_group' - - 'edit field_access_terms' - 'edit field_model' - 'edit own audio media' - 'edit own collection_object content' @@ -84,7 +82,6 @@ permissions: - 'edit own extracted_text media' - 'edit own field_access_control' - 'edit own field_access_group' - - 'edit own field_access_terms' - 'edit own field_model' - 'edit own file media' - 'edit own fits_technical_metadata media' @@ -119,11 +116,9 @@ permissions: - 'view collection_object revisions' - 'view field_access_control' - 'view field_access_group' - - 'view field_access_terms' - 'view islandora_object revisions' - 'view own field_access_control' - 'view own field_access_group' - - 'view own field_access_terms' - 'view own unpublished content' - 'view own unpublished media' - 'view the administration theme' diff --git a/tests/10-migration-backend-tests/testcafe/migrate_tests.spec.js b/tests/10-migration-backend-tests/testcafe/migrate_tests.spec.js index 8584ccd0a..5736b9932 100644 --- a/tests/10-migration-backend-tests/testcafe/migrate_tests.spec.js +++ b/tests/10-migration-backend-tests/testcafe/migrate_tests.spec.js @@ -344,6 +344,17 @@ test('Perform Repository Object Migration', async t => { test('Perform Media Migrations', async t => { + // Migrate Islandora Access Terms for media tests + await t + .click(selectMigration) + .click(migrationOptions.withAttribute('value', migrate_islandora_accessterms_taxonomy)); + + await t + .setFilesToUpload('#edit-source-file', [ + './migrations/media-accessterms.csv' + ]) + .click('#edit-import'); + // Migrate the Collection and Repository Object the Media will be attached to await t diff --git a/tests/10-migration-backend-tests/testcafe/migrations/islandora_object.csv b/tests/10-migration-backend-tests/testcafe/migrations/islandora_object.csv index 9649724c8..2e3e36963 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/islandora_object.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/islandora_object.csv @@ -1,2 +1,2 @@ node_id,local_id,title,abstract,access_rights,access_terms,alternative_title,collection_number,contributor,copyright,copyright_holder,creator,custodial_history,date_available,date_copyrighted,date_created,date_published,description,digital_identifier,digital_publisher,display_hints,dspace_identifier,dspace_itemid,extent,featured_item,finding_aid,genre,geoportal_link,issn,is_part_of,item_barcode,jhir_uri,language,library_catalog_link,member_of,model,oclc_number,publisher,publisher_country,resource_type,spatial_coverage,subject,table_of_contents,title_language,years -,io_01,Sample Repository Item,Sample Repository Item Abstract in English;eng|日本語のサンプルリポジトリアイテムの要約;jpn,Public digital access|Public Domain,Images Collection|Ansel Adams,Sample Repository Item Alternate Title;eng|Пример альтернативного названия элемента репозитория на русском языке;rus,1|2,"relators:art;:person::Adams, Islandora Object Ansel Easton, 1902-1984|relators:pht;:person::Adams, Islandora Object Ansel Easton, 1902-1984",Copyright Undetermined,":person::Weston, Islandora Object Edward, 1886-1958|:person::Adams, Islandora Object Ansel Easton, 1902-1984","relators:art;:person::Adams, Islandora Object Ansel Easton, 1902-1984|relators:pht;:person::Weston, Islandora Object Edward, 1886-1958","This material was held by the author and donated recently;eng|该材料由作者持有,最近捐赠;chi",2020-01-01,2010-01-01|1941-11,1941-11-01|1941-11,1943|1944,Sample Repository Item Description in English;eng|सैंपल रिपोजिटरी आइटम का विवरण हिंदी मे;hin,a digital identifier one|a digital identifier two,:corporate_body::Ansel Adams Publishing Rights Trust|:corporate_body::Johns Hopkins Sheridan Libraries,Open Seadragon,http://jscholarship.library.jhu.edu,DSpace Item ID,1 item|one image file,1,http://www.google.com|http://www.example.com,Analog|Nature,http://catalyst.library.jhu.edu,12345678,https://en.wikipedia.org/wiki/San_Rafael_Reef,123456|789,http://jhir.jhu.edu,English|German,http://catalog.library.jhu.edu|http://example.org/other_catalog_link,:::Images Collection|:::Ansel Adams,Image,oclc_one|oclc_two,:::Ansel Adams Publishing Rights Trust|:::Johns Hopkins Sheridan Libraries,Mountain Light Gallery|Nevada,Dataset|Image,"Hernandez, NM|San Rafael Reef, UT",:::Analog Islandora Object Photography|:::General Islandora Object Photography,Table of Contents in English;eng|Inhaltsverzeichnis in deutscher Sprache;ger,English,1941|1943 +,io_01,Sample Repository Item,Sample Repository Item Abstract in English;eng|日本語のサンプルリポジトリアイテムの要約;jpn,Public digital access|Public Domain,Images Collection|Ansel Adams,Sample Repository Item Alternate Title;eng|Пример альтернативного названия элемента репозитория на русском языке;rus,1|2,"relators:art;:person::Adams, Islandora Object Ansel Easton, 1902-1984|relators:pht;:person::Adams, Islandora Object Ansel Easton, 1902-1984",Copyright Undetermined,":person::Weston, Islandora Object Edward, 1886-1958|:person::Adams, Islandora Object Ansel Easton, 1902-1984","relators:art;:person::Adams, Islandora Object Ansel Easton, 1902-1984|relators:pht;:person::Weston, Islandora Object Edward, 1886-1958","This material was held by the author and donated recently;eng|该材料由作者持有,最近捐赠;chi",2020-01-01,2010-01-01|1941-11,1941-11-01|1941-11,1943|1944,Sample Repository Item Description in English;eng|सैंपल रिपोजिटरी आइटम का विवरण हिंदी मे;hin,a digital identifier one|a digital identifier two,:corporate_body::Ansel Adams Publishing Rights Trust|:corporate_body::Johns Hopkins Sheridan Libraries,Open Seadragon,http://jscholarship.library.jhu.edu,DSpace Item ID,1 item|one image file,1,http://www.google.com|http://www.example.com,Analog|Nature,http://catalyst.library.jhu.edu,12345678,https://en.wikipedia.org/wiki/San_Rafael_Reef,123456|789,http://jhir.jhu.edu,English|German,http://catalog.library.jhu.edu|http://example.org/other_catalog_link,:::Images Collection,Image,oclc_one|oclc_two,:::Ansel Adams Publishing Rights Trust|:::Johns Hopkins Sheridan Libraries,Mountain Light Gallery|Nevada,Dataset|Image,"Hernandez, NM|San Rafael Reef, UT",:::Analog Islandora Object Photography|:::General Islandora Object Photography,Table of Contents in English;eng|Inhaltsverzeichnis in deutscher Sprache;ger,English,1941|1943 diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-accessterms.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-accessterms.csv new file mode 100644 index 000000000..887913b58 --- /dev/null +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-accessterms.csv @@ -0,0 +1,3 @@ +local_id,name,parent,description +media_accesscontrol_01,Media Group A,,"

Access group A for media tests

", +media_accesscontrol_02,Media Group B,,"

Access group B for media tests

", diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-audio.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-audio.csv index f9b4151d8..23be6858a 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-audio.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-audio.csv @@ -1,2 +1,2 @@ -local_id,name,original_name,mime_type,media_of,media_use,url -media_audio_00001,Moo Cow,moo.mp3,audio/mpeg,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/audio/moo.mp3 +local_id,name,access_terms,original_name,mime_type,media_of,media_use,url +media_audio_00001,Moo Cow,Media Group A|Media Group B,moo.mp3,audio/mpeg,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/audio/moo.mp3 diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-collection.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-collection.csv index ffb8853c9..68a3bb89b 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-collection.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-collection.csv @@ -1,2 +1,2 @@ -node_id,local_id,title,title_language,alternative_title,member_of,contact_email,contact_name,collection_number,description,finding_aid -,media-collection-01,Media Collection,English,,,,,,Collection for Media Migrations;eng, +node_id,local_id,title,title_language,alternative_title,member_of,contact_email,contact_name,collection_number,description,finding_aid,access_terms +,media-collection-01,Media Collection,English,,,,,,Collection for Media Migrations;eng,,Media Group A|Media Group B diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-document.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-document.csv index 35399878c..23f50ce6a 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-document.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-document.csv @@ -1,3 +1,3 @@ -local_id,name,original_name,mime_type,media_of,media_use,url -media_doc_00001,Fuji Acros Datasheet,Fuji_acros.pdf,application/pdf,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/document/Fuji_acros.pdf -media_doc_00002,Fuji Acros Datasheet,Fuji_acros.pdf,application/pdf,:::Media Migration Repository Item Two,Original File|Preservation Master File,http://migration-assets/assets/document/Fuji_acros.pdf +local_id,name,access_terms,original_name,mime_type,media_of,media_use,url +media_doc_00001,Fuji Acros Datasheet,Media Group A|Media Group B,Fuji_acros.pdf,application/pdf,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/document/Fuji_acros.pdf +media_doc_00002,Fuji Acros Datasheet,Media Group A|Media Group B,Fuji_acros.pdf,application/pdf,:::Media Migration Repository Item Two,Original File|Preservation Master File,http://migration-assets/assets/document/Fuji_acros.pdf diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-extracted_text.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-extracted_text.csv index ef2a63961..e07b69191 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-extracted_text.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-extracted_text.csv @@ -1,2 +1,2 @@ -local_id,name,mime_type,media_of,media_use,url -media_ext_00001,Hello World,text/plain,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/extracted_text/hello_world.txt +local_id,name,access_terms,mime_type,media_of,media_use,url +media_ext_00001,Hello World,Media Group A|Media Group B,text/plain,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/extracted_text/hello_world.txt diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-file.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-file.csv index d8e39b534..efe2aa585 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-file.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-file.csv @@ -1,2 +1,2 @@ -local_id,name,original_name,mime_type,media_of,media_use,url -media_file_00001,Geo Tif file,NEFF1851_GEO.tfw,application/octet-stream,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/file/NEFF1851_GEO.tfw +local_id,name,access_terms,original_name,mime_type,media_of,media_use,url +media_file_00001,Geo Tif file,Media Group A|Media Group B,NEFF1851_GEO.tfw,application/octet-stream,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/file/NEFF1851_GEO.tfw diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-image.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-image.csv index 778771a4d..3b59474b8 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-image.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-image.csv @@ -1,2 +1,2 @@ -local_id,name,original_name,mime_type,media_of,media_use,url,alt_text -media_img_00001,Looking For Fossils,TRP_7767.jpg,image/jpeg,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/image/TRP_7767.jpg,Image alt text +local_id,name,access_terms,original_name,mime_type,media_of,media_use,url,alt_text +media_img_00001,Looking For Fossils,Media Group A|Media Group B,TRP_7767.jpg,image/jpeg,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/image/TRP_7767.jpg,Image alt text diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-islandora_object.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-islandora_object.csv index 229d44c3c..ebb32f30f 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-islandora_object.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-islandora_object.csv @@ -1,3 +1,3 @@ -node_id,local_id,title,member_of -,media_io_01,Media Migration Repository Item One,:::Media Collection -,media_io_02,Media Migration Repository Item Two,:::Media Collection +node_id,local_id,title,access_terms,member_of +,media_io_01,Media Migration Repository Item One,Media Group A|Media Group B,:::Media Collection +,media_io_02,Media Migration Repository Item Two,Media Group A|Media Group B,:::Media Collection diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-remote_video.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-remote_video.csv index bbbf1d57f..f33f680d7 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-remote_video.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-remote_video.csv @@ -1,2 +1,2 @@ -local_id,name,media_of,url -media_rvideo_00001,A Tour of Go,:::Media Migration Repository Item One,https://www.youtube.com/watch?v=ytEkHepK08c +local_id,name,access_terms,media_of,url +media_rvideo_00001,A Tour of Go,Media Group A|Media Group B,:::Media Migration Repository Item One,https://www.youtube.com/watch?v=ytEkHepK08c diff --git a/tests/10-migration-backend-tests/testcafe/migrations/media-video.csv b/tests/10-migration-backend-tests/testcafe/migrations/media-video.csv index ebb4e19d7..31297f951 100644 --- a/tests/10-migration-backend-tests/testcafe/migrations/media-video.csv +++ b/tests/10-migration-backend-tests/testcafe/migrations/media-video.csv @@ -1,2 +1,2 @@ -local_id,name,original_name,mime_type,media_of,media_use,url -media_video_00001,Chair Pop Video,chair-pop-gif.mp4,video/mp4,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/video/chair-pop-gif.mp4 +local_id,name,access_terms,original_name,mime_type,media_of,media_use,url +media_video_00001,Chair Pop Video,Media Group A|Media Group B,chair-pop-gif.mp4,video/mp4,:::Media Migration Repository Item One,Original File|Preservation Master File,http://migration-assets/assets/video/chair-pop-gif.mp4 diff --git a/tests/10-migration-backend-tests/verification/expected/collection-01.json b/tests/10-migration-backend-tests/verification/expected/collection-01.json index d2e4323c2..48727325c 100644 --- a/tests/10-migration-backend-tests/verification/expected/collection-01.json +++ b/tests/10-migration-backend-tests/verification/expected/collection-01.json @@ -28,9 +28,7 @@ "collection_number": [ "1", "2" ], - "member_of": [ - "Parent Collection" - ], + "member_of": "Parent Collection", "access_terms": [ "Parent Collection" ], diff --git a/tests/10-migration-backend-tests/verification/expected/collection-03.json b/tests/10-migration-backend-tests/verification/expected/collection-03.json index 8eb1959b5..cfad87c8d 100644 --- a/tests/10-migration-backend-tests/verification/expected/collection-03.json +++ b/tests/10-migration-backend-tests/verification/expected/collection-03.json @@ -28,9 +28,7 @@ "collection_number": [ "1", "2" ], - "member_of": [ - "Parent Collection" - ], + "member_of": "Parent Collection", "finding_aid": [ { "uri": "http://wikipedia.org" diff --git a/tests/10-migration-backend-tests/verification/expected/item-01.json b/tests/10-migration-backend-tests/verification/expected/item-01.json index 0fe65de25..d7c3c02da 100644 --- a/tests/10-migration-backend-tests/verification/expected/item-01.json +++ b/tests/10-migration-backend-tests/verification/expected/item-01.json @@ -132,10 +132,7 @@ "http://catalog.library.jhu.edu", "http://example.org/other_catalog_link" ], - "member_of": [ - "Images Collection", - "Ansel Adams" - ], + "member_of": "Images Collection", "access_terms": [ "Images Collection", "Ansel Adams" diff --git a/tests/10-migration-backend-tests/verification/expected/media-audio.json b/tests/10-migration-backend-tests/verification/expected/media-audio.json index ee04a1efc..9ac061894 100644 --- a/tests/10-migration-backend-tests/verification/expected/media-audio.json +++ b/tests/10-migration-backend-tests/verification/expected/media-audio.json @@ -9,6 +9,10 @@ "Preservation Master File", "Original File" ], + "access_terms": [ + "Media Group B", + "Media Group A" + ], "media_of": "Media Migration Repository Item One", "uri": { "url": "/system/files/76/6d/51/a112896d48d3457fb3c5fa5fbdf661713d", diff --git a/tests/10-migration-backend-tests/verification/expected/media-document.json b/tests/10-migration-backend-tests/verification/expected/media-document.json index f8d6c4577..154eccced 100644 --- a/tests/10-migration-backend-tests/verification/expected/media-document.json +++ b/tests/10-migration-backend-tests/verification/expected/media-document.json @@ -9,6 +9,10 @@ "Preservation Master File", "Original File" ], + "access_terms": [ + "Media Group B", + "Media Group A" + ], "media_of": "Media Migration Repository Item One", "uri": { "url": "/system/files/c9/a0/60/c39365820edc5d1a51f221d49e96a8a730", diff --git a/tests/10-migration-backend-tests/verification/expected/media-extracted_text.json b/tests/10-migration-backend-tests/verification/expected/media-extracted_text.json index 5d4c6a5b0..c6793f1b2 100644 --- a/tests/10-migration-backend-tests/verification/expected/media-extracted_text.json +++ b/tests/10-migration-backend-tests/verification/expected/media-extracted_text.json @@ -9,6 +9,10 @@ "Preservation Master File", "Original File" ], + "access_terms": [ + "Media Group B", + "Media Group A" + ], "media_of": "Media Migration Repository Item One", "uri": { "url": "/system/files/53/06/43/aaed48b24d41bbe075579df620204d06d1", diff --git a/tests/10-migration-backend-tests/verification/expected/media-file.json b/tests/10-migration-backend-tests/verification/expected/media-file.json index f801e3bd1..b0bc95ed3 100644 --- a/tests/10-migration-backend-tests/verification/expected/media-file.json +++ b/tests/10-migration-backend-tests/verification/expected/media-file.json @@ -9,6 +9,10 @@ "Preservation Master File", "Original File" ], + "access_terms": [ + "Media Group B", + "Media Group A" + ], "media_of": "Media Migration Repository Item One", "uri": { "url": "/system/files/2b/ad/93/5635dd338a834b391d8497bb02620341fa", diff --git a/tests/10-migration-backend-tests/verification/expected/media-image.json b/tests/10-migration-backend-tests/verification/expected/media-image.json index 995082292..32b82978a 100644 --- a/tests/10-migration-backend-tests/verification/expected/media-image.json +++ b/tests/10-migration-backend-tests/verification/expected/media-image.json @@ -12,6 +12,10 @@ "Preservation Master File", "Original File" ], + "access_terms": [ + "Media Group B", + "Media Group A" + ], "media_of": "Media Migration Repository Item One", "uri": { "url": "/system/files/2021-03/trp_7767.jpg", diff --git a/tests/10-migration-backend-tests/verification/expected/media-remote_video.json b/tests/10-migration-backend-tests/verification/expected/media-remote_video.json index dca8690cd..fbb5d4506 100644 --- a/tests/10-migration-backend-tests/verification/expected/media-remote_video.json +++ b/tests/10-migration-backend-tests/verification/expected/media-remote_video.json @@ -2,6 +2,10 @@ "type": "media", "bundle": "remote_video", "name": "A Tour of Go", + "access_terms": [ + "Media Group B", + "Media Group A" + ], "media_of": "Media Migration Repository Item One", "embed_url": "https://www.youtube.com/watch?v=ytEkHepK08c" -} \ No newline at end of file +} diff --git a/tests/10-migration-backend-tests/verification/expected/media-video.json b/tests/10-migration-backend-tests/verification/expected/media-video.json index 236e486ab..2749b3fc4 100644 --- a/tests/10-migration-backend-tests/verification/expected/media-video.json +++ b/tests/10-migration-backend-tests/verification/expected/media-video.json @@ -9,6 +9,10 @@ "Preservation Master File", "Original File" ], + "access_terms": [ + "Media Group B", + "Media Group A" + ], "media_of": "Media Migration Repository Item One", "uri": { "url": "/system/files/34/e9/34/86f9a355930ac2c14f067082e6d584ea24", diff --git a/tests/10-migration-backend-tests/verification/expected_json_types_test.go b/tests/10-migration-backend-tests/verification/expected_json_types_test.go index c89c6a48a..1bb8a6bdc 100644 --- a/tests/10-migration-backend-tests/verification/expected_json_types_test.go +++ b/tests/10-migration-backend-tests/verification/expected_json_types_test.go @@ -100,7 +100,7 @@ type ExpectedRepoObj struct { Subject []string Title string TableOfContents []LanguageString `json:"toc"` - MemberOf []string `json:"member_of"` + MemberOf string `json:"member_of"` LinkedAgent []struct { Rel string Name string @@ -287,7 +287,7 @@ type ExpectedCollection struct { ContactEmail string `json:"contact_email"` ContactName string `json:"contact_name"` CollectionNumber []string `json:"collection_number"` - MemberOf []string `json:"member_of"` + MemberOf string `json:"member_of"` AccessTerms []string `json:"access_terms"` FindingAid []struct { Uri string @@ -335,6 +335,7 @@ type ExpectedMediaGeneric struct { OriginalName string `json:"original_name"` Size int MimeType string `json:"mime_type"` + AccessTerms []string `json:"access_terms"` MediaUse []string `json:"use"` MediaOf string `json:"media_of"` Uri struct { diff --git a/tests/10-migration-backend-tests/verification/jsonapi_types_test.go b/tests/10-migration-backend-tests/verification/jsonapi_types_test.go index 657d126eb..e59d19329 100644 --- a/tests/10-migration-backend-tests/verification/jsonapi_types_test.go +++ b/tests/10-migration-backend-tests/verification/jsonapi_types_test.go @@ -294,7 +294,7 @@ type JsonApiCollection struct { Data []JsonApiData } `json:"field_access_terms"` MemberOf struct { - Data []JsonApiData + Data JsonApiData } `json:"field_member_of"` } `json:"relationships"` } `json:"data"` @@ -389,7 +389,7 @@ type JsonApiIslandoraObj struct { Data JsonApiData } `json:"field_model"` MemberOf struct { - Data []JsonApiData + Data JsonApiData } `json:"field_member_of"` Publisher struct { Data []JsonApiData @@ -715,6 +715,9 @@ type JsonApiMediaAttributes struct { } type JsonApiMediaRelationships struct { + AccessTerms struct { + Data []JsonApiData + } `json:"field_access_terms"` MediaUse struct { Data []JsonApiData } `json:"field_media_use"` diff --git a/tests/10-migration-backend-tests/verification/verify_migrations_test.go b/tests/10-migration-backend-tests/verification/verify_migrations_test.go index c434f18ee..6b72746c7 100644 --- a/tests/10-migration-backend-tests/verification/verify_migrations_test.go +++ b/tests/10-migration-backend-tests/verification/verify_migrations_test.go @@ -693,25 +693,21 @@ func Test_VerifyCollection(t *testing.T) { // Resolve and verify member_of values assert.NotNil(t, relData.MemberOf) - assert.Equal(t, 1, len(relData.MemberOf.Data)) - assert.Equal(t, len(expectedJson.MemberOf), len(relData.MemberOf.Data)) - for i, memberOfData := range relData.MemberOf.Data { - assert.Equal(t, "node", memberOfData.Type.entity()) - assert.Equal(t, "collection_object", memberOfData.Type.bundle()) + assert.Equal(t, "node", relData.MemberOf.Data.Type.entity()) + assert.Equal(t, "collection_object", relData.MemberOf.Data.Type.bundle()) - u = &JsonApiUrl{ - t: t, - baseUrl: DrupalBaseurl, - drupalEntity: memberOfData.Type.entity(), - drupalBundle: memberOfData.Type.bundle(), - filter: "id", - value: memberOfData.Id, - } - memberCol := JsonApiCollection{} - u.getSingle(&memberCol) - - assert.Equal(t, expectedJson.MemberOf[i], memberCol.JsonApiData[0].JsonApiAttributes.Title) + u = &JsonApiUrl{ + t: t, + baseUrl: DrupalBaseurl, + drupalEntity: relData.MemberOf.Data.Type.entity(), + drupalBundle: relData.MemberOf.Data.Type.bundle(), + filter: "id", + value: relData.MemberOf.Data.Id, } + memberCol := JsonApiCollection{} + u.getSingle(&memberCol) + + assert.Equal(t, expectedJson.MemberOf, memberCol.JsonApiData[0].JsonApiAttributes.Title) // Resolve and verify access_terms values assert.NotNil(t, relData.AccessTerms) @@ -985,13 +981,10 @@ func Test_VerifyRepositoryItem(t *testing.T) { } // Member Of - assert.Equal(t, 2, len(expectedJson.MemberOf)) - assert.Equal(t, len(expectedJson.MemberOf), len(relData.MemberOf.Data)) - for i := range relData.MemberOf.Data { - collection := &JsonApiCollection{} - relData.MemberOf.Data[i].resolve(t, collection) - assert.Equal(t, expectedJson.MemberOf[i], collection.JsonApiData[0].JsonApiAttributes.Title) - } + assert.NotNil(t, relData.MemberOf) + collection := &JsonApiCollection{} + relData.MemberOf.Data.resolve(t, collection) + assert.Equal(t, expectedJson.MemberOf, collection.JsonApiData[0].JsonApiAttributes.Title) // Model model := &JsonApiIslandoraModel{} @@ -1170,6 +1163,13 @@ func Test_VerifyMediaDocument(t *testing.T) { assert.Equal(t, expectedJson.Name, document.JsonApiAttributes.Name) // Resolve relationships and verify + assert.Equal(t, 2, len(expectedJson.AccessTerms)) + assert.Equal(t, len(expectedJson.AccessTerms), len(document.JsonApiRelationships.AccessTerms.Data)) + for i := range document.JsonApiRelationships.AccessTerms.Data { + use := JsonApiIslandoraAccessTerms{} + document.JsonApiRelationships.AccessTerms.Data[i].resolve(t, &use) + assert.Equal(t, expectedJson.AccessTerms[i], use.JsonApiData[0].JsonApiAttributes.Name) + } assert.Equal(t, 2, len(expectedJson.MediaUse)) assert.Equal(t, len(expectedJson.MediaUse), len(document.JsonApiRelationships.MediaUse.Data)) @@ -1218,6 +1218,14 @@ func Test_VerifyMediaImage(t *testing.T) { // Resolve relationships and verify + assert.Equal(t, 2, len(expectedJson.AccessTerms)) + assert.Equal(t, len(expectedJson.AccessTerms), len(image.JsonApiRelationships.AccessTerms.Data)) + for i := range image.JsonApiRelationships.AccessTerms.Data { + use := JsonApiIslandoraAccessTerms{} + image.JsonApiRelationships.AccessTerms.Data[i].resolve(t, &use) + assert.Equal(t, expectedJson.AccessTerms[i], use.JsonApiData[0].JsonApiAttributes.Name) + } + assert.Equal(t, expectedJson.AltText, image.JsonApiRelationships.File.Data.Meta["alt"]) assert.Equal(t, 2, len(expectedJson.MediaUse)) @@ -1264,6 +1272,14 @@ func Test_VerifyMediaExtractedText(t *testing.T) { // Resolve relationships and verify + assert.Equal(t, 2, len(expectedJson.AccessTerms)) + assert.Equal(t, len(expectedJson.AccessTerms), len(ext.JsonApiRelationships.AccessTerms.Data)) + for i := range ext.JsonApiRelationships.AccessTerms.Data { + use := JsonApiIslandoraAccessTerms{} + ext.JsonApiRelationships.AccessTerms.Data[i].resolve(t, &use) + assert.Equal(t, expectedJson.AccessTerms[i], use.JsonApiData[0].JsonApiAttributes.Name) + } + assert.Equal(t, 2, len(expectedJson.MediaUse)) assert.Equal(t, len(expectedJson.MediaUse), len(ext.JsonApiRelationships.MediaUse.Data)) for i := range ext.JsonApiRelationships.MediaUse.Data { @@ -1316,6 +1332,14 @@ func Test_VerifyMediaFile(t *testing.T) { // Resolve relationships and verify + assert.Equal(t, 2, len(expectedJson.AccessTerms)) + assert.Equal(t, len(expectedJson.AccessTerms), len(genericFile.JsonApiRelationships.AccessTerms.Data)) + for i := range genericFile.JsonApiRelationships.AccessTerms.Data { + use := JsonApiIslandoraAccessTerms{} + genericFile.JsonApiRelationships.AccessTerms.Data[i].resolve(t, &use) + assert.Equal(t, expectedJson.AccessTerms[i], use.JsonApiData[0].JsonApiAttributes.Name) + } + assert.Equal(t, 2, len(expectedJson.MediaUse)) assert.Equal(t, len(expectedJson.MediaUse), len(genericFile.JsonApiRelationships.MediaUse.Data)) for i := range genericFile.JsonApiRelationships.MediaUse.Data { @@ -1368,6 +1392,14 @@ func Test_VerifyMediaAudio(t *testing.T) { // Resolve relationships and verify + assert.Equal(t, 2, len(expectedJson.AccessTerms)) + assert.Equal(t, len(expectedJson.AccessTerms), len(audio.JsonApiRelationships.AccessTerms.Data)) + for i := range audio.JsonApiRelationships.AccessTerms.Data { + use := JsonApiIslandoraAccessTerms{} + audio.JsonApiRelationships.AccessTerms.Data[i].resolve(t, &use) + assert.Equal(t, expectedJson.AccessTerms[i], use.JsonApiData[0].JsonApiAttributes.Name) + } + assert.Equal(t, 2, len(expectedJson.MediaUse)) assert.Equal(t, len(expectedJson.MediaUse), len(audio.JsonApiRelationships.MediaUse.Data)) for i := range audio.JsonApiRelationships.MediaUse.Data { @@ -1420,6 +1452,14 @@ func Test_VerifyMediaVideo(t *testing.T) { // Resolve relationships and verify + assert.Equal(t, 2, len(expectedJson.AccessTerms)) + assert.Equal(t, len(expectedJson.AccessTerms), len(video.JsonApiRelationships.AccessTerms.Data)) + for i := range video.JsonApiRelationships.AccessTerms.Data { + use := JsonApiIslandoraAccessTerms{} + video.JsonApiRelationships.AccessTerms.Data[i].resolve(t, &use) + assert.Equal(t, expectedJson.AccessTerms[i], use.JsonApiData[0].JsonApiAttributes.Name) + } + assert.Equal(t, 2, len(expectedJson.MediaUse)) assert.Equal(t, len(expectedJson.MediaUse), len(video.JsonApiRelationships.MediaUse.Data)) for i := range video.JsonApiRelationships.MediaUse.Data {