hyrax 3.0.1 → 3.3.0
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 +49 -19
- data/.dassie/.env +1 -2
- data/.dassie/Gemfile +18 -9
- data/.dassie/app/controllers/catalog_controller.rb +6 -0
- data/.dassie/app/models/user.rb +0 -2
- data/.dassie/config/analytics.yml +12 -5
- data/.dassie/config/environments/development.rb +2 -0
- data/.dassie/config/initializers/hyrax.rb +7 -0
- data/.dassie/config/role_map.yml +2 -0
- data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
- data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
- data/.dassie/db/schema.rb +20 -1
- data/.dassie/db/seeds.rb +1 -1
- data/.dockerignore +3 -0
- data/.env +8 -6
- data/.github/workflows/main.yml +17 -0
- data/.github/workflows/release.yml +17 -0
- data/.gitignore +1 -0
- data/.regen +1 -1
- data/.rubocop.yml +4 -0
- data/CONTAINERS.md +33 -10
- data/Dockerfile +14 -9
- data/Gemfile +21 -27
- data/README.md +37 -0
- data/app/actors/hyrax/actors/base_actor.rb +2 -2
- data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +85 -63
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +7 -42
- data/app/actors/hyrax/actors/file_set_actor.rb +12 -5
- data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
- data/app/assets/javascripts/hyrax/analytics_events.js +69 -0
- data/app/assets/javascripts/hyrax/collapse.js +24 -0
- data/app/assets/javascripts/hyrax/collections.js +1 -2
- data/app/assets/javascripts/hyrax/ga_events.js +2 -8
- data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
- data/app/assets/javascripts/hyrax.js +2 -1
- data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
- data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
- data/app/authorities/qa/authorities/collections.rb +4 -5
- data/app/authorities/qa/authorities/find_works.rb +1 -1
- data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +30 -10
- data/app/controllers/concerns/hyrax/controller.rb +35 -2
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +21 -9
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +14 -5
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +22 -3
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +2 -19
- data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
- data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
- data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +5 -6
- data/app/controllers/hyrax/admin/workflows_controller.rb +8 -2
- data/app/controllers/hyrax/collections_controller.rb +6 -1
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +24 -17
- data/app/controllers/hyrax/dashboard/collections_controller.rb +112 -37
- data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
- data/app/controllers/hyrax/dashboard_controller.rb +8 -0
- data/app/controllers/hyrax/file_sets_controller.rb +49 -13
- data/app/controllers/hyrax/my_controller.rb +4 -4
- data/app/controllers/hyrax/permissions_controller.rb +3 -4
- data/app/controllers/hyrax/stats_controller.rb +3 -1
- data/app/controllers/hyrax/workflow_actions_controller.rb +11 -6
- data/app/forms/hyrax/forms/administrative_set_form.rb +62 -0
- data/app/forms/hyrax/forms/collection_form.rb +9 -5
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +38 -6
- data/app/forms/hyrax/forms/file_set_form.rb +46 -0
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +67 -0
- data/app/forms/hyrax/forms/permission.rb +23 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +8 -2
- data/app/forms/hyrax/forms/resource_form.rb +34 -26
- data/app/forms/hyrax/forms/work_form.rb +5 -2
- data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
- data/app/helpers/hyrax/batch_edits_helper.rb +3 -1
- data/app/helpers/hyrax/collections_helper.rb +88 -2
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +16 -5
- data/app/helpers/hyrax/embargo_helper.rb +4 -0
- data/app/helpers/hyrax/file_set_helper.rb +25 -6
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
- data/app/helpers/hyrax/lease_helper.rb +4 -0
- data/app/helpers/hyrax/url_helper.rb +4 -1
- data/app/helpers/hyrax/work_form_helper.rb +53 -0
- data/app/indexers/hyrax/administrative_set_indexer.rb +18 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +2 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +3 -1
- data/app/indexers/hyrax/valkyrie_indexer.rb +3 -3
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +1 -1
- data/app/inputs/controlled_vocabulary_input.rb +2 -5
- data/app/jobs/attach_files_to_work_job.rb +19 -10
- data/app/jobs/attach_files_to_work_with_ordered_members_job.rb +6 -5
- data/app/jobs/characterize_job.rb +28 -1
- data/app/jobs/ingest_local_file_job.rb +18 -2
- data/app/jobs/inherit_permissions_job.rb +9 -5
- data/app/jobs/valkyrie_ingest_job.rb +56 -0
- data/app/models/admin_set.rb +22 -30
- data/app/models/collection_branding_info.rb +25 -9
- data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
- data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
- data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
- data/app/models/concerns/hyrax/ability.rb +31 -8
- data/app/models/concerns/hyrax/collection_behavior.rb +17 -44
- data/app/models/concerns/hyrax/embargoable.rb +24 -0
- data/app/models/concerns/hyrax/file_set/characterization.rb +18 -12
- data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -54
- data/app/models/concerns/hyrax/suppressible.rb +5 -0
- data/app/models/concerns/hyrax/user.rb +9 -3
- data/app/models/concerns/hyrax/work_behavior.rb +1 -1
- data/app/models/file_download_stat.rb +4 -4
- data/app/models/hyrax/administrative_set.rb +7 -1
- data/app/models/hyrax/default_administrative_set.rb +42 -0
- data/app/models/hyrax/file_set.rb +6 -0
- data/app/models/hyrax/pcdm_collection.rb +1 -0
- data/app/models/hyrax/permission.rb +1 -1
- data/app/models/hyrax/permission_template.rb +112 -12
- data/app/models/hyrax/statistic.rb +31 -4
- data/app/models/hyrax/virus_scanner.rb +27 -18
- data/app/models/hyrax/work.rb +1 -0
- data/app/models/hyrax/workflow_action_info.rb +16 -0
- data/app/models/sipity/agent.rb +1 -0
- data/app/models/sipity/comment.rb +17 -0
- data/app/models/sipity/entity.rb +30 -8
- data/app/models/sipity/workflow.rb +1 -0
- data/app/models/sipity.rb +53 -2
- data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
- data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
- data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
- data/app/presenters/hyrax/admin_set_options_presenter.rb +12 -8
- data/app/presenters/hyrax/admin_set_presenter.rb +13 -4
- data/app/presenters/hyrax/admin_set_selection_presenter.rb +116 -0
- data/app/presenters/hyrax/collection_presenter.rb +34 -9
- data/app/presenters/hyrax/file_set_presenter.rb +8 -1
- data/app/presenters/hyrax/file_usage.rb +3 -2
- data/app/presenters/hyrax/menu_presenter.rb +4 -0
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +119 -0
- data/app/presenters/hyrax/stats_usage_presenter.rb +2 -1
- data/app/presenters/hyrax/trophy_presenter.rb +33 -4
- data/app/presenters/hyrax/user_profile_presenter.rb +11 -1
- data/app/presenters/hyrax/version_list_presenter.rb +19 -0
- data/app/presenters/hyrax/version_presenter.rb +3 -2
- data/app/presenters/hyrax/work_show_presenter.rb +37 -8
- data/app/presenters/hyrax/work_usage.rb +6 -3
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +10 -2
- data/app/search_builders/hyrax/README.md +1 -1
- data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
- data/app/search_builders/hyrax/admin_set_search_builder.rb +1 -1
- data/app/search_builders/hyrax/collection_member_search_builder.rb +6 -1
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +1 -1
- data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
- data/app/search_builders/hyrax/filter_by_type.rb +1 -2
- data/app/search_builders/hyrax/my/collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +1 -1
- data/app/search_builders/hyrax/single_collection_search_builder.rb +1 -1
- data/app/services/hyrax/admin_set_create_service.rb +199 -53
- data/app/services/hyrax/analytics/google/events.rb +37 -0
- data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
- data/app/services/hyrax/analytics/google/visits.rb +44 -0
- data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
- data/app/services/hyrax/analytics/google.rb +204 -0
- data/app/services/hyrax/analytics/matomo.rb +193 -0
- data/app/services/hyrax/analytics/results.rb +79 -0
- data/app/services/hyrax/analytics.rb +12 -82
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
- data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
- data/app/services/hyrax/collections/collection_member_search_service.rb +72 -0
- data/app/services/hyrax/collections/collection_member_service.rb +122 -27
- data/app/services/hyrax/collections/migration_service.rb +4 -2
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +12 -13
- data/app/services/hyrax/collections/nested_collection_query_service.rb +10 -3
- data/app/services/hyrax/collections/permissions_create_service.rb +82 -78
- data/app/services/hyrax/collections/permissions_service.rb +1 -1
- data/app/services/hyrax/contextual_path.rb +24 -1
- data/app/services/hyrax/curation_concern.rb +24 -2
- data/app/services/hyrax/custom_queries/find_file_metadata.rb +7 -5
- data/app/services/hyrax/custom_queries/navigators/parent_collections_navigator.rb +46 -0
- data/app/services/hyrax/default_middleware_stack.rb +11 -0
- data/app/services/hyrax/edit_permissions_service.rb +74 -41
- data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
- data/app/services/hyrax/find_objects_via_solr_service.rb +31 -0
- data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
- data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +4 -1
- data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
- data/app/services/hyrax/listeners/file_metadata_listener.rb +19 -0
- data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
- data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +3 -0
- data/app/services/hyrax/listeners/metadata_index_listener.rb +33 -11
- data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
- data/app/services/hyrax/listeners/proxy_deposit_listener.rb +3 -1
- data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
- data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
- data/app/services/hyrax/listeners.rb +8 -0
- data/app/services/hyrax/multiple_membership_checker.rb +53 -29
- data/app/services/hyrax/permission_manager.rb +4 -4
- data/app/services/hyrax/resource_status.rb +7 -0
- data/app/services/hyrax/restriction_service.rb +4 -0
- data/app/services/hyrax/search_service.rb +4 -2
- data/app/services/hyrax/solr_query_builder_service.rb +45 -8
- data/app/services/hyrax/solr_query_service.rb +224 -0
- data/app/services/hyrax/solr_service.rb +9 -2
- data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
- data/app/services/hyrax/statistics/depositors/summary.rb +2 -1
- data/app/services/hyrax/statistics/users/over_time.rb +8 -5
- data/app/services/hyrax/statistics/works/over_time.rb +10 -0
- data/app/services/hyrax/visibility_intention.rb +20 -2
- data/app/services/hyrax/work_uploads_handler.rb +21 -3
- data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
- data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
- data/app/services/hyrax/workflow/actionable_objects.rb +70 -0
- data/app/services/hyrax/workflow/activate_object.rb +5 -4
- data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
- data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
- data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
- data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
- data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
- data/app/services/hyrax/workflow/object_in_workflow_decorator.rb +31 -0
- data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
- data/app/services/hyrax/workflow/status_list_service.rb +43 -13
- data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
- data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
- data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
- data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
- data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
- data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
- data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
- data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
- data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
- data/app/views/hyrax/admin/stats/show.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
- data/app/views/hyrax/base/_form_relationships.html.erb +1 -2
- data/app/views/hyrax/base/_form_rendering.html.erb +1 -1
- data/app/views/hyrax/base/_form_representative.html.erb +1 -1
- data/app/views/hyrax/base/_form_thumbnail.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_error.html.erb +2 -0
- data/app/views/hyrax/base/_guts4form.html.erb +3 -3
- data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +2 -2
- data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
- data/app/views/hyrax/base/show.html.erb +6 -0
- data/app/views/hyrax/batch_uploads/_form.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +4 -0
- data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
- data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
- data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
- data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
- data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
- data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
- data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form.html.erb +6 -5
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/edit.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/new.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/show.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
- data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
- data/app/views/hyrax/file_sets/edit.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
- data/app/views/hyrax/file_sets/show.html.erb +7 -1
- data/app/views/hyrax/homepage/index.html.erb +1 -1
- data/app/views/hyrax/my/_admin_set_action_menu.html.erb +0 -11
- data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -2
- data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -5
- data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
- data/app/views/hyrax/my/collections/index.html.erb +1 -1
- data/app/views/hyrax/stats/_downloads.html.erb +18 -0
- data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
- data/app/views/hyrax/stats/work.html.erb +17 -9
- data/app/views/layouts/_head_tag_content.html.erb +7 -2
- data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
- data/app/views/layouts/hyrax.html.erb +1 -0
- data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
- data/app/views/shared/_matomo.html.erb +15 -0
- data/app/views/shared/_read_only.html.erb +5 -0
- data/bin/db-migrate-seed.sh +3 -1
- data/bin/hyrax-entrypoint.sh +0 -14
- data/bin/solrcloud-assign-configset.sh +11 -3
- data/bin/solrcloud-upload-configset.sh +17 -6
- data/chart/hyrax/Chart.yaml +9 -5
- data/chart/hyrax/README.md +52 -5
- data/chart/hyrax/templates/_helpers.tpl +15 -1
- data/chart/hyrax/templates/branding-pvc.yaml +2 -2
- data/chart/hyrax/templates/configmap-env.yaml +6 -2
- data/chart/hyrax/templates/deployment-worker.yaml +42 -5
- data/chart/hyrax/templates/deployment.yaml +53 -0
- data/chart/hyrax/templates/derivatives-pvc.yaml +2 -2
- data/chart/hyrax/templates/ingress.yaml +13 -4
- data/chart/hyrax/templates/secrets.yaml +8 -0
- data/chart/hyrax/templates/uploads-pvc.yaml +2 -2
- data/chart/hyrax/values.yaml +84 -2
- data/config/brakeman.ignore +2 -2
- data/config/features.rb +3 -0
- data/config/i18n-tasks.yml +2 -2
- data/config/initializers/1_healthz.rb +1 -0
- data/config/initializers/listeners.rb +5 -4
- data/config/initializers/valkryrie_storage.rb +7 -0
- data/config/locales/hyrax.de.yml +195 -1
- data/config/locales/hyrax.en.yml +192 -13
- data/config/locales/hyrax.es.yml +195 -1
- data/config/locales/hyrax.fr.yml +195 -1
- data/config/locales/hyrax.it.yml +195 -1
- data/config/locales/hyrax.pt-BR.yml +195 -1
- data/config/locales/hyrax.zh.yml +195 -1
- data/config/routes.rb +4 -0
- data/db/seeds.rb +1 -1
- data/docker-compose.yml +42 -9
- data/documentation/developing-your-hyrax-based-app.md +4 -4
- data/documentation/legacyREADME.md +4 -4
- data/hyrax.gemspec +4 -2
- data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
- data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +15 -13
- data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
- data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +4 -2
- data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
- data/lib/hyrax/active_fedora_dummy_model.rb +62 -0
- data/lib/hyrax/collection_name.rb +6 -2
- data/lib/hyrax/configuration.rb +114 -4
- data/lib/hyrax/engine.rb +9 -6
- data/lib/hyrax/errors.rb +2 -0
- data/lib/hyrax/form_fields.rb +1 -0
- data/lib/hyrax/publisher.rb +16 -0
- data/lib/hyrax/resource_name.rb +1 -0
- data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
- data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
- data/lib/hyrax/specs/capybara.rb +5 -3
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +2 -0
- data/lib/hyrax/specs/shared_specs/indexers.rb +6 -0
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +9 -0
- data/lib/hyrax/transactions/admin_set_create.rb +22 -0
- data/lib/hyrax/transactions/collection_create.rb +25 -0
- data/lib/hyrax/transactions/collection_update.rb +20 -0
- data/lib/hyrax/transactions/container.rb +58 -0
- data/lib/hyrax/transactions/file_set_destroy.rb +21 -0
- data/lib/hyrax/transactions/steps/add_file_sets.rb +3 -2
- data/lib/hyrax/transactions/steps/add_to_collections.rb +13 -1
- data/lib/hyrax/transactions/steps/add_to_parent.rb +36 -0
- data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
- data/lib/hyrax/transactions/steps/remove_file_set_from_work.rb +47 -0
- data/lib/hyrax/transactions/steps/save.rb +18 -6
- data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
- data/lib/hyrax/transactions/work_create.rb +2 -1
- data/lib/hyrax/valkyrie_can_can_adapter.rb +1 -0
- data/lib/hyrax/valkyrie_simple_path_generator.rb +20 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +9 -0
- data/lib/tasks/collection_type_global_id.rake +1 -1
- data/lib/tasks/default_admin_set.rake +12 -11
- data/lib/tasks/regenerate_derivatives.rake +12 -0
- data/lib/wings/active_fedora_converter/default_work.rb +15 -0
- data/lib/wings/model_transformer.rb +17 -1
- data/lib/wings/orm_converter.rb +18 -2
- data/lib/wings/setup.rb +17 -0
- data/lib/wings/valkyrie/persister.rb +16 -0
- data/lib/wings/valkyrie/storage.rb +56 -1
- data/lib/wings.rb +0 -21
- data/template.rb +1 -1
- data/vendor/assets/javascripts/morris/morris.min.js +1 -7
- data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
- metadata +120 -17
- data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
@@ -12,7 +12,7 @@ RSpec.feature 'Create a <%= class_name %>', js: false do
|
|
12
12
|
let(:user) do
|
13
13
|
User.new(user_attributes) { |u| u.save(validate: false) }
|
14
14
|
end
|
15
|
-
let(:admin_set_id) {
|
15
|
+
let(:admin_set_id) { Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
|
16
16
|
let(:permission_template) { Hyrax::PermissionTemplate.find_or_create_by!(source_id: admin_set_id) }
|
17
17
|
let(:workflow) { Sipity::Workflow.create!(active: true, name: 'test-workflow', permission_template: permission_template) }
|
18
18
|
|
@@ -31,11 +31,13 @@ RSpec.feature 'Create a <%= class_name %>', js: false do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
scenario do
|
34
|
+
pending 'Changes may be required for this test to pass. See TODO in test.'
|
35
|
+
|
34
36
|
visit '/dashboard'
|
35
37
|
click_link "Works"
|
36
38
|
click_link "Add new work"
|
37
39
|
|
38
|
-
# If you generate more than one work uncomment these lines
|
40
|
+
# TODO: If you generate more than one work uncomment these lines
|
39
41
|
# choose "payload_concern", option: "<%= class_name %>"
|
40
42
|
# click_button "Create work"
|
41
43
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
##
|
4
|
+
# @api public
|
5
|
+
#
|
6
|
+
# Given a model class and an +id+, provides +ActiveModel+ style methods. This
|
7
|
+
# is a tool for providing route resolution and other +ActiveModel+ behavior
|
8
|
+
# for +ActiveFedora+ without loading the object from the fedora backend.
|
9
|
+
#
|
10
|
+
# @note this was originally implemented for +SolrDocument+ as
|
11
|
+
# +Hyrax::SolrDocumentBehavior::ModelWrapper+, but is useful in the more
|
12
|
+
# general case that we know the model class and id, but don't have a full
|
13
|
+
# model object.
|
14
|
+
#
|
15
|
+
class ActiveFedoraDummyModel
|
16
|
+
##
|
17
|
+
# @api public
|
18
|
+
#
|
19
|
+
# @param [Class] model
|
20
|
+
# @param [String, nil] id
|
21
|
+
def initialize(model, id)
|
22
|
+
@model = model
|
23
|
+
@id = id
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# @api public
|
28
|
+
def persisted?
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# @api public
|
34
|
+
def to_param
|
35
|
+
@id
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# @api public
|
40
|
+
def model_name
|
41
|
+
@model.model_name
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# @api public
|
46
|
+
#
|
47
|
+
# @note uses the @model's `._to_partial_path` if implemented, otherwise
|
48
|
+
# constructs a default
|
49
|
+
def to_partial_path
|
50
|
+
return @model._to_partial_path if
|
51
|
+
@model.respond_to?(:_to_partial_path)
|
52
|
+
|
53
|
+
"hyrax/#{model_name.collection}/#{model_name.element}"
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# @api public
|
58
|
+
def to_global_id
|
59
|
+
URI::GID.build app: GlobalID.app, model_name: model_name.name, model_id: @id
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -8,8 +8,12 @@ module Hyrax
|
|
8
8
|
def initialize(klass, namespace = nil, name = nil)
|
9
9
|
super
|
10
10
|
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@human = 'Collection'
|
12
|
+
@i18n_key = :collection
|
13
|
+
@param_key = 'collection'
|
14
|
+
@plural = 'collections'
|
15
|
+
@route_key = 'collections'
|
16
|
+
@singular_route_key = 'collection'
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
data/lib/hyrax/configuration.rb
CHANGED
@@ -112,16 +112,46 @@ module Hyrax
|
|
112
112
|
ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_ANALYTICS', false))
|
113
113
|
end
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
# Currently supports 'google' or 'matomo'
|
116
|
+
# google is default for backward compatability
|
117
|
+
attr_writer :analytics_provider
|
118
|
+
def analytics_provider
|
119
|
+
@analytics_provider ||=
|
120
|
+
ENV.fetch('HYRAX_ANALYTICS_PROVIDER', 'google')
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# @!attribute [w] analytics_start_date
|
125
|
+
# @note this can be set using the +ANALITICS_START_DATE+ environment variable (format is YYYY-MM-DD)
|
126
|
+
# @return [String] date you wish to start collecting analytics for. used to compute the
|
127
|
+
# "all-time" metrics.
|
128
|
+
# This is used to compute the "all-time" metrics
|
129
|
+
# Set this in your .env file (format is YYYY-MM-DD)
|
130
|
+
attr_writer :analytics_start_date
|
131
|
+
def analytics_start_date
|
132
|
+
@analytics_start_date ||=
|
133
|
+
ENV.fetch('ANALYTICS_START_DATE', Time.zone.today - 1.year)
|
118
134
|
end
|
119
|
-
alias google_analytics_id? google_analytics_id
|
120
135
|
|
121
136
|
# Defaulting analytic start date to whenever the file was uploaded by leaving it blank
|
122
137
|
attr_writer :analytic_start_date
|
123
138
|
attr_reader :analytic_start_date
|
124
139
|
|
140
|
+
##
|
141
|
+
# @deprecated use analytics_id from config/analytics.yml instead
|
142
|
+
def google_analytics_id=(value)
|
143
|
+
Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.")
|
144
|
+
Hyrax::Analytics.config.analytics_id = value
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# @deprecated use analytics_id from config/analytics.yml instead
|
149
|
+
def google_analytics_id
|
150
|
+
Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.")
|
151
|
+
Hyrax::Analytics.config.analytics_id
|
152
|
+
end
|
153
|
+
alias google_analytics_id? google_analytics_id
|
154
|
+
|
125
155
|
# @!endgroup
|
126
156
|
# @!group Groups
|
127
157
|
|
@@ -385,6 +415,18 @@ module Hyrax
|
|
385
415
|
# @!endgroup
|
386
416
|
# @!group Valkyrie
|
387
417
|
|
418
|
+
##
|
419
|
+
# @return [Valkyrie::StorageAdapter]
|
420
|
+
def branding_storage_adapter
|
421
|
+
@branding_storage_adapter ||= Valkyrie::StorageAdapter.find(:branding_disk)
|
422
|
+
end
|
423
|
+
|
424
|
+
##
|
425
|
+
# @param [#to_sym] adapter
|
426
|
+
def branding_storage_adapter=(adapter)
|
427
|
+
@branding_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym)
|
428
|
+
end
|
429
|
+
|
388
430
|
##
|
389
431
|
# @return [#save, #save_all, #delete, #wipe!] an indexing adapter
|
390
432
|
def index_adapter
|
@@ -442,6 +484,17 @@ module Hyrax
|
|
442
484
|
# Override characterization runner
|
443
485
|
attr_accessor :characterization_runner
|
444
486
|
|
487
|
+
##
|
488
|
+
# @!attribute [rw] characterization_service
|
489
|
+
# @return [#run] the service to use for charactaerization for Valkyrie
|
490
|
+
# objects
|
491
|
+
# @ see Hyrax::Characterization::ValkyrieCharacterizationService
|
492
|
+
attr_writer :characterization_service
|
493
|
+
def characterization_service
|
494
|
+
@characterization_service ||=
|
495
|
+
Hyrax::Characterization::ValkyrieCharacterizationService
|
496
|
+
end
|
497
|
+
|
445
498
|
# Attributes for the lock manager which ensures a single process/thread is mutating a ore:Aggregation at once.
|
446
499
|
# @!attribute [w] lock_retry_count
|
447
500
|
# How many times to retry to acquire the lock before raising UnableToAcquireLockError
|
@@ -631,6 +684,14 @@ module Hyrax
|
|
631
684
|
@show_work_item_rows ||= 10 # rows on show view
|
632
685
|
end
|
633
686
|
|
687
|
+
# This user is logged as the acting user for jobs and other processes that
|
688
|
+
# run without being attributed to a specific user (e.g. creation of the
|
689
|
+
# default admin set).
|
690
|
+
attr_writer :system_user_key
|
691
|
+
def system_user_key
|
692
|
+
@system_user_key ||= 'systemuser@example.com'
|
693
|
+
end
|
694
|
+
|
634
695
|
attr_writer :batch_user_key
|
635
696
|
def batch_user_key
|
636
697
|
@batch_user_key ||= 'batchuser@example.com'
|
@@ -646,6 +707,55 @@ module Hyrax
|
|
646
707
|
@collection_type_index_field ||= 'collection_type_gid_ssim'
|
647
708
|
end
|
648
709
|
|
710
|
+
attr_writer :collection_model
|
711
|
+
##
|
712
|
+
# @return [#constantize] a string representation of the collection
|
713
|
+
# model
|
714
|
+
def collection_model
|
715
|
+
@collection_model ||= '::Collection'
|
716
|
+
end
|
717
|
+
|
718
|
+
##
|
719
|
+
# @return [Class] the configured collection model class
|
720
|
+
def collection_class
|
721
|
+
collection_model.safe_constantize
|
722
|
+
end
|
723
|
+
|
724
|
+
attr_writer :admin_set_model
|
725
|
+
##
|
726
|
+
# @return [#constantize] a string representation of the admin set
|
727
|
+
# model
|
728
|
+
def admin_set_model
|
729
|
+
@admin_set_model ||= 'AdminSet'
|
730
|
+
end
|
731
|
+
|
732
|
+
##
|
733
|
+
# @return [Class] the configured admin set model class
|
734
|
+
def admin_set_class
|
735
|
+
admin_set_model.constantize
|
736
|
+
end
|
737
|
+
|
738
|
+
##
|
739
|
+
# @return [String] the default admin set id
|
740
|
+
def default_admin_set_id
|
741
|
+
default_admin_set.id.to_s
|
742
|
+
end
|
743
|
+
|
744
|
+
##
|
745
|
+
# @return [Hyrax::AdministrativeSet] the default admin set
|
746
|
+
# @see Hyrax::AdminSetCreateService.find_or_create_default_admin_set
|
747
|
+
def default_admin_set
|
748
|
+
@default_admin_set ||= Hyrax::AdminSetCreateService.find_or_create_default_admin_set
|
749
|
+
end
|
750
|
+
|
751
|
+
##
|
752
|
+
# If the default admin set is changed, call reset. The next time one of the default
|
753
|
+
# admin set configs is checked, the default_admin_set variable will be updated.
|
754
|
+
# @see Hyrax::DefaultAdministrativeSet.update
|
755
|
+
def reset_default_admin_set
|
756
|
+
@default_admin_set = nil
|
757
|
+
end
|
758
|
+
|
649
759
|
attr_writer :id_field
|
650
760
|
def id_field
|
651
761
|
@id_field || index_field_mapper.id_field
|
data/lib/hyrax/engine.rb
CHANGED
@@ -3,25 +3,27 @@ module Hyrax
|
|
3
3
|
class Engine < ::Rails::Engine
|
4
4
|
isolate_namespace Hyrax
|
5
5
|
|
6
|
+
require 'almond-rails'
|
6
7
|
require 'awesome_nested_set'
|
7
8
|
require 'breadcrumbs_on_rails'
|
9
|
+
require 'clipboard/rails'
|
8
10
|
require 'draper'
|
9
|
-
require 'dry/struct'
|
10
11
|
require 'dry/equalizer'
|
11
12
|
require 'dry/events'
|
13
|
+
require 'dry/struct'
|
12
14
|
require 'dry/validation'
|
13
|
-
require '
|
15
|
+
require 'flipflop'
|
14
16
|
require 'flot-rails'
|
15
|
-
require '
|
17
|
+
require 'hydra-file_characterization'
|
16
18
|
require 'jquery-datatables-rails'
|
17
|
-
require '
|
19
|
+
require 'jquery-ui-rails'
|
20
|
+
require 'legato'
|
18
21
|
require 'qa'
|
19
|
-
require 'clipboard/rails'
|
20
22
|
require 'tinymce-rails'
|
21
|
-
require 'legato'
|
22
23
|
require 'valkyrie'
|
23
24
|
|
24
25
|
require 'hydra/derivatives'
|
26
|
+
require 'hyrax/active_fedora_dummy_model'
|
25
27
|
require 'hyrax/controller_resource'
|
26
28
|
require 'hyrax/form_fields'
|
27
29
|
require 'hyrax/indexer'
|
@@ -31,6 +33,7 @@ module Hyrax
|
|
31
33
|
require 'hyrax/search_state'
|
32
34
|
require 'hyrax/transactions'
|
33
35
|
require 'hyrax/errors'
|
36
|
+
require 'hyrax/valkyrie_simple_path_generator'
|
34
37
|
|
35
38
|
# Force these models to be added to Legato's registry in development mode
|
36
39
|
config.eager_load_paths += %W[
|
data/lib/hyrax/errors.rb
CHANGED
data/lib/hyrax/form_fields.rb
CHANGED
@@ -49,6 +49,7 @@ module Hyrax
|
|
49
49
|
|
50
50
|
form_field_definitions.each do |field_name, options|
|
51
51
|
descendant.property field_name.to_sym, options.merge(display: true, default: [])
|
52
|
+
descendant.validates field_name.to_sym, presence: true if options.fetch(:required, false)
|
52
53
|
end
|
53
54
|
end
|
54
55
|
end
|
data/lib/hyrax/publisher.rb
CHANGED
@@ -94,6 +94,18 @@ module Hyrax
|
|
94
94
|
# @macro a_registered_event
|
95
95
|
register_event('batch.created')
|
96
96
|
|
97
|
+
# @since 3.0.0
|
98
|
+
# @macro a_registered_event
|
99
|
+
register_event('collection.metadata.updated')
|
100
|
+
|
101
|
+
# @since 3.0.0
|
102
|
+
# @macro a_registered_event
|
103
|
+
register_event('collection.membership.updated')
|
104
|
+
|
105
|
+
# @since 3.3.0
|
106
|
+
# @macro a_registered_event
|
107
|
+
register_event('file.downloaded')
|
108
|
+
|
97
109
|
# @since 3.0.0
|
98
110
|
# @macro a_registered_event
|
99
111
|
register_event('file.set.audited')
|
@@ -129,5 +141,9 @@ module Hyrax
|
|
129
141
|
# @since 3.0.0
|
130
142
|
# @macro a_registered_event
|
131
143
|
register_event('object.metadata.updated')
|
144
|
+
|
145
|
+
# @since 3.2.0
|
146
|
+
# @macro a_registered_event
|
147
|
+
register_event('object.file.uploaded')
|
132
148
|
end
|
133
149
|
end
|
data/lib/hyrax/resource_name.rb
CHANGED
@@ -61,8 +61,8 @@ module Hyrax
|
|
61
61
|
|
62
62
|
def build_resources(xml, doc_set)
|
63
63
|
doc_set.each do |doc|
|
64
|
-
model = doc.fetch('has_model_ssim', []).first.
|
65
|
-
if model ==
|
64
|
+
model = doc.fetch('has_model_ssim', []).first.safe_constantize
|
65
|
+
if model.try(:collection?) || model == Hyrax.config.collection_class
|
66
66
|
build_resource(xml, doc, model, hyrax_routes)
|
67
67
|
else
|
68
68
|
build_resource(xml, doc, model, main_app_routes)
|
@@ -32,8 +32,8 @@ module Hyrax
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def build_collections(xml)
|
36
|
-
|
35
|
+
def build_collections(xml, searcher: AbstractTypeRelation.new(allowable_types: [::Collection, Hyrax.config.collection_class]))
|
36
|
+
searcher.search_in_batches(public_access) do |doc_set|
|
37
37
|
build_resources(xml, doc_set, hyrax_routes)
|
38
38
|
end
|
39
39
|
end
|
data/lib/hyrax/specs/capybara.rb
CHANGED
@@ -15,9 +15,9 @@ require 'capybara/rspec'
|
|
15
15
|
require 'capybara/rails'
|
16
16
|
require 'capybara-screenshot/rspec'
|
17
17
|
require 'selenium-webdriver'
|
18
|
-
require 'webdrivers'
|
18
|
+
require 'webdrivers' unless ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
|
19
19
|
|
20
|
-
if ENV['IN_DOCKER'].present?
|
20
|
+
if ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
|
21
21
|
args = %w[disable-gpu no-sandbox whitelisted-ips window-size=1400,1400]
|
22
22
|
args.push('headless') if ActiveModel::Type::Boolean.new.cast(ENV['CHROME_HEADLESS_MODE'])
|
23
23
|
|
@@ -40,7 +40,9 @@ if ENV['IN_DOCKER'].present?
|
|
40
40
|
|
41
41
|
Capybara.server_host = '0.0.0.0'
|
42
42
|
Capybara.server_port = 3010
|
43
|
-
|
43
|
+
|
44
|
+
ip = IPSocket.getaddress(Socket.gethostname)
|
45
|
+
Capybara.app_host = "http://#{ip}:#{Capybara.server_port}"
|
44
46
|
else
|
45
47
|
TEST_HOST = 'localhost:3000'.freeze
|
46
48
|
# @note In January 2018, TravisCI disabled Chrome sandboxing in its Linux
|
@@ -152,6 +152,8 @@ end
|
|
152
152
|
RSpec.shared_examples 'a Hyrax::AdministrativeSet' do
|
153
153
|
subject(:admin_set) { described_class.new }
|
154
154
|
|
155
|
+
it_behaves_like 'a model with core metadata'
|
156
|
+
|
155
157
|
it 'has an #alternative_title' do
|
156
158
|
expect { admin_set.alternative_title = ['Moomin'] }
|
157
159
|
.to change { admin_set.alternative_title }
|
@@ -188,5 +188,11 @@ RSpec.shared_examples 'a Collection indexer' do
|
|
188
188
|
expect(indexer.to_solr)
|
189
189
|
.to include(thumbnail_path_ss: include('assets/collection', '.png'))
|
190
190
|
end
|
191
|
+
|
192
|
+
it 'indexes depositor' do
|
193
|
+
expect(indexer.to_solr)
|
194
|
+
.to include(depositor_ssim: [resource.depositor],
|
195
|
+
depositor_tesim: [resource.depositor])
|
196
|
+
end
|
191
197
|
end
|
192
198
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'hyrax/transactions/transaction'
|
3
|
+
|
4
|
+
module Hyrax
|
5
|
+
module Transactions
|
6
|
+
##
|
7
|
+
# Creates a Hyrax::AdministrativeSet from a ChangeSet
|
8
|
+
#
|
9
|
+
# @since 3.2.0
|
10
|
+
class AdminSetCreate < Transaction
|
11
|
+
DEFAULT_STEPS = ['change_set.apply',
|
12
|
+
'admin_set_resource.apply_collection_type_permissions',
|
13
|
+
'admin_set_resource.save_acl'].freeze
|
14
|
+
|
15
|
+
##
|
16
|
+
# @see Hyrax::Transactions::Transaction
|
17
|
+
def initialize(container: Container, steps: DEFAULT_STEPS)
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'hyrax/transactions/transaction'
|
3
|
+
|
4
|
+
module Hyrax
|
5
|
+
module Transactions
|
6
|
+
##
|
7
|
+
# Creates a Collection from a ChangeSet
|
8
|
+
#
|
9
|
+
# @since 3.2.0
|
10
|
+
class CollectionCreate < Transaction
|
11
|
+
DEFAULT_STEPS = ['change_set.set_user_as_depositor',
|
12
|
+
'change_set.set_collection_type_gid',
|
13
|
+
'change_set.add_to_collections',
|
14
|
+
'change_set.apply',
|
15
|
+
'collection_resource.apply_collection_type_permissions',
|
16
|
+
'collection_resource.save_acl'].freeze
|
17
|
+
|
18
|
+
##
|
19
|
+
# @see Hyrax::Transactions::Transaction
|
20
|
+
def initialize(container: Container, steps: DEFAULT_STEPS)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'hyrax/transactions/transaction'
|
3
|
+
|
4
|
+
module Hyrax
|
5
|
+
module Transactions
|
6
|
+
##
|
7
|
+
# Creates a Collection from a ChangeSet
|
8
|
+
#
|
9
|
+
# @since 3.2.0
|
10
|
+
class CollectionUpdate < Transaction
|
11
|
+
DEFAULT_STEPS = ['change_set.apply'].freeze
|
12
|
+
|
13
|
+
##
|
14
|
+
# @see Hyrax::Transactions::Transaction
|
15
|
+
def initialize(container: Container, steps: DEFAULT_STEPS)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -18,21 +18,29 @@ module Hyrax
|
|
18
18
|
#
|
19
19
|
# @see https://dry-rb.org/gems/dry-container/
|
20
20
|
class Container # rubocop:disable Metrics/ClassLength
|
21
|
+
require 'hyrax/transactions/admin_set_create'
|
21
22
|
require 'hyrax/transactions/apply_change_set'
|
23
|
+
require 'hyrax/transactions/collection_create'
|
24
|
+
require 'hyrax/transactions/collection_update'
|
22
25
|
require 'hyrax/transactions/create_work'
|
23
26
|
require 'hyrax/transactions/destroy_work'
|
27
|
+
require 'hyrax/transactions/file_set_destroy'
|
24
28
|
require 'hyrax/transactions/work_create'
|
25
29
|
require 'hyrax/transactions/work_destroy'
|
26
30
|
require 'hyrax/transactions/update_work'
|
27
31
|
require 'hyrax/transactions/steps/add_file_sets'
|
28
32
|
require 'hyrax/transactions/steps/add_to_collections'
|
33
|
+
require 'hyrax/transactions/steps/add_to_parent'
|
29
34
|
require 'hyrax/transactions/steps/apply_collection_permission_template'
|
35
|
+
require 'hyrax/transactions/steps/apply_collection_type_permissions'
|
30
36
|
require 'hyrax/transactions/steps/apply_permission_template'
|
31
37
|
require 'hyrax/transactions/steps/apply_visibility'
|
32
38
|
require 'hyrax/transactions/steps/delete_resource'
|
33
39
|
require 'hyrax/transactions/steps/destroy_work'
|
34
40
|
require 'hyrax/transactions/steps/ensure_admin_set'
|
41
|
+
require 'hyrax/transactions/steps/set_collection_type_gid'
|
35
42
|
require 'hyrax/transactions/steps/ensure_permission_template'
|
43
|
+
require 'hyrax/transactions/steps/remove_file_set_from_work'
|
36
44
|
require 'hyrax/transactions/steps/save'
|
37
45
|
require 'hyrax/transactions/steps/save_work'
|
38
46
|
require 'hyrax/transactions/steps/save_access_control'
|
@@ -55,6 +63,14 @@ module Hyrax
|
|
55
63
|
ApplyChangeSet.new
|
56
64
|
end
|
57
65
|
|
66
|
+
ops.register 'create_collection' do
|
67
|
+
CollectionCreate.new
|
68
|
+
end
|
69
|
+
|
70
|
+
ops.register 'update_collection' do
|
71
|
+
CollectionUpdate.new
|
72
|
+
end
|
73
|
+
|
58
74
|
ops.register 'create_work' do
|
59
75
|
WorkCreate.new
|
60
76
|
end
|
@@ -67,6 +83,10 @@ module Hyrax
|
|
67
83
|
Steps::Save.new
|
68
84
|
end
|
69
85
|
|
86
|
+
ops.register 'set_collection_type_gid' do
|
87
|
+
Steps::SetCollectionTypeGid.new
|
88
|
+
end
|
89
|
+
|
70
90
|
ops.register 'set_default_admin_set' do
|
71
91
|
Steps::SetDefaultAdminSet.new
|
72
92
|
end
|
@@ -92,11 +112,49 @@ module Hyrax
|
|
92
112
|
end
|
93
113
|
end
|
94
114
|
|
115
|
+
namespace 'file_set' do |ops| # Hyrax::FileSet
|
116
|
+
ops.register 'delete' do
|
117
|
+
Steps::DeleteResource.new
|
118
|
+
end
|
119
|
+
|
120
|
+
ops.register 'destroy' do
|
121
|
+
FileSetDestroy.new
|
122
|
+
end
|
123
|
+
|
124
|
+
ops.register 'remove_from_work' do
|
125
|
+
Steps::RemoveFileSetFromWork.new
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
namespace 'admin_set_resource' do |ops| # valkyrie administrative set
|
130
|
+
ops.register 'apply_collection_type_permissions' do
|
131
|
+
Steps::ApplyCollectionTypePermissions.new
|
132
|
+
end
|
133
|
+
|
134
|
+
ops.register 'save_acl' do
|
135
|
+
Steps::SaveAccessControl.new
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
namespace 'collection_resource' do |ops| # valkyrie collection
|
140
|
+
ops.register 'apply_collection_type_permissions' do
|
141
|
+
Steps::ApplyCollectionTypePermissions.new
|
142
|
+
end
|
143
|
+
|
144
|
+
ops.register 'save_acl' do
|
145
|
+
Steps::SaveAccessControl.new
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
95
149
|
namespace 'work_resource' do |ops| # valkyrie works
|
96
150
|
ops.register 'add_file_sets' do
|
97
151
|
Steps::AddFileSets.new
|
98
152
|
end
|
99
153
|
|
154
|
+
ops.register 'add_to_parent' do
|
155
|
+
Steps::AddToParent.new
|
156
|
+
end
|
157
|
+
|
100
158
|
ops.register 'delete' do
|
101
159
|
Steps::DeleteResource.new
|
102
160
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'hyrax/transactions/transaction'
|
3
|
+
|
4
|
+
module Hyrax
|
5
|
+
module Transactions
|
6
|
+
##
|
7
|
+
# destroys a FileSet resource.
|
8
|
+
#
|
9
|
+
# @since 3.1.0
|
10
|
+
class FileSetDestroy < Transaction
|
11
|
+
DEFAULT_STEPS = ['file_set.remove_from_work',
|
12
|
+
'file_set.delete'].freeze
|
13
|
+
|
14
|
+
##
|
15
|
+
# @see Hyrax::Transactions::Transaction
|
16
|
+
def initialize(container: Container, steps: DEFAULT_STEPS)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -20,10 +20,11 @@ module Hyrax
|
|
20
20
|
##
|
21
21
|
# @param [Hyrax::Work] obj
|
22
22
|
# @param [Enumerable<UploadedFile>] uploaded_files
|
23
|
+
# @param [Enumerable<Hash>] file_set_params
|
23
24
|
#
|
24
25
|
# @return [Dry::Monads::Result]
|
25
|
-
def call(obj, uploaded_files: [])
|
26
|
-
if @handler.new(work: obj).add(files: uploaded_files).attach
|
26
|
+
def call(obj, uploaded_files: [], file_set_params: [])
|
27
|
+
if @handler.new(work: obj).add(files: uploaded_files, file_set_params: file_set_params).attach
|
27
28
|
Success(obj)
|
28
29
|
else
|
29
30
|
Failure[:failed_to_attach_file_sets, uploaded_files]
|