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
@@ -34,6 +34,8 @@ module Hyrax
|
|
34
34
|
:original_file_id,
|
35
35
|
to: :solr_document
|
36
36
|
|
37
|
+
delegate :member_of_collection_ids, to: :parent
|
38
|
+
|
37
39
|
def workflow
|
38
40
|
nil
|
39
41
|
end
|
@@ -57,8 +59,13 @@ module Hyrax
|
|
57
59
|
current_ability.can?(:read, id) ? first_title : 'File'
|
58
60
|
end
|
59
61
|
|
62
|
+
##
|
63
|
+
# @deprecated use `::Ability.can?(:edit, presenter)`. Hyrax views calling
|
64
|
+
# presenter {#editor} methods will continue to call them until Hyrax
|
65
|
+
# 4.0.0. The deprecation time horizon for the presenter methods themselves
|
66
|
+
# is 5.0.0.
|
60
67
|
def editor?
|
61
|
-
current_ability.can?(:edit,
|
68
|
+
current_ability.can?(:edit, self)
|
62
69
|
end
|
63
70
|
|
64
71
|
def tweeter
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# Called by the stats controller, it finds cached file pageview data,
|
3
|
-
# and prepares it for visualization in /app/views/stats/file.html.erb
|
4
2
|
module Hyrax
|
3
|
+
##
|
4
|
+
# Called by the stats controller, it finds cached file pageview data,
|
5
|
+
# and prepares it for visualization in /app/views/stats/file.html.erb
|
5
6
|
class FileUsage < StatsUsagePresenter
|
6
7
|
def initialize(id)
|
7
8
|
self.model = ::FileSet.find(id)
|
@@ -43,6 +43,10 @@ module Hyrax
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def analytics_reporting_section?
|
47
|
+
%w[work_reports collection_reports].include?(controller_name)
|
48
|
+
end
|
49
|
+
|
46
50
|
# Draw a collaspable menu section. The passed block should contain <li> items.
|
47
51
|
def collapsable_section(text, id:, icon_class:, open:, &block)
|
48
52
|
CollapsableSectionPresenter.new(view_context: view_context,
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
##
|
4
|
+
# constructs presenters for the pcdm:members of an Object, omitting those
|
5
|
+
# not readable by a provided +Ability+.
|
6
|
+
#
|
7
|
+
# this implementation builds the presenters without recourse to the request
|
8
|
+
# context and ActiveFedora-specific index structures (i.e. no `list_source`
|
9
|
+
# or `proxy_in_ssi`).
|
10
|
+
#
|
11
|
+
# @see MemberPresenterFactory
|
12
|
+
class PcdmMemberPresenterFactory
|
13
|
+
class_attribute :file_presenter_class, :work_presenter_class
|
14
|
+
self.file_presenter_class = FileSetPresenter
|
15
|
+
self.work_presenter_class = WorkShowPresenter
|
16
|
+
|
17
|
+
attr_reader :ability, :object
|
18
|
+
|
19
|
+
##
|
20
|
+
# @param [#member_ids] object
|
21
|
+
# @param [::Ability] ability
|
22
|
+
def initialize(object, ability, _request = nil)
|
23
|
+
@object = object
|
24
|
+
@ability = ability
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# @return [Array<FileSetPresenter, WorkShowPresenter>]
|
29
|
+
# @return [Enumerator<FileSetPresenter>]
|
30
|
+
def file_set_presenters
|
31
|
+
return enum_for(:file_set_presenters) unless block_given?
|
32
|
+
|
33
|
+
results = query_docs(generic_type: "FileSet")
|
34
|
+
|
35
|
+
object.member_ids.each do |id|
|
36
|
+
id = id.to_s
|
37
|
+
indx = results.index { |doc| id == doc['id'] }
|
38
|
+
next if indx.nil?
|
39
|
+
hash = results.delete_at(indx)
|
40
|
+
yield presenter_for(document: ::SolrDocument.new(hash), ability: ability)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# @note defaults to using `object.member_ids`. passing a specific set of
|
46
|
+
# ids is supported for compatibility with {MemberPresenterFactory}, but
|
47
|
+
# we recommend making sparing use of this feature.
|
48
|
+
#
|
49
|
+
# @overload member_presenters
|
50
|
+
# @return [Enumerator<FileSetPresenter, WorkShowPresenter>]
|
51
|
+
# @raise [ArgumentError] if an unindexed id is passed
|
52
|
+
# @overload member_presenters
|
53
|
+
# @param [Array<#to_s>] ids
|
54
|
+
# @return [Enumerator<FileSetPresenter, WorkShowPresenter>]
|
55
|
+
# @raise [ArgumentError] if an unindexed id is passed
|
56
|
+
def member_presenters(ids = object.member_ids)
|
57
|
+
return enum_for(:member_presenters, ids) unless block_given?
|
58
|
+
|
59
|
+
results = query_docs(ids: ids)
|
60
|
+
|
61
|
+
ids.each do |id|
|
62
|
+
id = id.to_s
|
63
|
+
indx = results.index { |doc| id == doc['id'] }
|
64
|
+
raise(ArgumentError, "Could not find an indexed document for id: #{id}") if
|
65
|
+
indx.nil?
|
66
|
+
hash = results.delete_at(indx)
|
67
|
+
yield presenter_for(document: ::SolrDocument.new(hash), ability: ability)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# @return [Array<#to_s>]
|
73
|
+
def ordered_ids
|
74
|
+
object.member_ids
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# @return [Array<WorkShowPresenter>]
|
79
|
+
def work_presenters
|
80
|
+
return enum_for(:work_presenters) unless block_given?
|
81
|
+
|
82
|
+
results = query_docs(generic_type: "Work")
|
83
|
+
|
84
|
+
object.member_ids.each do |id|
|
85
|
+
id = id.to_s
|
86
|
+
indx = results.index { |doc| id == doc['id'] }
|
87
|
+
next if indx.nil?
|
88
|
+
hash = results.delete_at(indx)
|
89
|
+
yield presenter_for(document: ::SolrDocument.new(hash), ability: ability)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# @param [::SolrDocument] document
|
95
|
+
# @param [::Ability] ability
|
96
|
+
#
|
97
|
+
# @return
|
98
|
+
def presenter_for(document:, ability:)
|
99
|
+
case document['has_model_ssim'].first
|
100
|
+
when Hyrax::FileSet.name
|
101
|
+
Hyrax::FileSetPresenter.new(document, ability)
|
102
|
+
else
|
103
|
+
Hyrax::WorkShowPresenter.new(document, ability)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def query_docs(generic_type: nil, ids: object.member_ids)
|
110
|
+
query = "{!terms f=id}#{ids.join(',')}"
|
111
|
+
query += "{!term f=generic_type_si}#{generic_type}" if generic_type
|
112
|
+
|
113
|
+
Hyrax::SolrService
|
114
|
+
.post(query, rows: 10_000)
|
115
|
+
.fetch('response')
|
116
|
+
.fetch('docs')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -1,27 +1,56 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Hyrax
|
4
|
+
##
|
5
|
+
# @api public
|
6
|
+
#
|
7
|
+
# Presents works in context as "trophied" for a given user.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# my_user = User.find(user_id)
|
11
|
+
#
|
12
|
+
# trophies = Hyrax::TrophyPresenter.find_by_user(my_user)
|
13
|
+
# trophies.each do |trophy|
|
14
|
+
# puts "Object name/title: #{trophy}"
|
15
|
+
# puts "Thumbnail path: #{trophy.thumbnail_path}"
|
16
|
+
# end
|
3
17
|
class TrophyPresenter
|
4
18
|
include ModelProxy
|
19
|
+
|
20
|
+
##
|
21
|
+
# @param solr_document [::SolrDocument]
|
5
22
|
def initialize(solr_document)
|
6
23
|
@solr_document = solr_document
|
7
24
|
end
|
8
25
|
|
26
|
+
##
|
27
|
+
# @!attribute [r] SolrDocument
|
28
|
+
# @return [::SolrDocument]
|
9
29
|
attr_reader :solr_document
|
10
30
|
|
11
31
|
delegate :to_s, :thumbnail_path, to: :solr_document
|
12
32
|
|
33
|
+
##
|
13
34
|
# @param user [User] the user to find the TrophyPresentes for.
|
35
|
+
#
|
14
36
|
# @return [Array<TrophyPresenter>] a list of all the trophy presenters for the user
|
15
37
|
def self.find_by_user(user)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
38
|
+
ids = user.trophies.pluck(:work_id)
|
39
|
+
return ids if ids.empty?
|
40
|
+
|
41
|
+
documents = Hyrax::SolrQueryService.new.with_ids(ids: ids).solr_documents
|
42
|
+
|
43
|
+
documents.map { |doc| new(doc) }
|
20
44
|
rescue RSolr::Error::ConnectionRefused
|
21
45
|
[]
|
22
46
|
end
|
23
47
|
|
48
|
+
##
|
49
|
+
# @api private
|
50
|
+
# @deprecated use CatalogController.blacklight_config.document_model instead
|
24
51
|
def self.document_model
|
52
|
+
Deprecation
|
53
|
+
.warn("Use CatalogController.blacklight_config.document_model instead.")
|
25
54
|
CatalogController.blacklight_config.document_model
|
26
55
|
end
|
27
56
|
private_class_method :document_model
|
@@ -1,16 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Hyrax
|
3
3
|
class UserProfilePresenter
|
4
|
+
##
|
5
|
+
# @param user [::User]
|
6
|
+
# @param ability [::Ability]
|
4
7
|
def initialize(user, ability)
|
5
8
|
@user = user
|
6
9
|
@ability = ability
|
7
10
|
end
|
8
11
|
|
12
|
+
##
|
13
|
+
# @!attribute [r] ability
|
14
|
+
# @return [::Ability]
|
15
|
+
# @!attribute [r] user
|
16
|
+
# @return [::User]
|
9
17
|
attr_reader :user, :ability
|
10
18
|
|
11
19
|
delegate :name, to: :user
|
12
20
|
|
13
|
-
|
21
|
+
##
|
22
|
+
# @return [Boolean] true if the presenter is for the logged in user
|
14
23
|
def current_user?
|
15
24
|
user == ability.current_user
|
16
25
|
end
|
@@ -23,6 +32,7 @@ module Hyrax
|
|
23
32
|
end
|
24
33
|
end
|
25
34
|
|
35
|
+
##
|
26
36
|
# @return [Array<TrophyPresenter>] list of TrophyPresenters for this profile.
|
27
37
|
def trophies
|
28
38
|
@trophies ||= Hyrax::TrophyPresenter.find_by_user(user)
|
@@ -1,10 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Hyrax
|
3
|
+
##
|
4
|
+
# @api public
|
3
5
|
class VersionListPresenter
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
##
|
9
|
+
# @param version_list [Array<#created>]
|
4
10
|
def initialize(version_list)
|
5
11
|
@raw_list = version_list
|
6
12
|
end
|
7
13
|
|
14
|
+
##
|
15
|
+
# @param [Object] an object representing the File Set
|
16
|
+
#
|
17
|
+
# @return [Enumerable<Hyrax::VersionPresenter>] an enumerable of presenters
|
18
|
+
# for the relevant file versions.
|
19
|
+
#
|
20
|
+
# @raise [ArgumentError] if we can't build an enu
|
21
|
+
def self.for(file_set:)
|
22
|
+
new(file_set.original_file&.versions&.all.to_a)
|
23
|
+
rescue NoMethodError
|
24
|
+
raise ArgumentError
|
25
|
+
end
|
26
|
+
|
8
27
|
delegate :each, to: :wrapped_list
|
9
28
|
|
10
29
|
private
|
@@ -20,8 +20,9 @@ module Hyrax
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def committer
|
23
|
-
|
24
|
-
|
23
|
+
Hyrax::VersionCommitter
|
24
|
+
.find_by(version_id: @version.uri)
|
25
|
+
&.committer_login
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -10,10 +10,11 @@ module Hyrax
|
|
10
10
|
attr_writer :member_presenter_factory
|
11
11
|
attr_accessor :solr_document, :current_ability, :request
|
12
12
|
|
13
|
-
class_attribute :collection_presenter_class
|
13
|
+
class_attribute :collection_presenter_class, :presenter_factory_class
|
14
14
|
|
15
15
|
# modify this attribute to use an alternate presenter class for the collections
|
16
16
|
self.collection_presenter_class = CollectionPresenter
|
17
|
+
self.presenter_factory_class = MemberPresenterFactory
|
17
18
|
|
18
19
|
# Methods used by blacklight helpers
|
19
20
|
delegate :has?, :first, :fetch, :export_formats, :export_as, to: :solr_document
|
@@ -94,7 +95,7 @@ module Hyrax
|
|
94
95
|
return nil if representative_id.blank?
|
95
96
|
@representative_presenter ||=
|
96
97
|
begin
|
97
|
-
result =
|
98
|
+
result = member_presenters([representative_id]).first
|
98
99
|
return nil if result.try(:id) == id
|
99
100
|
result.try(:representative_presenter) || result
|
100
101
|
end
|
@@ -132,8 +133,13 @@ module Hyrax
|
|
132
133
|
graph.dump(:ttl)
|
133
134
|
end
|
134
135
|
|
136
|
+
##
|
137
|
+
# @deprecated use `::Ability.can?(:edit, presenter)`. Hyrax views calling
|
138
|
+
# presenter {#editor} methods will continue to call them until Hyrax
|
139
|
+
# 4.0.0. The deprecation time horizon for the presenter methods themselves
|
140
|
+
# is 5.0.0.
|
135
141
|
def editor?
|
136
|
-
current_ability.can?(:edit,
|
142
|
+
current_ability.can?(:edit, self)
|
137
143
|
end
|
138
144
|
|
139
145
|
def tweeter
|
@@ -181,9 +187,13 @@ module Hyrax
|
|
181
187
|
paginated_item_list(page_array: authorized_item_ids)
|
182
188
|
end
|
183
189
|
|
190
|
+
##
|
191
|
+
# @deprecated use `#member_presenters(ids)` instead
|
192
|
+
#
|
184
193
|
# @param [Array<String>] ids a list of ids to build presenters for
|
185
194
|
# @return [Array<presenter_class>] presenters for the array of ids (not filtered by class)
|
186
195
|
def member_presenters_for(an_array_of_ids)
|
196
|
+
Deprecation.warn("Use `#member_presenters` instead.")
|
187
197
|
member_presenters(an_array_of_ids)
|
188
198
|
end
|
189
199
|
|
@@ -219,11 +229,28 @@ module Hyrax
|
|
219
229
|
end
|
220
230
|
end
|
221
231
|
|
222
|
-
|
223
|
-
# @
|
224
|
-
|
232
|
+
##
|
233
|
+
# @return [Integer]
|
234
|
+
def member_count
|
235
|
+
@member_count ||= member_presenters.count
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# Given a set of collections, which the caller asserts the current ability
|
240
|
+
# can deposit to, decide whether to display actions to add this work to a
|
241
|
+
# collection.
|
242
|
+
#
|
243
|
+
# By default, this returns `true` if any collections are passed in OR the
|
244
|
+
# current ability can create a collection.
|
245
|
+
#
|
246
|
+
# @param collections [Enumerable<::Collection>, nil] list of collections to
|
247
|
+
# which the current ability can deposit
|
248
|
+
#
|
249
|
+
# @return [Boolean] a flag indicating whether to display collection deposit
|
250
|
+
# options.
|
225
251
|
def show_deposit_for?(collections:)
|
226
|
-
collections.present? ||
|
252
|
+
collections.present? ||
|
253
|
+
current_ability.can?(:create_any, Hyrax.config.collection_class)
|
227
254
|
end
|
228
255
|
|
229
256
|
##
|
@@ -278,7 +305,9 @@ module Hyrax
|
|
278
305
|
|
279
306
|
def member_presenter_factory
|
280
307
|
@member_presenter_factory ||=
|
281
|
-
|
308
|
+
self.class
|
309
|
+
.presenter_factory_class
|
310
|
+
.new(solr_document, current_ability, request)
|
282
311
|
end
|
283
312
|
|
284
313
|
def graph
|
@@ -1,8 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Called by the stats controller, it finds cached work pageview data,
|
4
|
-
# and prepares it for visualization in /app/views/stats/work.html.erb
|
2
|
+
|
5
3
|
module Hyrax
|
4
|
+
# TODO: - Analytics do we still need this?
|
5
|
+
# Follows the model established by {FileUsage}.
|
6
|
+
#
|
7
|
+
# Called by the stats controller, it finds cached work pageview data,
|
8
|
+
# and prepares it for visualization in /app/views/stats/work.html.erb
|
6
9
|
class WorkUsage < StatsUsagePresenter
|
7
10
|
def initialize(id)
|
8
11
|
self.model = Hyrax::WorkRelation.new.find(id)
|
@@ -11,12 +11,14 @@ module Hyrax
|
|
11
11
|
|
12
12
|
attr_reader :field, :values, :options
|
13
13
|
|
14
|
+
##
|
14
15
|
# @param [Symbol] field
|
15
16
|
# @param [Array] values
|
16
17
|
# @param [Hash] options
|
17
18
|
# @option options [String] :label The field label to render
|
18
19
|
# @option options [String] :include_empty Do we render if if the values are empty?
|
19
20
|
# @option options [String] :work_type Used for some I18n logic
|
21
|
+
# @option options [Boolean] :sort sort the values with +Array#sort+ if truthy
|
20
22
|
def initialize(field, values, options = {})
|
21
23
|
@field = field
|
22
24
|
@values = values
|
@@ -31,7 +33,10 @@ module Hyrax
|
|
31
33
|
|
32
34
|
attributes = microdata_object_attributes(field).merge(class: "attribute attribute-#{field}")
|
33
35
|
|
34
|
-
|
36
|
+
values_array = Array(values)
|
37
|
+
values_array = values_array.sort if options[:sort]
|
38
|
+
|
39
|
+
markup += values_array.map do |value|
|
35
40
|
"<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</li>"
|
36
41
|
end.join
|
37
42
|
|
@@ -48,7 +53,10 @@ module Hyrax
|
|
48
53
|
|
49
54
|
attributes = microdata_object_attributes(field).merge(class: "attribute attribute-#{field}")
|
50
55
|
|
51
|
-
|
56
|
+
values_array = Array(values)
|
57
|
+
values_array.sort! if options[:sort]
|
58
|
+
|
59
|
+
markup += values_array.map do |value|
|
52
60
|
"<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</li>"
|
53
61
|
end.join
|
54
62
|
markup += %(</ul></dd>)
|
@@ -66,4 +66,4 @@ module Hyrax
|
|
66
66
|
end
|
67
67
|
```
|
68
68
|
|
69
|
-
There is no point having the other `filter_models` methods apply `:fq`s that we then try to undo or overwrite. In general, directly overwriting the whole `default_processor_chain` or solr parameters like `:fq` is less flexible than appending constraints sufficient for your use case. In particular, you might find that you have overwritten components that implement access controls, thereby making your SearchBuilder less useful and less secure. When in doubt, examine the actual solr queries produced.
|
69
|
+
There is no point having the other `filter_models` methods apply `:fq`s that we then try to undo or overwrite. In general, directly overwriting the whole `default_processor_chain` or solr parameters like `:fq` is less flexible than appending constraints sufficient for your use case. In particular, you might find that you have overwritten components that implement access controls, thereby making your SearchBuilder less useful and less secure. When in doubt, examine the actual solr queries produced.
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Hyrax
|
3
3
|
class AbstractTypeRelation < ActiveFedora::Relation
|
4
|
-
def initialize(
|
4
|
+
def initialize(allowable_types: nil, **opts)
|
5
|
+
@allowable_types = allowable_types
|
5
6
|
super(DummyModel, opts)
|
6
7
|
end
|
7
8
|
|
8
9
|
def allowable_types
|
9
|
-
|
10
|
+
@allowable_types ||
|
11
|
+
raise(NotImplementedException, "Implement allowable_types in a subclass")
|
10
12
|
end
|
11
13
|
|
12
14
|
def equivalent_class?(klass)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Hyrax
|
3
3
|
# This search builder requires that a accessor named "collection" exists in the scope
|
4
|
-
class CollectionMemberSearchBuilder < ::
|
4
|
+
class CollectionMemberSearchBuilder < ::Hyrax::CollectionSearchBuilder
|
5
5
|
include Hyrax::FilterByType
|
6
6
|
attr_writer :collection, :search_includes_models
|
7
7
|
|
@@ -41,6 +41,11 @@ module Hyrax
|
|
41
41
|
solr_parameters[:fq] << "#{collection_membership_field}:#{collection.id}"
|
42
42
|
end
|
43
43
|
|
44
|
+
# This overrides the models in FilterByType
|
45
|
+
def models
|
46
|
+
work_classes + collection_classes
|
47
|
+
end
|
48
|
+
|
44
49
|
private
|
45
50
|
|
46
51
|
def only_works?
|
@@ -3,7 +3,7 @@ module Hyrax
|
|
3
3
|
# A relation that scopes to all user visible models (e.g. works + collections + file sets)
|
4
4
|
class ExposedModelsRelation < AbstractTypeRelation
|
5
5
|
def allowable_types
|
6
|
-
Hyrax.config.curation_concerns + [::Collection, ::FileSet]
|
6
|
+
(Hyrax.config.curation_concerns + [Hyrax.config.collection_class, ::Collection, ::FileSet]).uniq
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# Added to allow for the My controller to show only things I have edit access to
|
3
|
-
class Hyrax::My::CollectionsSearchBuilder < ::
|
3
|
+
class Hyrax::My::CollectionsSearchBuilder < ::Hyrax::CollectionSearchBuilder
|
4
4
|
include Hyrax::My::SearchBuilderBehavior
|
5
5
|
include Hyrax::FilterByType
|
6
6
|
|
@@ -21,6 +21,6 @@ class Hyrax::My::CollectionsSearchBuilder < ::SearchBuilder
|
|
21
21
|
# This overrides the models in FilterByType
|
22
22
|
# @return [Array<Class>] a list of classes to include
|
23
23
|
def models
|
24
|
-
[::AdminSet, ::Collection]
|
24
|
+
[::AdminSet, Hyrax::AdministrativeSet, ::Collection, Hyrax.config.collection_class].uniq.compact
|
25
25
|
end
|
26
26
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Hyrax
|
3
3
|
##
|
4
4
|
# Searches for all collections that are parents of a given collection.
|
5
|
-
class NestedCollectionsParentSearchBuilder < ::
|
5
|
+
class NestedCollectionsParentSearchBuilder < ::Hyrax::CollectionSearchBuilder
|
6
6
|
include Hyrax::FilterByType
|
7
7
|
attr_reader :child, :page, :limit
|
8
8
|
|