hyrax 3.0.0.pre.rc2 → 3.0.0.pre.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +5 -5
- data/.dassie/.env +4 -0
- data/.dassie/.gitignore +27 -0
- data/.dassie/Gemfile +57 -0
- data/.dassie/README.md +3 -0
- data/.dassie/Rakefile +6 -0
- data/.dassie/app/actors/hyrax/actors/generic_work_actor.rb +8 -0
- data/.dassie/app/actors/hyrax/actors/namespaced_works/nested_work_actor.rb +8 -0
- data/.dassie/app/assets/config/manifest.js +3 -0
- data/.dassie/app/assets/images/.keep +0 -0
- data/.dassie/app/assets/images/unauthorized.png +0 -0
- data/.dassie/app/assets/images/us_404.svg +91 -0
- data/.dassie/app/assets/javascripts/application.js +26 -0
- data/.dassie/app/assets/javascripts/blacklight_gallery.js +1 -0
- data/.dassie/app/assets/javascripts/cable.js +13 -0
- data/.dassie/app/assets/javascripts/channels/.keep +0 -0
- data/.dassie/app/assets/javascripts/openseadragon.js +2 -0
- data/.dassie/app/assets/stylesheets/application.css +16 -0
- data/.dassie/app/assets/stylesheets/hyrax.scss +17 -0
- data/.dassie/app/assets/stylesheets/openseadragon.css +3 -0
- data/.dassie/app/channels/application_cable/channel.rb +4 -0
- data/.dassie/app/channels/application_cable/connection.rb +4 -0
- data/.dassie/app/controllers/application_controller.rb +14 -0
- data/.dassie/app/controllers/catalog_controller.rb +300 -0
- data/.dassie/app/controllers/concerns/.keep +0 -0
- data/.dassie/app/controllers/hyrax/generic_works_controller.rb +14 -0
- data/.dassie/app/controllers/hyrax/monographs_controller.rb +17 -0
- data/.dassie/app/controllers/hyrax/namespaced_works/nested_works_controller.rb +14 -0
- data/.dassie/app/forms/hyrax/generic_work_form.rb +9 -0
- data/.dassie/app/forms/hyrax/namespaced_works/nested_work_form.rb +9 -0
- data/.dassie/app/forms/monograph_form.rb +20 -0
- data/.dassie/app/helpers/application_helper.rb +2 -0
- data/.dassie/app/helpers/hyrax_helper.rb +6 -0
- data/.dassie/app/indexers/generic_work_indexer.rb +18 -0
- data/.dassie/app/indexers/monograph_indexer.rb +16 -0
- data/.dassie/app/indexers/namespaced_works/nested_work_indexer.rb +18 -0
- data/.dassie/app/jobs/application_job.rb +2 -0
- data/.dassie/app/mailers/application_mailer.rb +4 -0
- data/.dassie/app/models/ability.rb +21 -0
- data/.dassie/app/models/application_record.rb +3 -0
- data/.dassie/app/models/collection.rb +8 -0
- data/.dassie/app/models/concerns/.keep +0 -0
- data/.dassie/app/models/file_set.rb +5 -0
- data/.dassie/app/models/generic_work.rb +14 -0
- data/.dassie/app/models/monograph.rb +8 -0
- data/.dassie/app/models/namespaced_works/nested_work.rb +16 -0
- data/.dassie/app/models/qa.rb +5 -0
- data/.dassie/app/models/qa/local_authority.rb +2 -0
- data/.dassie/app/models/qa/local_authority_entry.rb +3 -0
- data/.dassie/app/models/search_builder.rb +16 -0
- data/.dassie/app/models/solr_document.rb +28 -0
- data/.dassie/app/models/time_span.rb +22 -0
- data/.dassie/app/models/user.rb +26 -0
- data/.dassie/app/presenters/hyrax/generic_work_presenter.rb +6 -0
- data/.dassie/app/presenters/hyrax/namespaced_works/nested_work_presenter.rb +6 -0
- data/.dassie/app/views/hyrax/generic_works/_generic_work.html.erb +2 -0
- data/.dassie/app/views/hyrax/monographs/_monograph.html.erb +2 -0
- data/.dassie/app/views/hyrax/namespaced_works/nested_works/_nested_work.html.erb +2 -0
- data/.dassie/app/views/layouts/application.html.erb +15 -0
- data/.dassie/app/views/layouts/mailer.html.erb +13 -0
- data/.dassie/app/views/layouts/mailer.text.erb +1 -0
- data/.dassie/bin/bundle +3 -0
- data/.dassie/bin/rails +9 -0
- data/.dassie/bin/rake +9 -0
- data/.dassie/bin/setup +36 -0
- data/.dassie/bin/spring +17 -0
- data/.dassie/bin/update +31 -0
- data/.dassie/bin/yarn +11 -0
- data/.dassie/config.ru +5 -0
- data/.dassie/config/analytics.yml +6 -0
- data/.dassie/config/application.rb +22 -0
- data/.dassie/config/arkivo.yml +6 -0
- data/.dassie/config/authorities/licenses.yml +46 -0
- data/.dassie/config/authorities/resource_types.yml +41 -0
- data/.dassie/config/authorities/rights_statements.yml +37 -0
- data/.dassie/config/blacklight.yml +9 -0
- data/.dassie/config/boot.rb +4 -0
- data/.dassie/config/browse_everything_providers.yml +2 -0
- data/.dassie/config/cable.yml +10 -0
- data/.dassie/config/credentials.yml.enc +1 -0
- data/.dassie/config/environment.rb +5 -0
- data/.dassie/config/environments/development.rb +69 -0
- data/.dassie/config/environments/production.rb +94 -0
- data/.dassie/config/environments/test.rb +51 -0
- data/.dassie/config/fedora.yml +15 -0
- data/.dassie/config/initializers/arkivo_constraint.rb +12 -0
- data/.dassie/config/initializers/assets.rb +2 -0
- data/.dassie/config/initializers/clamav.rb +2 -0
- data/.dassie/config/initializers/cookies_serializer.rb +1 -0
- data/.dassie/config/initializers/devise.rb +13 -0
- data/.dassie/config/initializers/filter_parameter_logging.rb +1 -0
- data/.dassie/config/initializers/hydra_config.rb +6 -0
- data/.dassie/config/initializers/hyrax.rb +48 -0
- data/.dassie/config/initializers/mailboxer.rb +21 -0
- data/.dassie/config/initializers/mime_types.rb +4 -0
- data/.dassie/config/initializers/mini_magick.rb +6 -0
- data/.dassie/config/initializers/redis_config.rb +4 -0
- data/.dassie/config/initializers/riiif.rb +27 -0
- data/.dassie/config/initializers/simple_form.rb +28 -0
- data/.dassie/config/initializers/simple_form_bootstrap.rb +143 -0
- data/.dassie/config/initializers/wrap_parameters.rb +3 -0
- data/.dassie/config/locales/blacklight.en.yml +3 -0
- data/.dassie/config/locales/devise.en.yml +65 -0
- data/.dassie/config/locales/generic_work.de.yml +8 -0
- data/.dassie/config/locales/generic_work.en.yml +8 -0
- data/.dassie/config/locales/generic_work.es.yml +10 -0
- data/.dassie/config/locales/generic_work.fr.yml +8 -0
- data/.dassie/config/locales/generic_work.it.yml +8 -0
- data/.dassie/config/locales/generic_work.pt-BR.yml +8 -0
- data/.dassie/config/locales/generic_work.zh.yml +10 -0
- data/.dassie/config/locales/hyrax.de.yml +58 -0
- data/.dassie/config/locales/hyrax.en.yml +58 -0
- data/.dassie/config/locales/hyrax.es.yml +58 -0
- data/.dassie/config/locales/hyrax.fr.yml +58 -0
- data/.dassie/config/locales/hyrax.it.yml +58 -0
- data/.dassie/config/locales/hyrax.pt-BR.yml +58 -0
- data/.dassie/config/locales/hyrax.zh.yml +58 -0
- data/.dassie/config/locales/namespaced_works/nested_work.de.yml +8 -0
- data/.dassie/config/locales/namespaced_works/nested_work.en.yml +8 -0
- data/.dassie/config/locales/namespaced_works/nested_work.es.yml +10 -0
- data/.dassie/config/locales/namespaced_works/nested_work.fr.yml +8 -0
- data/.dassie/config/locales/namespaced_works/nested_work.it.yml +8 -0
- data/.dassie/config/locales/namespaced_works/nested_work.pt-BR.yml +8 -0
- data/.dassie/config/locales/namespaced_works/nested_work.zh.yml +10 -0
- data/.dassie/config/metadata/monograph.yaml +55 -0
- data/.dassie/config/metadata/sample_metadata.yaml +3 -0
- data/.dassie/config/puma.rb +6 -0
- data/.dassie/config/redis.yml +9 -0
- data/.dassie/config/role_map.yml +24 -0
- data/.dassie/config/routes.rb +35 -0
- data/.dassie/config/solr.yml +7 -0
- data/.dassie/config/spring.rb +6 -0
- data/.dassie/config/storage.yml +7 -0
- data/.dassie/config/tinymce.yml +12 -0
- data/.dassie/config/uv/uv-config.json +3 -0
- data/.dassie/config/uv/uv.html +87 -0
- data/.dassie/config/valkyrie_index.yml +12 -0
- data/.dassie/config/workflows/default_workflow.json +21 -0
- data/.dassie/config/workflows/mediated_deposit_workflow.json +76 -0
- data/.dassie/config/zotero.yml +6 -0
- data/.dassie/db/migrate/20200821212749_create_searches.blacklight.rb +17 -0
- data/.dassie/db/migrate/20200821212750_create_bookmarks.blacklight.rb +19 -0
- data/.dassie/db/migrate/20200821212751_add_polymorphic_type_to_bookmarks.blacklight.rb +9 -0
- data/.dassie/db/migrate/20200821212803_devise_create_users.rb +44 -0
- data/.dassie/db/migrate/20200821212806_add_devise_guests_to_users.rb +15 -0
- data/.dassie/db/migrate/20200821212828_create_version_committers.hyrax.rb +15 -0
- data/.dassie/db/migrate/20200821212829_create_checksum_audit_logs.hyrax.rb +19 -0
- data/.dassie/db/migrate/20200821212830_create_single_use_links.hyrax.rb +12 -0
- data/.dassie/db/migrate/20200821212831_add_social_to_users.hyrax.rb +13 -0
- data/.dassie/db/migrate/20200821212832_add_ldap_attrs_to_user.hyrax.rb +27 -0
- data/.dassie/db/migrate/20200821212833_add_avatars_to_users.hyrax.rb +15 -0
- data/.dassie/db/migrate/20200821212834_create_trophies.hyrax.rb +10 -0
- data/.dassie/db/migrate/20200821212835_add_linkedin_to_users.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212836_create_tinymce_assets.hyrax.rb +8 -0
- data/.dassie/db/migrate/20200821212837_create_content_blocks.hyrax.rb +10 -0
- data/.dassie/db/migrate/20200821212838_create_featured_works.hyrax.rb +12 -0
- data/.dassie/db/migrate/20200821212839_add_external_key_to_content_blocks.hyrax.rb +6 -0
- data/.dassie/db/migrate/20200821212840_create_proxy_deposit_rights.hyrax.rb +10 -0
- data/.dassie/db/migrate/20200821212841_create_proxy_deposit_requests.hyrax.rb +15 -0
- data/.dassie/db/migrate/20200821212842_create_file_view_stats.hyrax.rb +12 -0
- data/.dassie/db/migrate/20200821212843_create_file_download_stats.hyrax.rb +12 -0
- data/.dassie/db/migrate/20200821212844_add_orcid_to_users.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212845_create_user_stats.hyrax.rb +19 -0
- data/.dassie/db/migrate/20200821212846_create_work_view_stats.hyrax.rb +12 -0
- data/.dassie/db/migrate/20200821212847_add_works_to_user_stats.hyrax.rb +13 -0
- data/.dassie/db/migrate/20200821212848_change_trophy_generic_file_id_to_work_id.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212849_change_proxy_deposit_generic_file_id_to_work_id.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212850_change_audit_log_generic_file_id_to_file_set_id.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212851_change_proxy_deposit_request_generic_file_id_to_work_id.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212852_create_uploaded_files.hyrax.rb +10 -0
- data/.dassie/db/migrate/20200821212853_create_features.hyrax.rb +10 -0
- data/.dassie/db/migrate/20200821212854_create_operations.hyrax.rb +23 -0
- data/.dassie/db/migrate/20200821212855_change_featured_work_generic_file_id_to_work_id.hyrax.rb +6 -0
- data/.dassie/db/migrate/20200821212856_add_arkivo_to_users.hyrax.rb +8 -0
- data/.dassie/db/migrate/20200821212857_create_sipity.hyrax.rb +163 -0
- data/.dassie/db/migrate/20200821212858_create_sipity_workflow_methods.hyrax.rb +10 -0
- data/.dassie/db/migrate/20200821212859_create_permission_template.hyrax.rb +11 -0
- data/.dassie/db/migrate/20200821212860_create_permission_template_access.hyrax.rb +11 -0
- data/.dassie/db/migrate/20200821212861_add_release_to_permission_templates.hyrax.rb +6 -0
- data/.dassie/db/migrate/20200821212862_add_permission_template_to_sipity_workflow.hyrax.rb +26 -0
- data/.dassie/db/migrate/20200821212863_tidy_up_because_of_bad_exception.hyrax.rb +13 -0
- data/.dassie/db/migrate/20200821212864_add_allows_access_grant_to_workflow.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212865_change_checksum_audit_log.hyrax.rb +18 -0
- data/.dassie/db/migrate/20200821212866_create_job_io_wrappers.hyrax.rb +15 -0
- data/.dassie/db/migrate/20200821212867_create_collection_types.hyrax.rb +17 -0
- data/.dassie/db/migrate/20200821212868_update_collection_type_column_names.hyrax.rb +9 -0
- data/.dassie/db/migrate/20200821212869_update_collection_type_column_options.hyrax.rb +17 -0
- data/.dassie/db/migrate/20200821212870_create_collection_branding_infos.hyrax.rb +15 -0
- data/.dassie/db/migrate/20200821212871_create_collection_type_participants.hyrax.rb +11 -0
- data/.dassie/db/migrate/20200821212872_rename_admin_set_id_to_source_id.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212873_add_preferred_locale_to_users.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212874_add_collection_type_sharing_options.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212875_add_unique_constraint_to_permission_template_accesses.hyrax.rb +8 -0
- data/.dassie/db/migrate/20200821212876_add_branding_to_collection_type.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212877_add_badge_color_to_collection_types.hyrax.rb +5 -0
- data/.dassie/db/migrate/20200821212878_update_single_use_links_column_names.hyrax.rb +6 -0
- data/.dassie/db/migrate/20200821212879_change_sipity_entity_specific_responsibility.hyrax.rb +9 -0
- data/.dassie/db/migrate/20200821212880_create_mailboxer.mailboxer_engine.rb +65 -0
- data/.dassie/db/migrate/20200821212881_add_conversation_optout.mailboxer_engine.rb +15 -0
- data/.dassie/db/migrate/20200821212882_add_missing_indices.mailboxer_engine.rb +20 -0
- data/.dassie/db/migrate/20200821212883_add_delivery_tracking_info_to_mailboxer_receipts.mailboxer_engine.rb +8 -0
- data/.dassie/db/migrate/20200821212884_create_qa_local_authorities.rb +10 -0
- data/.dassie/db/migrate/20200821212885_create_qa_local_authority_entries.rb +12 -0
- data/.dassie/db/migrate/20200821212902_create_minter_states.noid_rails_engine.rb +17 -0
- data/.dassie/db/migrate/20200821212903_rename_minter_state_random_to_rand.noid_rails_engine.rb +8 -0
- data/.dassie/db/schema.rb +563 -0
- data/.dassie/db/seeds.rb +14 -0
- data/.dassie/lib/assets/.keep +0 -0
- data/.dassie/lib/tasks/.keep +0 -0
- data/.dassie/log/.keep +0 -0
- data/.dassie/package.json +17 -0
- data/.dassie/public/404.html +67 -0
- data/.dassie/public/422.html +67 -0
- data/.dassie/public/500.html +66 -0
- data/.dassie/public/apple-touch-icon-precomposed.png +0 -0
- data/.dassie/public/apple-touch-icon.png +0 -0
- data/.dassie/public/favicon.ico +0 -0
- data/.dassie/public/robots.txt +1 -0
- data/.dassie/solr/conf/_rest_managed.json +3 -0
- data/.dassie/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/.dassie/solr/conf/schema.xml +367 -0
- data/.dassie/solr/conf/scripts.conf +24 -0
- data/.dassie/solr/conf/solrconfig.xml +208 -0
- data/.dassie/solr/conf/stopwords.txt +58 -0
- data/.dassie/solr/conf/stopwords_en.txt +58 -0
- data/.dassie/solr/conf/xslt/example.xsl +132 -0
- data/.dassie/solr/conf/xslt/example_atom.xsl +67 -0
- data/.dassie/solr/conf/xslt/example_rss.xsl +66 -0
- data/.dassie/solr/conf/xslt/luke.xsl +337 -0
- data/.dassie/solr/sample_solr_documents.yml +2692 -0
- data/.dassie/storage/.keep +0 -0
- data/.dassie/values.stage.yaml +7 -0
- data/.dassie/values.yaml +15 -0
- data/.dassie/vendor/.keep +0 -0
- data/.dockerignore +11 -0
- data/.env +26 -0
- data/.github/CODE_OF_CONDUCT.md +4 -4
- data/.github/CONTRIBUTING.md +1 -1
- data/.github/SUPPORT.md +13 -1
- data/.gitignore +1 -1
- data/.regen +1 -1
- data/.rubocop.yml +1 -0
- data/.rubocop_fixme.yml +4 -0
- data/CODE_OF_CONDUCT.md +4 -4
- data/CONTAINERS.md +148 -0
- data/CONTRIBUTING.md +1 -1
- data/Dockerfile +75 -0
- data/Gemfile +26 -35
- data/README.md +61 -288
- data/app/actors/hyrax/actors/attach_members_actor.rb +7 -5
- data/app/actors/hyrax/actors/base_actor.rb +0 -1
- data/app/actors/hyrax/actors/create_with_files_ordered_members_actor.rb +28 -28
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +2 -3
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +23 -28
- data/app/actors/hyrax/actors/default_admin_set_actor.rb +20 -21
- data/app/actors/hyrax/actors/file_actor.rb +32 -32
- data/app/actors/hyrax/actors/file_set_actor.rb +4 -15
- data/app/actors/hyrax/actors/initialize_workflow_actor.rb +8 -0
- data/app/actors/hyrax/actors/transfer_request_actor.rb +5 -0
- data/app/assets/javascripts/hyrax.js +1 -0
- data/app/assets/javascripts/hyrax/skip_to_content.js +15 -0
- data/app/assets/stylesheets/hyrax/_usage-stats.scss +1 -1
- data/app/authorities/qa/authorities/collections.rb +18 -8
- data/app/authorities/qa/authorities/find_works.rb +20 -5
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +15 -6
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +62 -31
- data/app/controllers/hyrax/dashboard/collections_controller.rb +22 -12
- data/app/controllers/hyrax/dashboard/works_controller.rb +3 -4
- data/app/controllers/hyrax/file_sets_controller.rb +19 -10
- data/app/controllers/hyrax/homepage_controller.rb +11 -11
- data/app/controllers/hyrax/my/collections_controller.rb +5 -6
- data/app/controllers/hyrax/my/highlights_controller.rb +2 -3
- data/app/controllers/hyrax/my/shares_controller.rb +2 -3
- data/app/controllers/hyrax/my/works_controller.rb +1 -6
- data/app/controllers/hyrax/my_controller.rb +10 -2
- data/app/controllers/hyrax/permissions_controller.rb +1 -0
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +11 -5
- data/app/controllers/hyrax/users_controller.rb +5 -10
- data/app/forms/hyrax/forms/failed_submission_form_wrapper.rb +136 -0
- data/app/forms/hyrax/forms/resource_form.rb +8 -4
- data/app/helpers/hyrax/collections_helper.rb +1 -1
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +7 -2
- data/app/helpers/hyrax/embargo_helper.rb +5 -1
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +10 -5
- data/app/helpers/hyrax/lease_helper.rb +5 -1
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +21 -0
- data/app/indexers/hyrax/resource_indexer.rb +3 -1
- data/app/indexers/hyrax/valkyrie_collection_indexer.rb +3 -12
- data/app/indexers/hyrax/valkyrie_indexer.rb +45 -17
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +16 -0
- data/app/jobs/attach_files_to_work_job.rb +3 -41
- data/app/jobs/embargo_expiry_job.rb +15 -0
- data/app/jobs/event_job.rb +14 -7
- data/app/jobs/hyrax/application_job.rb +6 -1
- data/app/jobs/import_url_job.rb +11 -5
- data/app/jobs/inherit_permissions_job.rb +6 -25
- data/app/jobs/lease_expiry_job.rb +15 -0
- data/app/models/admin_set.rb +1 -1
- data/app/models/concerns/hyrax/ability.rb +192 -21
- data/app/models/concerns/hyrax/ability/admin_set_ability.rb +0 -5
- data/app/models/concerns/hyrax/collection_behavior.rb +7 -13
- data/app/models/concerns/hyrax/permissions/writable.rb +2 -2
- data/app/models/concerns/hyrax/solr_document/characterization.rb +35 -2
- data/app/models/concerns/hyrax/solr_document_behavior.rb +37 -5
- data/app/models/hyrax/change_set.rb +5 -1
- data/app/models/hyrax/collection_type.rb +59 -22
- data/app/models/hyrax/event.rb +5 -7
- data/app/models/hyrax/file_metadata.rb +15 -4
- data/app/models/hyrax/pcdm_collection.rb +13 -0
- data/app/models/hyrax/uploaded_file.rb +9 -2
- data/app/models/hyrax/{active_job_proxy.rb → valkyrie_global_id_proxy.rb} +6 -5
- data/app/models/hyrax/virus_scanner.rb +2 -1
- data/app/models/hyrax/work.rb +1 -1
- data/app/models/sipity.rb +6 -0
- data/app/models/sipity/entity.rb +1 -1
- data/app/models/sipity/workflow.rb +23 -3
- data/app/presenters/hyrax/admin/repository_object_presenter.rb +7 -2
- data/app/presenters/hyrax/collection_presenter.rb +1 -1
- data/app/presenters/hyrax/file_set_presenter.rb +3 -0
- data/app/presenters/hyrax/iiif_manifest_presenter.rb +3 -3
- data/app/presenters/hyrax/permission_badge.rb +1 -1
- data/app/presenters/hyrax/presenter_factory.rb +0 -2
- data/app/presenters/hyrax/select_collection_type_presenter.rb +16 -3
- data/app/presenters/hyrax/select_type_presenter.rb +3 -2
- data/app/presenters/hyrax/stats_usage_presenter.rb +0 -1
- data/app/presenters/hyrax/work_show_presenter.rb +1 -1
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +16 -6
- data/app/search_builders/hyrax/README.md +3 -3
- data/app/search_builders/hyrax/admin_admin_set_member_search_builder.rb +8 -2
- data/app/search_builders/hyrax/collection_member_search_builder.rb +21 -7
- data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +1 -1
- data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +1 -1
- data/app/search_builders/hyrax/embargo_search_builder.rb +0 -1
- data/app/search_builders/hyrax/filter_by_type.rb +3 -1
- data/app/search_builders/hyrax/lease_search_builder.rb +0 -1
- data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +12 -2
- data/app/search_builders/hyrax/search_builder.rb +1 -4
- data/app/search_builders/hyrax/search_filters.rb +0 -2
- data/app/services/hyrax/access_control_list.rb +33 -2
- data/app/services/hyrax/adapters/nesting_index_adapter.rb +26 -7
- data/app/services/hyrax/admin_set_member_service.rb +18 -4
- data/{lib/hyrax/callbacks/registry.rb → app/services/hyrax/callbacks.rb} +23 -0
- data/app/services/hyrax/change_content_depositor_service.rb +4 -1
- data/app/services/hyrax/collection_member_service.rb +5 -1
- data/app/services/hyrax/collection_types/permissions_service.rb +0 -2
- data/app/services/hyrax/collections/collection_member_service.rb +44 -64
- data/app/services/hyrax/collections/managed_collections_service.rb +15 -2
- data/app/services/hyrax/collections/migration_service.rb +9 -3
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +1 -1
- data/app/services/hyrax/collections/nested_collection_query_service.rb +39 -19
- data/app/services/hyrax/collections/permissions_service.rb +0 -1
- data/app/services/hyrax/collections_service.rb +12 -12
- data/app/services/hyrax/custom_queries/find_collections_by_type.rb +1 -1
- data/app/services/hyrax/custom_queries/navigators/child_collections_navigator.rb +14 -3
- data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +14 -3
- data/app/services/hyrax/custom_queries/navigators/child_works_navigator.rb +10 -3
- data/app/services/hyrax/custom_queries/navigators/collection_members.rb +1 -0
- data/app/services/hyrax/custom_queries/navigators/find_files.rb +3 -0
- data/app/services/hyrax/database_migrator.rb +13 -10
- data/app/services/hyrax/default_middleware_stack.rb +0 -6
- data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +27 -0
- data/app/services/hyrax/file_set_fixity_check_service.rb +16 -17
- data/app/services/hyrax/file_set_type_service.rb +55 -0
- data/app/services/hyrax/graph_exporter.rb +64 -8
- data/app/services/hyrax/list_source_exporter.rb +16 -34
- data/app/services/hyrax/listeners.rb +22 -0
- data/app/services/hyrax/listeners/proxy_deposit_listener.rb +20 -0
- data/app/services/hyrax/listeners/workflow_listener.rb +36 -0
- data/app/services/hyrax/multiple_membership_checker.rb +2 -1
- data/app/services/hyrax/quick_classification_query.rb +2 -3
- data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
- data/app/services/hyrax/search_service.rb +108 -0
- data/app/services/hyrax/simple_schema_loader.rb +3 -1
- data/app/services/hyrax/statistics/depositors/summary.rb +0 -1
- data/app/services/hyrax/statistics/system_stats.rb +0 -1
- data/app/services/hyrax/thumbnail_path_service.rb +6 -1
- data/app/services/hyrax/time_service.rb +10 -0
- data/app/services/hyrax/versioning_service.rb +4 -28
- data/app/services/hyrax/work_uploads_handler.rb +166 -0
- data/app/services/hyrax/workflow/action_taken_service.rb +14 -1
- data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +3 -1
- data/app/services/hyrax/workflow/permission_generator.rb +14 -9
- data/app/services/hyrax/workflow/workflow_action_service.rb +1 -1
- data/app/services/hyrax/workflow/workflow_factory.rb +12 -10
- data/app/services/hyrax/working_directory.rb +0 -1
- data/app/services/hyrax/works/managed_works_service.rb +14 -2
- data/app/views/_controls.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_member.html.erb +1 -1
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +1 -1
- data/app/views/hyrax/base/show.html.erb +2 -2
- data/app/views/hyrax/batch_select/_add_button.html.erb +1 -1
- data/app/views/hyrax/collections/_default_group.html.erb +2 -0
- data/app/views/hyrax/collections/show.html.erb +1 -1
- data/app/views/hyrax/dashboard/works/_default_group.html.erb +2 -0
- data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +1 -1
- data/app/views/hyrax/leases/_list_expired_active_leases.html.erb +2 -1
- data/app/views/hyrax/my/works/_default_group.html.erb +2 -0
- data/app/views/layouts/hyrax.html.erb +0 -15
- data/bin/db-migrate-seed.sh +9 -0
- data/bin/db-wait.sh +14 -0
- data/bin/hyrax-entrypoint.sh +15 -0
- data/chart/fcrepo/.gitignore +2 -0
- data/chart/fcrepo/.helmignore +23 -0
- data/chart/fcrepo/Chart.yaml +11 -0
- data/chart/fcrepo/README.md +50 -0
- data/chart/fcrepo/templates/NOTES.txt +21 -0
- data/chart/fcrepo/templates/_helpers.tpl +68 -0
- data/chart/fcrepo/templates/configmap-env.yaml +19 -0
- data/chart/fcrepo/templates/deployment.yaml +109 -0
- data/chart/fcrepo/templates/ingress.yaml +41 -0
- data/chart/fcrepo/templates/pvc.yaml +20 -0
- data/chart/fcrepo/templates/secret.yaml +12 -0
- data/chart/fcrepo/templates/service.yaml +15 -0
- data/chart/fcrepo/templates/serviceaccount.yaml +12 -0
- data/chart/fcrepo/templates/tests/test-connection.yaml +15 -0
- data/chart/fcrepo/values.yaml +79 -0
- data/chart/hyrax/.gitignore +2 -0
- data/chart/hyrax/.helmignore +23 -0
- data/chart/hyrax/Chart.yaml +27 -0
- data/chart/hyrax/README.md +69 -0
- data/chart/hyrax/templates/NOTES.txt +21 -0
- data/chart/hyrax/templates/_helpers.tpl +92 -0
- data/chart/hyrax/templates/configmap-env.yaml +32 -0
- data/chart/hyrax/templates/deployment.yaml +79 -0
- data/chart/hyrax/templates/fcrepo-secret.yaml +13 -0
- data/chart/hyrax/templates/hpa.yaml +28 -0
- data/chart/hyrax/templates/ingress.yaml +41 -0
- data/chart/hyrax/templates/secrets.yaml +12 -0
- data/chart/hyrax/templates/service.yaml +15 -0
- data/chart/hyrax/templates/serviceaccount.yaml +12 -0
- data/chart/hyrax/templates/tests/test-connection.yaml +15 -0
- data/chart/hyrax/values.yaml +97 -0
- data/config/initializers/indexing_adapter_initializer.rb +7 -12
- data/config/initializers/listeners.rb +2 -0
- data/config/locales/hyrax.en.yml +1 -1
- data/config/metadata/basic_metadata.yaml +13 -0
- data/db/seeds.rb +20 -0
- data/docker-compose.yml +132 -0
- data/documentation/developing-your-hyrax-based-app.md +271 -0
- data/documentation/legacyREADME.md +336 -0
- data/documentation/note-about-versions.md +15 -0
- data/hyrax.gemspec +7 -8
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +4 -6
- data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +1 -1
- data/lib/generators/hyrax/templates/db/seeds.rb +16 -14
- data/lib/generators/hyrax/templates/uv.html +1 -1
- data/lib/generators/hyrax/work_resource/templates/controller.rb.erb +0 -5
- data/lib/generators/hyrax/work_resource/templates/form.rb.erb +1 -1
- data/lib/generators/hyrax/work_resource/templates/work.html.erb_spec.rb.erb +3 -2
- data/lib/hyrax.rb +17 -0
- data/lib/hyrax/configuration.rb +340 -200
- data/lib/hyrax/event_store.rb +5 -0
- data/lib/hyrax/form_fields.rb +1 -1
- data/lib/hyrax/indexer.rb +19 -3
- data/lib/hyrax/publisher.rb +71 -2
- data/lib/hyrax/resource_sync/change_list_writer.rb +1 -1
- data/lib/hyrax/resource_sync/resource_list_writer.rb +1 -1
- data/lib/hyrax/schema.rb +2 -2
- data/lib/hyrax/specs/capybara.rb +98 -0
- data/lib/hyrax/specs/clamav.rb +15 -0
- data/lib/hyrax/specs/disable_animations_in_test_environment.rb +53 -0
- data/lib/hyrax/specs/engine_routes.rb +11 -0
- data/lib/hyrax/specs/shared_specs/change_set.rb +11 -0
- data/lib/hyrax/specs/shared_specs/factories/strategies/json_strategy.rb +13 -0
- data/lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb +0 -11
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +6 -0
- data/lib/hyrax/specs/shared_specs/indexers.rb +22 -5
- data/lib/hyrax/specs/shared_specs/metadata.rb +64 -0
- data/lib/hyrax/specs/spy_listener.rb +52 -26
- data/lib/hyrax/transactions/container.rb +13 -1
- data/lib/hyrax/transactions/steps/add_file_sets.rb +35 -0
- data/lib/hyrax/transactions/steps/save.rb +10 -4
- data/lib/hyrax/transactions/steps/save_access_control.rb +29 -0
- data/lib/hyrax/transactions/steps/set_default_admin_set.rb +1 -1
- data/lib/hyrax/transactions/update_work.rb +3 -1
- data/lib/hyrax/transactions/work_create.rb +3 -1
- data/lib/hyrax/version.rb +1 -1
- data/lib/tasks/collection_type_global_id.rake +22 -0
- data/lib/tasks/default_admin_set.rake +5 -0
- data/lib/wings.rb +1 -1
- data/lib/wings/active_fedora_converter.rb +71 -123
- data/lib/wings/active_fedora_converter/default_work.rb +129 -0
- data/lib/wings/active_fedora_converter/nested_resource.rb +25 -0
- data/lib/wings/attribute_transformer.rb +28 -1
- data/lib/wings/converter_value_mapper.rb +70 -3
- data/lib/wings/model_registry.rb +4 -3
- data/lib/wings/model_transformer.rb +25 -7
- data/lib/wings/orm_converter.rb +19 -23
- data/lib/wings/services/custom_queries/find_collections_by_type.rb +1 -1
- data/lib/wings/services/custom_queries/find_file_metadata.rb +65 -38
- data/lib/wings/services/file_converter_service.rb +6 -55
- data/lib/wings/services/file_metadata_builder.rb +12 -8
- data/lib/wings/setup.rb +56 -9
- data/lib/wings/transformer_value_mapper.rb +1 -0
- data/lib/wings/valkyrie/metadata_adapter.rb +2 -2
- data/lib/wings/valkyrie/persister.rb +13 -14
- data/lib/wings/valkyrie/storage.rb +94 -0
- data/tasks/benchmark.rake +56 -0
- data/template.rb +1 -3
- metadata +346 -54
- data/lib/hyrax/callbacks.rb +0 -27
- data/lib/wings/hydra/pcdm/models/concerns/collection_valkyrie_behavior.rb +0 -28
- data/lib/wings/hydra/pcdm/models/concerns/object_valkyrie_behavior.rb +0 -28
- data/lib/wings/hydra/pcdm/models/concerns/pcdm_valkyrie_behavior.rb +0 -171
- data/lib/wings/hydra/works/models/concerns/collection_valkyrie_behavior.rb +0 -31
- data/lib/wings/hydra/works/models/concerns/file_set_valkyrie_behavior.rb +0 -31
- data/lib/wings/hydra/works/models/concerns/work_valkyrie_behavior.rb +0 -60
- data/lib/wings/models/concerns/collection_behavior.rb +0 -39
- data/lib/wings/models/multi_checksum.rb +0 -18
- data/lib/wings/services/id_converter_service.rb +0 -15
- data/lib/wings/valkyrie/storage/active_fedora.rb +0 -27
@@ -16,9 +16,11 @@ RSpec.shared_examples 'a Hyrax::Resource indexer' do
|
|
16
16
|
let(:ids) { ['id1', 'id2'] }
|
17
17
|
|
18
18
|
describe '#to_solr' do
|
19
|
-
it 'indexes
|
19
|
+
it 'indexes base resource fields' do
|
20
20
|
expect(indexer.to_solr)
|
21
|
-
.to include(
|
21
|
+
.to include(has_model_ssim: resource.class.name,
|
22
|
+
human_readable_type_tesim: resource.human_readable_type,
|
23
|
+
alternate_ids_sim: a_collection_containing_exactly(*ids))
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -43,7 +45,7 @@ RSpec.shared_examples 'a permission indexer' do
|
|
43
45
|
describe '#to_solr' do
|
44
46
|
it 'indexes read permissions' do
|
45
47
|
expect(indexer.to_solr)
|
46
|
-
.to include(Hydra.config.permissions.read.group => [
|
48
|
+
.to include(Hydra.config.permissions.read.group => [Hyrax.config.public_user_group_name],
|
47
49
|
Hydra.config.permissions.read.individual => read_users.map(&:user_key))
|
48
50
|
end
|
49
51
|
|
@@ -117,7 +119,11 @@ RSpec.shared_examples 'a Basic metadata indexer' do
|
|
117
119
|
|
118
120
|
let(:attributes) do
|
119
121
|
{
|
122
|
+
based_near: ['helsinki', 'finland'],
|
123
|
+
date_created: ['tuesday'],
|
120
124
|
keyword: ['comic strip'],
|
125
|
+
related_url: ['http://example.com/moomin'],
|
126
|
+
resource_type: ['book'],
|
121
127
|
subject: ['moomins', 'snorks']
|
122
128
|
}
|
123
129
|
end
|
@@ -125,9 +131,15 @@ RSpec.shared_examples 'a Basic metadata indexer' do
|
|
125
131
|
describe '#to_solr' do
|
126
132
|
it 'indexes basic metadata' do
|
127
133
|
expect(indexer.to_solr)
|
128
|
-
.to include(
|
134
|
+
.to include(based_near_tesim: a_collection_containing_exactly(*attributes[:based_near]),
|
135
|
+
based_near_sim: a_collection_containing_exactly(*attributes[:based_near]),
|
136
|
+
date_created_tesim: a_collection_containing_exactly(*attributes[:date_created]),
|
137
|
+
keyword_sim: a_collection_containing_exactly(*attributes[:keyword]),
|
138
|
+
related_url_tesim: a_collection_containing_exactly(*attributes[:related_url]),
|
139
|
+
resource_type_tesim: a_collection_containing_exactly(*attributes[:resource_type]),
|
140
|
+
resource_type_sim: a_collection_containing_exactly(*attributes[:resource_type]),
|
129
141
|
subject_tesim: a_collection_containing_exactly(*attributes[:subject]),
|
130
|
-
subject_sim:
|
142
|
+
subject_sim: a_collection_containing_exactly(*attributes[:subject]))
|
131
143
|
end
|
132
144
|
end
|
133
145
|
end
|
@@ -162,6 +174,11 @@ RSpec.shared_examples 'a Collection indexer' do
|
|
162
174
|
it_behaves_like 'a visibility indexer'
|
163
175
|
|
164
176
|
describe '#to_solr' do
|
177
|
+
it 'indexes collection type gid' do
|
178
|
+
expect(indexer.to_solr)
|
179
|
+
.to include(collection_type_gid_ssim: a_collection_containing_exactly(an_instance_of(String)))
|
180
|
+
end
|
181
|
+
|
165
182
|
it 'indexes generic type' do
|
166
183
|
expect(indexer.to_solr)
|
167
184
|
.to include(generic_type_sim: a_collection_containing_exactly('Collection'))
|
@@ -1,5 +1,69 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
RSpec.shared_examples 'a model with basic metadata' do
|
4
|
+
subject(:resource) { described_class.new }
|
5
|
+
|
6
|
+
it 'has abstracts' do
|
7
|
+
expect { resource.abstract = ['lorem ipsum', 'a story about moomins'] }
|
8
|
+
.to change { resource.abstract }
|
9
|
+
.to contain_exactly 'lorem ipsum', 'a story about moomins'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has a label' do
|
13
|
+
expect { resource.label = 'one single label' }
|
14
|
+
.to change { resource.label }
|
15
|
+
.to eq 'one single label'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'has language' do
|
19
|
+
expect { resource.language = ['en', 'fi'] }
|
20
|
+
.to change { resource.language }
|
21
|
+
.to contain_exactly 'en', 'fi'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'has licenses' do
|
25
|
+
expect { resource.license = ['http://example.com/li1', 'http://example.com/li2'] }
|
26
|
+
.to change { resource.license }
|
27
|
+
.to contain_exactly 'http://example.com/li1', 'http://example.com/li2'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'has a relative path' do
|
31
|
+
expect { resource.relative_path = 'hamburger' }
|
32
|
+
.to change { resource.relative_path }
|
33
|
+
.to eq 'hamburger'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'has resource types' do
|
37
|
+
expect { resource.resource_type = ['book', 'image'] }
|
38
|
+
.to change { resource.resource_type }
|
39
|
+
.to contain_exactly 'book', 'image'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'has rights notes' do
|
43
|
+
expect { resource.rights_notes = ['secret', 'do not use'] }
|
44
|
+
.to change { resource.rights_notes }
|
45
|
+
.to contain_exactly 'secret', 'do not use'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'has rights statements' do
|
49
|
+
expect { resource.rights_statement = ['http://example.com/rs1', 'http://example.com/rs2'] }
|
50
|
+
.to change { resource.rights_statement }
|
51
|
+
.to contain_exactly 'http://example.com/rs1', 'http://example.com/rs2'
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'has sources' do
|
55
|
+
expect { resource.source = ['first', 'second'] }
|
56
|
+
.to change { resource.source }
|
57
|
+
.to contain_exactly 'first', 'second'
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'has subjects' do
|
61
|
+
expect { resource.subject = ['moomin', 'snork'] }
|
62
|
+
.to change { resource.subject }
|
63
|
+
.to contain_exactly 'moomin', 'snork'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
3
67
|
RSpec.shared_examples 'a model with core metadata' do
|
4
68
|
subject(:resource) { described_class.new }
|
5
69
|
let(:date) { Time.zone.today }
|
@@ -2,37 +2,63 @@
|
|
2
2
|
|
3
3
|
module Hyrax
|
4
4
|
module Specs
|
5
|
+
# A spec support class for assisting in spec testing of the
|
6
|
+
# Hyrax::Publisher pub/sub behavior.
|
7
|
+
#
|
8
|
+
# For each registered event, there are two corresponding instance methods
|
9
|
+
#
|
10
|
+
# 1. `#on_<registered_event>`
|
11
|
+
# 2. `#<registered_event>`
|
12
|
+
#
|
13
|
+
# Then, for any spec you want to make sure Pub/Sub events fire,
|
14
|
+
# you can subscribe an instance of Hyrax::Specs::SpyListener.
|
15
|
+
# When your spec is completed, unsubscribe the instance.
|
16
|
+
#
|
17
|
+
# @example For RSpec, assuming "object.deposited" is a registered event
|
18
|
+
# # Note, based on the assumption that "object.deposited", then the
|
19
|
+
# # listener object will have two corresponding methods:
|
20
|
+
# #
|
21
|
+
# # 1. :on_object_deposited - the method called when we publish an event
|
22
|
+
# # 2. :object_deposited - the attr_reader that captures and exposed
|
23
|
+
# # the event for verification
|
24
|
+
# let(:listener) { Hyrax::Specs::SpyListener.new }
|
25
|
+
# before { Hyrax.publisher.subscribe(listener) }
|
26
|
+
# after { Hyrax.publisher.unsubscribe(listener) }
|
27
|
+
#
|
28
|
+
# it "publishes to the listener" do
|
29
|
+
# Hyrax::Publisher.instance.publish("object.deposited", object: object, depositor: user)
|
30
|
+
# expect(listener.object_deposited&.payload).to eq(object: object, depositor: user)
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
#
|
34
|
+
# @see Hyrax::Publisher
|
5
35
|
class SpyListener
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def on_object_deposited(event)
|
15
|
-
@object_deposited = event
|
16
|
-
end
|
17
|
-
|
18
|
-
def on_object_failed_deposit(event)
|
19
|
-
@object_failed_deposit = event
|
36
|
+
Hyrax::Publisher.events.each_value do |registered_event|
|
37
|
+
listener_method = registered_event.listener_method
|
38
|
+
attr_name = registered_event.listener_method.to_s.sub(/^on_/, '')
|
39
|
+
attr_reader attr_name
|
40
|
+
define_method listener_method do |published_event|
|
41
|
+
instance_variable_set("@#{attr_name}", published_event)
|
42
|
+
end
|
20
43
|
end
|
44
|
+
end
|
21
45
|
|
22
|
-
|
23
|
-
|
24
|
-
|
46
|
+
##
|
47
|
+
# A spy listener that accumulates events, so multiple events published by
|
48
|
+
# one unit-under-test can be collected for inspection.
|
49
|
+
class AppendingSpyListener
|
50
|
+
Hyrax::Publisher.events.each_value do |registered_event|
|
51
|
+
listener_method = registered_event.listener_method
|
52
|
+
attr_name = registered_event.listener_method.to_s.sub(/^on_/, '')
|
25
53
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def on_file_set_attached(event)
|
31
|
-
@file_set_attached = event
|
32
|
-
end
|
54
|
+
define_method attr_name.to_sym do
|
55
|
+
instance_variable_get("@#{attr_name}") ||
|
56
|
+
instance_variable_set("@#{attr_name}", [])
|
57
|
+
end
|
33
58
|
|
34
|
-
|
35
|
-
|
59
|
+
define_method listener_method do |published_event|
|
60
|
+
send(attr_name.to_sym) << published_event
|
61
|
+
end
|
36
62
|
end
|
37
63
|
end
|
38
64
|
end
|
@@ -23,6 +23,7 @@ module Hyrax
|
|
23
23
|
require 'hyrax/transactions/destroy_work'
|
24
24
|
require 'hyrax/transactions/work_create'
|
25
25
|
require 'hyrax/transactions/update_work'
|
26
|
+
require 'hyrax/transactions/steps/add_file_sets'
|
26
27
|
require 'hyrax/transactions/steps/add_to_collections'
|
27
28
|
require 'hyrax/transactions/steps/apply_collection_permission_template'
|
28
29
|
require 'hyrax/transactions/steps/apply_permission_template'
|
@@ -32,6 +33,7 @@ module Hyrax
|
|
32
33
|
require 'hyrax/transactions/steps/ensure_permission_template'
|
33
34
|
require 'hyrax/transactions/steps/save'
|
34
35
|
require 'hyrax/transactions/steps/save_work'
|
36
|
+
require 'hyrax/transactions/steps/save_access_control'
|
35
37
|
require 'hyrax/transactions/steps/set_default_admin_set'
|
36
38
|
require 'hyrax/transactions/steps/set_modified_date'
|
37
39
|
require 'hyrax/transactions/steps/set_uploaded_date_unless_present'
|
@@ -88,7 +90,17 @@ module Hyrax
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
91
|
-
namespace '
|
93
|
+
namespace 'work_resource' do |ops| # valkyrie works
|
94
|
+
ops.register 'add_file_sets' do
|
95
|
+
Steps::AddFileSets.new
|
96
|
+
end
|
97
|
+
|
98
|
+
ops.register 'save_acl' do
|
99
|
+
Steps::SaveAccessControl.new
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
namespace 'work' do |ops| # legacy AF works
|
92
104
|
ops.register 'apply_collection_permission_template' do
|
93
105
|
Steps::ApplyCollectionPermissionTemplate.new
|
94
106
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'dry/monads'
|
3
|
+
|
4
|
+
module Hyrax
|
5
|
+
module Transactions
|
6
|
+
module Steps
|
7
|
+
##
|
8
|
+
# Adds a Hyrax::FileSet
|
9
|
+
#
|
10
|
+
# @see https://wiki.lyrasis.org/display/samvera/Hydra::Works+Shared+Modeling
|
11
|
+
class AddFileSets
|
12
|
+
include Dry::Monads[:result]
|
13
|
+
|
14
|
+
##
|
15
|
+
# @param [Class] handler
|
16
|
+
def initialize(handler: Hyrax::WorkUploadsHandler)
|
17
|
+
@handler = handler
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# @param [Hyrax::Work] obj
|
22
|
+
# @param [Enumerable<UploadedFile>] uploaded_files
|
23
|
+
#
|
24
|
+
# @return [Dry::Monads::Result]
|
25
|
+
def call(obj, uploaded_files: [])
|
26
|
+
if @handler.new(work: obj).add(files: uploaded_files).attach
|
27
|
+
Success(obj)
|
28
|
+
else
|
29
|
+
Failure[:failed_to_attach_file_sets, uploaded_files]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -29,11 +29,17 @@ module Hyrax
|
|
29
29
|
# applied and the resource is saved;
|
30
30
|
# `Failure([#to_s, change_set.resource])`, otherwise.
|
31
31
|
def call(change_set, user: nil)
|
32
|
-
|
32
|
+
unsaved = change_set.sync
|
33
|
+
saved = @persister.save(resource: unsaved)
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
# if we have a permission manager, it's acting as a local cache of another resource.
|
36
|
+
# we want to resync changes that we had in progress so we can persist them later.
|
37
|
+
saved.permission_manager.acl.permissions = unsaved.permission_manager.acl.permissions if
|
38
|
+
unsaved.respond_to?(:permission_manager)
|
39
|
+
|
40
|
+
user ||= ::User.find_by_user_key(saved.depositor)
|
41
|
+
Hyrax.publisher.publish('object.deposited', object: saved, user: user) if unsaved.new_record
|
42
|
+
Hyrax.publisher.publish('object.metadata.updated', object: saved, user: user)
|
37
43
|
|
38
44
|
Success(saved)
|
39
45
|
rescue StandardError => err
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'dry/monads'
|
3
|
+
|
4
|
+
module Hyrax
|
5
|
+
module Transactions
|
6
|
+
module Steps
|
7
|
+
##
|
8
|
+
# Saves the Hyrax::AccessControlList for any resource with a `#permission_manager`.
|
9
|
+
# If `#permission_manager` is undefined, succeeds.
|
10
|
+
#
|
11
|
+
# @see https://dry-rb.org/gems/dry-monads/1.0/result/
|
12
|
+
class SaveAccessControl
|
13
|
+
include Dry::Monads[:result]
|
14
|
+
|
15
|
+
##
|
16
|
+
# @param [Valkyrie::Resource] obj
|
17
|
+
#
|
18
|
+
# @return [Dry::Monads::Result]
|
19
|
+
def call(obj)
|
20
|
+
return Success(obj) unless obj.respond_to?(:permission_manager)
|
21
|
+
obj.permission_manager&.acl&.save ||
|
22
|
+
(return Failure[:failed_to_save_acl, acl])
|
23
|
+
|
24
|
+
Success(obj)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -4,7 +4,9 @@ module Hyrax
|
|
4
4
|
##
|
5
5
|
# @since 3.0.0
|
6
6
|
class UpdateWork < Transaction
|
7
|
-
DEFAULT_STEPS = ['change_set.apply'
|
7
|
+
DEFAULT_STEPS = ['change_set.apply',
|
8
|
+
'work_resource.save_acl',
|
9
|
+
'work_resource.add_file_sets'].freeze
|
8
10
|
|
9
11
|
##
|
10
12
|
# @see Hyrax::Transactions::Transaction
|
@@ -12,7 +12,9 @@ module Hyrax
|
|
12
12
|
'change_set.ensure_admin_set',
|
13
13
|
'change_set.set_user_as_depositor',
|
14
14
|
'change_set.add_to_collections',
|
15
|
-
'change_set.apply'
|
15
|
+
'change_set.apply',
|
16
|
+
'work_resource.save_acl',
|
17
|
+
'work_resource.add_file_sets'].freeze
|
16
18
|
|
17
19
|
##
|
18
20
|
# @see Hyrax::Transactions::Transaction
|
data/lib/hyrax/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
namespace :hyrax do
|
3
|
+
namespace :collections do
|
4
|
+
desc 'Update CollectionType global id references for Hyrax 3.0.0'
|
5
|
+
task :update_collection_type_global_ids do
|
6
|
+
puts 'Updating collection -> collection type GlobalId references.'
|
7
|
+
|
8
|
+
count = 0
|
9
|
+
|
10
|
+
Collection.all.each do |collection|
|
11
|
+
next if collection.collection_type_gid == collection.collection_type.to_global_id.to_s
|
12
|
+
|
13
|
+
collection.public_send(:collection_type_gid=, collection.collection_type.to_global_id, force: true)
|
14
|
+
|
15
|
+
collection.save &&
|
16
|
+
count += 1
|
17
|
+
end
|
18
|
+
|
19
|
+
puts "Updated #{count} collections."
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -4,6 +4,11 @@ namespace :hyrax do
|
|
4
4
|
desc "Create the Default Admin Set"
|
5
5
|
task create: :environment do
|
6
6
|
id = AdminSet.find_or_create_default_admin_set_id
|
7
|
+
# I have found that when I come back to a development
|
8
|
+
# environment, that I may have an AdminSet in Fedora, but it is
|
9
|
+
# not indexed in Solr. This remediates that situation by
|
10
|
+
# ensuring we have an indexed AdminSet
|
11
|
+
AdminSet.find(id).update_index
|
7
12
|
if Hyrax::PermissionTemplate.find_by(source_id: id)
|
8
13
|
puts "Successfully created default admin set"
|
9
14
|
else
|
data/lib/wings.rb
CHANGED
@@ -94,8 +94,8 @@ require 'wings/valkyrizable'
|
|
94
94
|
require 'wings/valkyrie/metadata_adapter'
|
95
95
|
require 'wings/valkyrie/resource_factory'
|
96
96
|
require 'wings/valkyrie/persister'
|
97
|
+
require 'wings/valkyrie/storage'
|
97
98
|
require 'wings/valkyrie/query_service'
|
98
|
-
require 'wings/valkyrie/storage/active_fedora'
|
99
99
|
|
100
100
|
Hydra::AccessControl.send(:define_method, :valkyrie_resource) do
|
101
101
|
attrs = attributes.symbolize_keys
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'wings/converter_value_mapper'
|
4
|
+
require 'wings/active_fedora_converter/default_work'
|
5
|
+
require 'wings/active_fedora_converter/nested_resource'
|
4
6
|
|
5
7
|
module Wings
|
6
8
|
##
|
@@ -22,6 +24,14 @@ module Wings
|
|
22
24
|
ActiveFedoraAttributes
|
23
25
|
end
|
24
26
|
|
27
|
+
##
|
28
|
+
# A class level cache mapping from Valkyrie resource classes to generated
|
29
|
+
# ActiveFedora classes
|
30
|
+
# @return [Hash<Class, Class>]
|
31
|
+
def self.class_cache
|
32
|
+
@class_cache ||= {}
|
33
|
+
end
|
34
|
+
|
25
35
|
##
|
26
36
|
# @params [Valkyrie::Resource] resource
|
27
37
|
#
|
@@ -46,31 +56,33 @@ module Wings
|
|
46
56
|
#
|
47
57
|
# @return [Hash] attributes with values mapped for building an ActiveFedora model
|
48
58
|
def attributes
|
49
|
-
@attributes ||=
|
59
|
+
@attributes ||= attributes_class.mapped_attributes(attributes: resource.attributes).select do |attr|
|
60
|
+
active_fedora_class.supports_property?(attr)
|
61
|
+
end
|
50
62
|
end
|
51
63
|
|
52
64
|
##
|
53
65
|
# @return [ActiveFedora::Base]
|
54
66
|
def convert
|
55
|
-
|
56
|
-
af_object.id
|
57
|
-
|
58
|
-
convert_members(af_object)
|
59
|
-
convert_member_of_collections(af_object)
|
60
|
-
convert_files(af_object)
|
67
|
+
instance.tap do |af_object|
|
68
|
+
af_object.id ||= id unless id.empty?
|
69
|
+
apply_attributes_to_model(af_object)
|
61
70
|
end
|
62
71
|
end
|
63
72
|
|
64
73
|
def active_fedora_class
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
74
|
+
@active_fedora_class ||= # cache the class at the instance level
|
75
|
+
begin
|
76
|
+
klass = begin
|
77
|
+
resource.internal_resource.constantize
|
78
|
+
rescue NameError
|
79
|
+
Wings::ActiveFedoraClassifier.new(resource.internal_resource).best_model
|
80
|
+
end
|
70
81
|
|
71
|
-
|
82
|
+
return klass if klass <= ActiveFedora::Common
|
72
83
|
|
73
|
-
|
84
|
+
ModelRegistry.lookup(klass)
|
85
|
+
end
|
74
86
|
end
|
75
87
|
|
76
88
|
##
|
@@ -85,105 +97,16 @@ module Wings
|
|
85
97
|
resource.alternate_ids.first.to_s
|
86
98
|
end
|
87
99
|
|
88
|
-
def self.DefaultWork(resource_class)
|
89
|
-
Class.new(DefaultWork) do
|
90
|
-
self.valkyrie_class = resource_class
|
91
|
-
|
92
|
-
# extract AF properties from the Valkyrie schema;
|
93
|
-
# skip reserved attributes, proctected properties, and those already defined
|
94
|
-
resource_class.schema.each do |schema_key|
|
95
|
-
next if resource_class.reserved_attributes.include?(schema_key.name)
|
96
|
-
next if protected_property_name?(schema_key.name)
|
97
|
-
next if properties.keys.include?(schema_key.name.to_s)
|
98
|
-
|
99
|
-
property schema_key.name, predicate: RDF::URI("http://hyrax.samvera.org/ns/wings##{schema_key.name}")
|
100
|
-
end
|
101
|
-
|
102
|
-
# nested attributes in AF don't inherit! this needs to be here until we can drop it completely.
|
103
|
-
accepts_nested_attributes_for :nested_resource
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
##
|
108
|
-
# A base model class for valkyrie resources that don't have corresponding
|
109
|
-
# ActiveFedora::Base models.
|
110
|
-
class DefaultWork < ActiveFedora::Base
|
111
|
-
include Hyrax::WorkBehavior
|
112
|
-
property :nested_resource, predicate: ::RDF::URI("http://example.com/nested_resource"), class_name: "Wings::ActiveFedoraConverter::NestedResource"
|
113
|
-
|
114
|
-
class_attribute :valkyrie_class
|
115
|
-
self.valkyrie_class = Hyrax::Resource
|
116
|
-
|
117
|
-
class << self
|
118
|
-
delegate :human_readable_type, to: :valkyrie_class
|
119
|
-
|
120
|
-
def model_name(*)
|
121
|
-
_hyrax_default_name_class.new(valkyrie_class)
|
122
|
-
end
|
123
|
-
|
124
|
-
def to_rdf_representation
|
125
|
-
"Wings(#{valkyrie_class})"
|
126
|
-
end
|
127
|
-
alias inspect to_rdf_representation
|
128
|
-
alias to_s inspect
|
129
|
-
end
|
130
|
-
|
131
|
-
def to_global_id
|
132
|
-
GlobalID.create(valkyrie_class.new(id: id))
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
class NestedResource < ActiveTriples::Resource
|
137
|
-
property :title, predicate: ::RDF::Vocab::DC.title
|
138
|
-
property :ordered_authors, predicate: ::RDF::Vocab::DC.creator
|
139
|
-
property :ordered_nested, predicate: ::RDF::URI("http://example.com/ordered_nested")
|
140
|
-
|
141
|
-
def initialize(uri = RDF::Node.new, _parent = ActiveTriples::Resource.new)
|
142
|
-
uri = if uri.try(:node?)
|
143
|
-
RDF::URI("#nested_resource_#{uri.to_s.gsub('_:', '')}")
|
144
|
-
elsif uri.to_s.include?('#')
|
145
|
-
RDF::URI(uri)
|
146
|
-
end
|
147
|
-
super
|
148
|
-
end
|
149
|
-
|
150
|
-
include ::Hyrax::BasicMetadata
|
151
|
-
end
|
152
|
-
|
153
100
|
private
|
154
101
|
|
155
|
-
def
|
156
|
-
|
157
|
-
|
158
|
-
|
102
|
+
def instance
|
103
|
+
id.present? ? active_fedora_class.find(id) : active_fedora_class.new
|
104
|
+
rescue ActiveFedora::ObjectNotFoundError
|
105
|
+
active_fedora_class.new
|
159
106
|
end
|
160
107
|
|
161
|
-
def
|
162
|
-
|
163
|
-
# TODO: It would be better to find a way to set the parent collections without resuming all the collection AF objects
|
164
|
-
af_object.member_of_collections = resource.member_of_collection_ids.map { |valkyrie_id| ActiveFedora::Base.find(valkyrie_id.to_s) }
|
165
|
-
end
|
166
|
-
|
167
|
-
def convert_files(af_object)
|
168
|
-
return unless resource.respond_to? :file_ids
|
169
|
-
|
170
|
-
af_object.files = resource.file_ids.map do |fid|
|
171
|
-
pcdm_file = Hydra::PCDM::File.new(fid.id)
|
172
|
-
assign_association_target(af_object, pcdm_file)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
def assign_association_target(af_object, pcdm_file)
|
177
|
-
case pcdm_file.metadata_node.type
|
178
|
-
when ->(types) { types.include?(RDF::URI.new('http://pcdm.org/use#OriginalFile')) }
|
179
|
-
af_object.association(:original_file).target = pcdm_file
|
180
|
-
when ->(types) { types.include?(RDF::URI.new('http://pcdm.org/use#ExtractedText')) }
|
181
|
-
af_object.association(:extracted_text).target = pcdm_file
|
182
|
-
when ->(types) { types.include?(RDF::URI.new('http://pcdm.org/use#Thumbnail')) }
|
183
|
-
af_object.association(:thumbnail).target = pcdm_file
|
184
|
-
else
|
185
|
-
pcdm_file
|
186
|
-
end
|
108
|
+
def attributes_class
|
109
|
+
self.class.attributes_class
|
187
110
|
end
|
188
111
|
|
189
112
|
# Normalizes the attributes parsed from the resource
|
@@ -193,25 +116,50 @@ module Wings
|
|
193
116
|
def normal_attributes
|
194
117
|
attributes.each_with_object({}) do |(attr, value), hash|
|
195
118
|
property = active_fedora_class.properties[attr.to_s]
|
196
|
-
hash[attr] = property
|
119
|
+
hash[attr] = if property.nil?
|
120
|
+
value
|
121
|
+
elsif property.multiple?
|
122
|
+
Array.wrap(value)
|
123
|
+
elsif Array.wrap(value).length < 2
|
124
|
+
Array.wrap(value).first
|
125
|
+
else
|
126
|
+
value
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# apply attributes to the ActiveFedora model
|
133
|
+
def apply_attributes_to_model(af_object)
|
134
|
+
case af_object
|
135
|
+
when Hydra::AccessControl
|
136
|
+
add_access_control_attributes(af_object)
|
137
|
+
when ActiveFedora::File
|
138
|
+
add_file_attributes(af_object)
|
139
|
+
else
|
140
|
+
converted_attrs = normal_attributes
|
141
|
+
members = Array.wrap(converted_attrs.delete(:members))
|
142
|
+
files = converted_attrs.delete(:files)
|
143
|
+
af_object.attributes = converted_attrs
|
144
|
+
members.empty? ? af_object.try(:ordered_members)&.clear : af_object.try(:ordered_members=, members)
|
145
|
+
af_object.try(:members)&.replace(members)
|
146
|
+
af_object.files.build_or_set(files) if files
|
197
147
|
end
|
198
148
|
end
|
199
149
|
|
200
150
|
# Add attributes from resource which aren't AF properties into af_object
|
201
151
|
def add_access_control_attributes(af_object)
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
af_object.
|
210
|
-
|
211
|
-
af_object.
|
212
|
-
|
213
|
-
permission
|
214
|
-
end
|
152
|
+
normal_attributes[:permissions].each { |p| p.access_to_id = resource.access_to&.id }
|
153
|
+
af_object.permissions = normal_attributes[:permissions]
|
154
|
+
end
|
155
|
+
|
156
|
+
# for files, add attributes to metadata_node, plus some other work
|
157
|
+
def add_file_attributes(af_object)
|
158
|
+
af_object.metadata_node.attributes = normal_attributes
|
159
|
+
af_object.original_name = resource.original_filename
|
160
|
+
new_type = (resource.type - af_object.metadata_node.type.to_a).first
|
161
|
+
af_object.metadata_node.type = new_type if new_type
|
162
|
+
af_object.mime_type = resource.mime_type
|
215
163
|
end
|
216
164
|
end
|
217
165
|
end
|