hyrax 3.3.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +26 -17
- data/.dassie/.env +2 -1
- data/.dassie/Gemfile +1 -1
- data/.dassie/app/forms/collection_resource_form.rb +8 -0
- data/.dassie/app/indexers/collection_resource_indexer.rb +8 -0
- data/.dassie/app/models/collection_resource.rb +35 -0
- data/.dassie/config/initializers/file_services.rb +4 -0
- data/.dassie/config/initializers/hyrax.rb +12 -1
- data/.dassie/config/metadata/collection_resource.yaml +23 -0
- data/.dassie/db/seeds.rb +74 -17
- data/.dassie/spec/forms/collection_resource_form_spec.rb +13 -0
- data/.dassie/spec/indexers/collection_resource_indexer_spec.rb +14 -0
- data/.dassie/spec/models/collection_resource_spec.rb +13 -0
- data/.github/release.yml +26 -0
- data/.gitignore +3 -0
- data/.regen +1 -1
- data/.rubocop.yml +1 -1
- data/.rubocop_fixme.yml +22 -3
- data/CONTAINERS.md +18 -13
- data/Dockerfile +4 -3
- data/app/actors/hyrax/actors/file_actor.rb +6 -4
- data/app/actors/hyrax/actors/transfer_request_actor.rb +3 -7
- data/app/assets/javascripts/hyrax/analytics_events.js +8 -2
- data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +1 -3
- data/app/assets/javascripts/hyrax/collections_v2.es6 +13 -0
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +1 -3
- data/app/controllers/concerns/hyrax/controller.rb +21 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +83 -59
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +105 -19
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +12 -19
- data/app/controllers/hyrax/batch_edits_controller.rb +12 -3
- data/app/controllers/hyrax/batch_uploads_controller.rb +4 -0
- data/app/controllers/hyrax/citations_controller.rb +1 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +176 -83
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +1 -1
- data/app/forms/hyrax/forms/administrative_set_form.rb +19 -1
- data/app/forms/hyrax/forms/batch_edit_form.rb +1 -1
- data/app/forms/hyrax/forms/collection_form.rb +1 -1
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +21 -6
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +30 -2
- data/app/forms/hyrax/forms/permission_template_form.rb +17 -9
- data/app/forms/hyrax/forms/resource_form.rb +23 -5
- data/app/forms/hyrax/forms/widgets/admin_set_visibility.rb +1 -1
- data/app/helpers/hyrax/collections_helper.rb +14 -0
- data/app/helpers/hyrax/membership_helper.rb +1 -1
- data/app/helpers/hyrax/trophy_helper.rb +1 -1
- data/app/helpers/hyrax/url_helper.rb +1 -1
- data/app/indexers/hyrax/administrative_set_indexer.rb +8 -2
- data/app/indexers/hyrax/deep_indexing_service.rb +1 -1
- data/app/indexers/hyrax/file_set_indexer.rb +1 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +3 -2
- data/app/indexers/hyrax/thumbnail_indexer.rb +31 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +6 -6
- data/app/indexers/hyrax/valkyrie_indexer.rb +4 -2
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +13 -0
- data/app/inputs/controlled_vocabulary_input.rb +2 -0
- data/app/jobs/change_depositor_event_job.rb +47 -0
- data/app/jobs/characterize_job.rb +43 -3
- data/app/jobs/concerns/hyrax/members_permission_job_behavior.rb +1 -1
- data/app/jobs/content_depositor_change_event_job.rb +2 -1
- data/app/jobs/hyrax/propagate_change_depositor_job.rb +32 -0
- data/app/jobs/import_url_job.rb +4 -6
- data/app/jobs/inherit_permissions_job.rb +1 -1
- data/app/jobs/valkyrie_create_derivatives_job.rb +25 -0
- data/app/jobs/valkyrie_ingest_job.rb +41 -35
- data/app/models/admin_set.rb +10 -2
- data/app/models/collection_branding_info.rb +8 -6
- data/app/models/concerns/hyrax/collection_behavior.rb +3 -3
- data/app/models/concerns/hyrax/file_set/characterization.rb +7 -1
- data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +9 -3
- data/app/models/concerns/hyrax/user.rb +11 -0
- data/app/models/concerns/hyrax/work_behavior.rb +1 -1
- data/app/models/featured_work_list.rb +0 -1
- data/app/models/hyrax/administrative_set.rb +36 -1
- data/app/models/hyrax/collection_type.rb +2 -2
- data/app/models/hyrax/file_metadata.rb +37 -3
- data/app/models/hyrax/file_set.rb +43 -4
- data/app/models/hyrax/group.rb +19 -0
- data/app/models/hyrax/pcdm_collection.rb +56 -1
- data/app/models/hyrax/permission_template.rb +11 -5
- data/app/models/hyrax/work.rb +91 -0
- data/app/models/job_io_wrapper.rb +1 -1
- data/app/models/proxy_deposit_request.rb +1 -1
- data/app/presenters/hyrax/admin_set_presenter.rb +2 -2
- data/app/presenters/hyrax/member_presenter_factory.rb +2 -4
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +2 -2
- data/app/presenters/hyrax/work_show_presenter.rb +10 -6
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +44 -4
- data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/my/collections_search_builder.rb +11 -4
- data/app/services/hyrax/access_control_list.rb +20 -6
- data/app/services/hyrax/adapters/nesting_index_adapter.rb +3 -3
- data/app/services/hyrax/admin_set_create_service.rb +21 -37
- data/app/services/hyrax/change_content_depositor_service.rb +2 -2
- data/app/services/hyrax/change_depositor_service.rb +70 -0
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +4 -6
- data/app/services/hyrax/collections/collection_member_service.rb +3 -5
- data/app/services/hyrax/collections/nested_collection_query_service.rb +24 -12
- data/app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb +45 -0
- data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +7 -2
- data/app/services/hyrax/custom_queries/navigators/parent_work_navigator.rb +54 -0
- data/app/services/hyrax/default_middleware_stack.rb +3 -0
- data/app/services/hyrax/file_set_derivatives_service.rb +21 -2
- data/app/services/hyrax/file_set_type_service.rb +2 -5
- data/app/services/hyrax/listeners/file_metadata_listener.rb +31 -1
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +27 -11
- data/app/services/hyrax/listeners/metadata_index_listener.rb +39 -0
- data/app/services/hyrax/listeners/proxy_deposit_listener.rb +14 -8
- data/app/services/hyrax/location_service.rb +33 -0
- data/app/services/hyrax/multiple_membership_checker.rb +46 -1
- data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
- data/app/services/hyrax/simple_schema_loader.rb +5 -1
- data/app/services/hyrax/solr_query_service.rb +12 -7
- data/app/services/hyrax/thumbnail_path_service.rb +1 -1
- data/app/services/hyrax/valkyrie_persist_derivatives.rb +50 -0
- data/app/services/hyrax/valkyrie_upload.rb +94 -0
- data/app/services/hyrax/work_uploads_handler.rb +0 -10
- data/app/services/hyrax/workflow/workflow_importer.rb +7 -9
- data/app/services/hyrax/workflow/workflow_schema.rb +3 -5
- data/app/strategies/hyrax/strategies/yaml_strategy.rb +4 -6
- data/app/uploaders/hyrax/uploaded_file_uploader.rb +4 -4
- data/app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb +29 -0
- data/app/utils/hyrax/data_destroyers/collection_types_destroyer.rb +26 -0
- data/app/utils/hyrax/data_destroyers/default_admin_set_id_cache_destroyer.rb +26 -0
- data/app/utils/hyrax/data_destroyers/featured_works_destroyer.rb +27 -0
- data/app/utils/hyrax/data_destroyers/permission_templates_destroyer.rb +30 -0
- data/app/utils/hyrax/data_destroyers/repository_metadata_destroyer.rb +42 -0
- data/app/utils/hyrax/data_destroyers/stats_destroyer.rb +33 -0
- data/app/utils/hyrax/data_maintenance.rb +51 -0
- data/app/utils/hyrax/required_data_seeder.rb +21 -0
- data/app/utils/hyrax/required_data_seeders/collection_seeder.rb +26 -0
- data/app/utils/hyrax/required_data_seeders/collection_type_seeder.rb +36 -0
- data/app/utils/hyrax/test_data_seeder.rb +24 -0
- data/app/utils/hyrax/test_data_seeders/collection_seeder.rb +91 -0
- data/app/utils/hyrax/test_data_seeders/collection_type_seeder.rb +72 -0
- data/app/utils/hyrax/test_data_seeders/user_seeder.rb +52 -0
- data/app/validators/hyrax/collection_membership_validator.rb +39 -0
- data/app/views/catalog/_index_header_list_default.html.erb +8 -1
- data/app/views/catalog/_thumbnail_list_default.html.erb +8 -3
- data/app/views/collections/edit_fields/_based_near.html.erb +7 -7
- data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_workflow.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_form.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form.html.erb +24 -17
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +1 -0
- data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +6 -3
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +3 -3
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +1 -1
- data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
- data/app/views/hyrax/file_sets/_actions.html.erb +2 -2
- data/app/views/hyrax/my/_facet_pagination.html.erb +12 -9
- data/app/views/hyrax/my/_work_action_menu.html.erb +8 -9
- data/app/views/hyrax/my/collections/_default_group.html.erb +2 -2
- data/app/views/hyrax/my/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/my/collections/index.html.erb +3 -2
- data/app/views/hyrax/my/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/my/works/_list_works.html.erb +1 -2
- data/app/views/hyrax/my/works/_tabs.html.erb +6 -1
- data/app/views/hyrax/my/works/index.html.erb +4 -2
- data/chart/hyrax/Chart.yaml +11 -7
- data/chart/hyrax/README.md +22 -1
- data/chart/hyrax/templates/_helpers.tpl +4 -0
- data/chart/hyrax/templates/cron-embargo.yaml +5 -0
- data/chart/hyrax/templates/cron-lease.yaml +5 -0
- data/chart/hyrax/templates/deployment-worker.yaml +11 -0
- data/chart/hyrax/templates/ingress.yaml +7 -6
- data/chart/hyrax/values.yaml +152 -0
- data/config/features.rb +48 -50
- data/config/initializers/listeners.rb +0 -1
- data/config/initializers/{valkryrie_storage.rb → storage_adapter_initializer.rb} +5 -0
- data/config/locales/hyrax.de.yml +18 -17
- data/config/locales/hyrax.en.yml +30 -28
- data/config/locales/hyrax.es.yml +10 -9
- data/config/locales/hyrax.fr.yml +2 -1
- data/config/locales/hyrax.it.yml +3 -2
- data/config/locales/hyrax.pt-BR.yml +2 -1
- data/config/locales/hyrax.zh.yml +2 -1
- data/config/metadata/basic_metadata.yaml +2 -0
- data/config/metadata/core_metadata.yaml +1 -1
- data/docker-compose.yml +47 -42
- data/documentation/developing-your-hyrax-based-app.md +1 -1
- data/documentation/legacyREADME.md +1 -1
- data/hyrax.gemspec +5 -3
- data/lib/generators/hyrax/collection_resource/USAGE +20 -0
- data/lib/generators/hyrax/collection_resource/collection_resource_generator.rb +133 -0
- data/lib/generators/hyrax/collection_resource/templates/collection.rb.erb +34 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_form.rb.erb +7 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_form_spec.rb.erb +13 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_indexer.rb.erb +7 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_indexer_spec.rb.erb +13 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +22 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_spec.rb.erb +12 -0
- data/lib/generators/hyrax/install_generator.rb +9 -0
- data/lib/hyrax/administrative_set_name.rb +18 -0
- data/lib/hyrax/collection_name.rb +2 -0
- data/lib/hyrax/configuration.rb +22 -0
- data/lib/hyrax/controlled_vocabularies/location.rb +9 -2
- data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +42 -0
- data/lib/hyrax/controlled_vocabularies.rb +1 -0
- data/lib/hyrax/publisher.rb +49 -0
- data/lib/hyrax/schema.rb +16 -13
- data/lib/hyrax/specs/capybara.rb +1 -1
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +11 -5
- data/lib/hyrax/specs/shared_specs/indexers.rb +117 -3
- data/lib/hyrax/transactions/admin_set_create.rb +2 -1
- data/lib/hyrax/transactions/admin_set_destroy.rb +22 -0
- data/lib/hyrax/transactions/admin_set_update.rb +21 -0
- data/lib/hyrax/transactions/collection_destroy.rb +22 -0
- data/lib/hyrax/transactions/collection_update.rb +5 -2
- data/lib/hyrax/transactions/container.rb +97 -23
- data/lib/hyrax/transactions/create_work.rb +3 -0
- data/lib/hyrax/transactions/destroy_work.rb +3 -0
- data/lib/hyrax/transactions/steps/apply_collection_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/apply_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/apply_visibility.rb +2 -0
- data/lib/hyrax/transactions/steps/change_depositor.rb +46 -0
- data/lib/hyrax/transactions/steps/check_for_empty_admin_set.rb +36 -0
- data/lib/hyrax/transactions/steps/delete_access_control.rb +32 -0
- data/lib/hyrax/transactions/steps/delete_resource.rb +19 -3
- data/lib/hyrax/transactions/steps/destroy_work.rb +3 -1
- data/lib/hyrax/transactions/steps/ensure_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/save.rb +24 -6
- data/lib/hyrax/transactions/steps/save_access_control.rb +2 -2
- data/lib/hyrax/transactions/steps/save_collection_banner.rb +59 -0
- data/lib/hyrax/transactions/steps/save_collection_logo.rb +109 -0
- data/lib/hyrax/transactions/steps/save_work.rb +3 -0
- data/lib/hyrax/transactions/steps/set_user_as_creator.rb +41 -0
- data/lib/hyrax/transactions/steps/update_work_members.rb +51 -0
- data/lib/hyrax/transactions/update_work.rb +4 -3
- data/lib/hyrax/transactions/work_create.rb +1 -1
- data/lib/hyrax/transactions/work_destroy.rb +2 -1
- data/lib/hyrax/transactions/work_update.rb +19 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings/active_fedora_converter/file_metadata_node.rb +48 -0
- data/lib/wings/active_fedora_converter/instance_builder.rb +68 -0
- data/lib/wings/active_fedora_converter.rb +3 -3
- data/lib/wings/attribute_transformer.rb +5 -1
- data/lib/wings/services/custom_queries/find_file_metadata.rb +19 -8
- data/lib/wings/setup.rb +3 -1
- data/lib/wings/valkyrie/persister.rb +2 -0
- data/lib/wings/valkyrie/query_service.rb +6 -7
- data/lib/wings/valkyrie/storage.rb +7 -1
- data/template.rb +1 -1
- metadata +99 -12
|
@@ -191,6 +191,20 @@ module Hyrax
|
|
|
191
191
|
CollectionType.find_or_create_default_collection_type.title
|
|
192
192
|
end
|
|
193
193
|
|
|
194
|
+
##
|
|
195
|
+
# @param collection [Object]
|
|
196
|
+
#
|
|
197
|
+
# @return [PermissionTemplateForm]
|
|
198
|
+
def collection_permission_template_form_for(form:)
|
|
199
|
+
case form
|
|
200
|
+
when Valkyrie::ChangeSet
|
|
201
|
+
template_model = Hyrax::PermissionTemplate.find_or_create_by(source_id: form.id.to_s)
|
|
202
|
+
Hyrax::Forms::PermissionTemplateForm.new(template_model)
|
|
203
|
+
else
|
|
204
|
+
form.permission_template
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
194
208
|
private
|
|
195
209
|
|
|
196
210
|
# add hidden fields to a form for performing an action on a single document on a collection
|
|
@@ -15,7 +15,7 @@ module Hyrax
|
|
|
15
15
|
args[:data]['remove-text'] = args[:remove_text]
|
|
16
16
|
|
|
17
17
|
args[:data][:url] = hyrax.trophy_work_path(id)
|
|
18
|
-
link_to '#', class: args[:class], data: args[:data] do
|
|
18
|
+
link_to '#', id: 'action-highlight-work', class: args[:class], data: args[:data] do
|
|
19
19
|
yield(text)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -3,7 +3,7 @@ module Hyrax
|
|
|
3
3
|
module UrlHelper
|
|
4
4
|
# generated models get registered as curation concerns and need a
|
|
5
5
|
# track_model_path to render Blacklight-related views
|
|
6
|
-
(['FileSet', 'Collection'] + Hyrax.config.registered_curation_concern_types).each do |concern|
|
|
6
|
+
(['FileSet', 'Collection', 'Hyrax::AdministrativeSet'] + Hyrax.config.registered_curation_concern_types).each do |concern|
|
|
7
7
|
model = concern.safe_constantize
|
|
8
8
|
model_name = model.respond_to?(:model_name) && model.model_name
|
|
9
9
|
next unless model_name
|
|
@@ -4,14 +4,20 @@ module Hyrax
|
|
|
4
4
|
##
|
|
5
5
|
# Indexes Hyrax::AdministrativeSet objects
|
|
6
6
|
class AdministrativeSetIndexer < Hyrax::ValkyrieIndexer
|
|
7
|
+
include Hyrax::ResourceIndexer
|
|
8
|
+
include Hyrax::PermissionIndexer
|
|
9
|
+
include Hyrax::VisibilityIndexer
|
|
7
10
|
include Hyrax::Indexer(:core_metadata)
|
|
8
11
|
|
|
9
12
|
def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
10
13
|
super.tap do |solr_doc|
|
|
11
|
-
solr_doc[
|
|
14
|
+
solr_doc[Hyrax.config.collection_type_index_field.to_sym] = Array(resource.try(:collection_type_gid)&.to_s)
|
|
12
15
|
solr_doc[:alternative_title_tesim] = resource.alternative_title
|
|
13
|
-
solr_doc[:creator_ssim] = resource.creator
|
|
16
|
+
solr_doc[:creator_ssim] = [resource.creator]
|
|
17
|
+
solr_doc[:creator_tesim] = [resource.creator]
|
|
14
18
|
solr_doc[:description_tesim] = resource.description
|
|
19
|
+
solr_doc[:generic_type_sim] = ['Admin Set']
|
|
20
|
+
solr_doc[:thumbnail_path_ss] = Hyrax::CollectionThumbnailPathService.call(resource)
|
|
15
21
|
end
|
|
16
22
|
end
|
|
17
23
|
end
|
|
@@ -41,7 +41,7 @@ module Hyrax
|
|
|
41
41
|
|
|
42
42
|
def fetch_with_persistence(resource)
|
|
43
43
|
old_label = resource.rdf_label.first
|
|
44
|
-
return unless old_label == resource.rdf_subject.to_s
|
|
44
|
+
return unless old_label == resource.rdf_subject.to_s
|
|
45
45
|
fetch_value(resource)
|
|
46
46
|
return if old_label == resource.rdf_label.first || resource.rdf_label.first == resource.rdf_subject.to_s
|
|
47
47
|
resource.persist! # Stores the fetched values into our marmotta triplestore
|
|
@@ -7,14 +7,15 @@ module Hyrax
|
|
|
7
7
|
include Hyrax::ResourceIndexer
|
|
8
8
|
include Hyrax::PermissionIndexer
|
|
9
9
|
include Hyrax::VisibilityIndexer
|
|
10
|
+
include Hyrax::ThumbnailIndexer
|
|
10
11
|
include Hyrax::Indexer(:core_metadata)
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
self.thumbnail_path_service = CollectionThumbnailPathService
|
|
12
14
|
|
|
13
15
|
def to_solr
|
|
14
16
|
super.tap do |index_document|
|
|
15
17
|
index_document[Hyrax.config.collection_type_index_field.to_sym] = Array(resource.try(:collection_type_gid)&.to_s)
|
|
16
18
|
index_document[:generic_type_sim] = ['Collection']
|
|
17
|
-
index_document[:thumbnail_path_ss] = Hyrax::CollectionThumbnailPathService.call(resource)
|
|
18
19
|
index_document[:depositor_ssim] = [resource.depositor]
|
|
19
20
|
index_document[:depositor_tesim] = [resource.depositor]
|
|
20
21
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Hyrax
|
|
3
|
+
module ThumbnailIndexer
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
class_attribute :thumbnail_path_service
|
|
8
|
+
self.thumbnail_path_service = ThumbnailPathService
|
|
9
|
+
class_attribute :thumbnail_field
|
|
10
|
+
self.thumbnail_field = :thumbnail_path_ss
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Adds thumbnail indexing to the solr document of a valkyrie resource
|
|
14
|
+
def to_solr
|
|
15
|
+
super.tap do |solr_doc|
|
|
16
|
+
index_thumbnails(solr_doc)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Write the thumbnail paths into the solr_document
|
|
21
|
+
# @param [Hash] solr_document the solr document to add the field to
|
|
22
|
+
def index_thumbnails(solr_document)
|
|
23
|
+
solr_document[thumbnail_field] = thumbnail_path.to_s
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Returns the value for the thumbnail path to put into the solr document
|
|
27
|
+
def thumbnail_path
|
|
28
|
+
self.class.thumbnail_path_service.call(resource)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -7,20 +7,20 @@ module Hyrax
|
|
|
7
7
|
include Hyrax::ResourceIndexer
|
|
8
8
|
include Hyrax::PermissionIndexer
|
|
9
9
|
include Hyrax::VisibilityIndexer
|
|
10
|
+
include Hyrax::ThumbnailIndexer
|
|
10
11
|
include Hyrax::Indexer(:core_metadata)
|
|
11
12
|
include Hyrax::Indexer(:basic_metadata)
|
|
12
13
|
|
|
13
|
-
# include Hyrax::IndexesThumbnails # TODO: Is there a Valkyrie version of a thumbnail indexer?
|
|
14
|
-
|
|
15
14
|
def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
16
15
|
super.tap do |solr_doc| # rubocop:disable Metrics/BlockLength
|
|
17
16
|
solr_doc['generic_type_si'] = 'FileSet'
|
|
18
17
|
|
|
19
18
|
# Metadata from the FileSet
|
|
20
|
-
solr_doc['file_ids_ssim']
|
|
21
|
-
solr_doc['original_file_id_ssi']
|
|
22
|
-
solr_doc['
|
|
23
|
-
solr_doc['
|
|
19
|
+
solr_doc['file_ids_ssim'] = resource.file_ids&.map(&:to_s)
|
|
20
|
+
solr_doc['original_file_id_ssi'] = resource.original_file_id.to_s
|
|
21
|
+
solr_doc['extracted_text_id_ssi'] = resource.extracted_text_id.to_s
|
|
22
|
+
solr_doc['hasRelatedMediaFragment_ssim'] = resource.representative_id.to_s
|
|
23
|
+
solr_doc['hasRelatedImage_ssim'] = resource.thumbnail_id.to_s
|
|
24
24
|
|
|
25
25
|
# Add in metadata from the original file.
|
|
26
26
|
file_metadata = original_file
|
|
@@ -64,14 +64,16 @@ module Hyrax
|
|
|
64
64
|
|
|
65
65
|
##
|
|
66
66
|
# @api public
|
|
67
|
-
# @return [
|
|
67
|
+
# @return [HashWithIndifferentAccess<Symbol, Object>]
|
|
68
68
|
def to_solr
|
|
69
69
|
{
|
|
70
70
|
"id": resource.id.to_s,
|
|
71
71
|
"date_uploaded_dtsi": resource.created_at,
|
|
72
72
|
"date_modified_dtsi": resource.updated_at,
|
|
73
|
+
"system_create_dtsi": resource.created_at,
|
|
74
|
+
"system_modified_dtsi": resource.updated_at,
|
|
73
75
|
"has_model_ssim": resource.internal_resource
|
|
74
|
-
}
|
|
76
|
+
}.with_indifferent_access
|
|
75
77
|
end
|
|
76
78
|
|
|
77
79
|
##
|
|
@@ -7,6 +7,7 @@ module Hyrax
|
|
|
7
7
|
include Hyrax::ResourceIndexer
|
|
8
8
|
include Hyrax::PermissionIndexer
|
|
9
9
|
include Hyrax::VisibilityIndexer
|
|
10
|
+
include Hyrax::ThumbnailIndexer
|
|
10
11
|
include Hyrax::Indexer(:core_metadata)
|
|
11
12
|
|
|
12
13
|
def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
@@ -14,10 +15,16 @@ module Hyrax
|
|
|
14
15
|
solr_doc['generic_type_si'] = 'Work'
|
|
15
16
|
solr_doc['suppressed_bsi'] = suppressed?(resource)
|
|
16
17
|
solr_doc['admin_set_id_ssim'] = [resource.admin_set_id.to_s]
|
|
18
|
+
admin_set_label = admin_set_label(resource)
|
|
19
|
+
solr_doc['admin_set_sim'] = admin_set_label
|
|
20
|
+
solr_doc['admin_set_tesim'] = admin_set_label
|
|
21
|
+
solr_doc["#{Hyrax.config.admin_set_predicate.qname.last}_ssim"] = [resource.admin_set_id.to_s]
|
|
17
22
|
solr_doc['member_of_collection_ids_ssim'] = resource.member_of_collection_ids.map(&:to_s)
|
|
18
23
|
solr_doc['member_ids_ssim'] = resource.member_ids.map(&:to_s)
|
|
19
24
|
solr_doc['depositor_ssim'] = [resource.depositor]
|
|
20
25
|
solr_doc['depositor_tesim'] = [resource.depositor]
|
|
26
|
+
solr_doc['hasRelatedMediaFragment_ssim'] = [resource.representative_id.to_s]
|
|
27
|
+
solr_doc['hasRelatedImage_ssim'] = [resource.thumbnail_id.to_s]
|
|
21
28
|
end
|
|
22
29
|
end
|
|
23
30
|
|
|
@@ -26,5 +33,11 @@ module Hyrax
|
|
|
26
33
|
def suppressed?(resource)
|
|
27
34
|
Hyrax::ResourceStatus.new(resource: resource).inactive?
|
|
28
35
|
end
|
|
36
|
+
|
|
37
|
+
def admin_set_label(resource)
|
|
38
|
+
return if resource.admin_set_id.blank?
|
|
39
|
+
admin_set = Hyrax.query_service.find_by(id: resource.admin_set_id)
|
|
40
|
+
admin_set.title
|
|
41
|
+
end
|
|
29
42
|
end
|
|
30
43
|
end
|
|
@@ -62,10 +62,12 @@ class ControlledVocabularyInput < MultiValueInput
|
|
|
62
62
|
|
|
63
63
|
def build_options_for_new_row(_attribute_name, _index, options)
|
|
64
64
|
options[:value] = ''
|
|
65
|
+
options[:data][:label] = ''
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
def build_options_for_existing_row(_attribute_name, _index, value, options)
|
|
68
69
|
options[:value] = value.rdf_label.first || "Unable to fetch label for #{value.rdf_subject}"
|
|
70
|
+
options[:data][:label] = value.full_label || value.rdf_label
|
|
69
71
|
options[:readonly] = true
|
|
70
72
|
end
|
|
71
73
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Log work depositor change to activity streams
|
|
3
|
+
#
|
|
4
|
+
# This class simply logs the transfer, pulling data from the object that was
|
|
5
|
+
# just transferred. It does not perform the transfer.
|
|
6
|
+
class ChangeDepositorEventJob < ContentEventJob
|
|
7
|
+
include Rails.application.routes.url_helpers
|
|
8
|
+
include ActionDispatch::Routing::PolymorphicRoutes
|
|
9
|
+
|
|
10
|
+
# @param [ActiveFedora::Base, Hyrax::Work] work the work that's been transfered
|
|
11
|
+
def perform(work)
|
|
12
|
+
# these get set to repo_object and depositor
|
|
13
|
+
super(work, new_owner(work))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def action
|
|
17
|
+
"User #{link_to_profile repo_object.proxy_depositor} has transferred #{link_to_work repo_object.title.first} to user #{link_to_profile depositor}"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def link_to_work(text)
|
|
21
|
+
link_to text, polymorphic_path(repo_object)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Log the event to the work's stream
|
|
25
|
+
def log_work_event(work)
|
|
26
|
+
work.log_event(event)
|
|
27
|
+
end
|
|
28
|
+
alias log_file_set_event log_work_event
|
|
29
|
+
|
|
30
|
+
# overriding default to log the event to the depositor instead of their profile
|
|
31
|
+
# and to log the event for both users
|
|
32
|
+
def log_user_event(depositor)
|
|
33
|
+
previous_owner.log_profile_event(event)
|
|
34
|
+
depositor.log_event(event)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def previous_owner
|
|
40
|
+
::User.find_by_user_key(repo_object.proxy_depositor)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# used for @depositor
|
|
44
|
+
def new_owner(work)
|
|
45
|
+
::User.find_by_user_key(work.depositor)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -31,17 +31,57 @@ class CharacterizeJob < Hyrax::ApplicationJob
|
|
|
31
31
|
raise "#{file_set.class.characterization_proxy} was not found for FileSet #{file_set.id}" unless file_set.characterization_proxy?
|
|
32
32
|
filepath = Hyrax::WorkingDirectory.find_or_retrieve(file_id, file_set.id) unless filepath && File.exist?(filepath)
|
|
33
33
|
characterize(file_set, file_id, filepath)
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
Hyrax.publisher.publish('file.characterized',
|
|
36
|
+
file_set: file_set,
|
|
37
|
+
file_id: file_id,
|
|
38
|
+
path_hint: filepath)
|
|
35
39
|
end
|
|
36
40
|
|
|
37
41
|
private
|
|
38
42
|
|
|
39
|
-
def characterize(file_set, _file_id, filepath)
|
|
43
|
+
def characterize(file_set, _file_id, filepath) # rubocop:disable Metrics/AbcSize
|
|
44
|
+
# store this so we can tell if the original_file is actually changing
|
|
45
|
+
previous_checksum = file_set.characterization_proxy.original_checksum.first
|
|
46
|
+
|
|
47
|
+
clear_metadata(file_set)
|
|
48
|
+
|
|
49
|
+
# If the current FileSet title is the same as the label, it must be a filename as opposed to a user-entered...
|
|
50
|
+
# value. So later we'll ensure it's set to the new file's filename.
|
|
51
|
+
reset_title = file_set.title.first == file_set.label
|
|
52
|
+
|
|
40
53
|
characterization_service.run(file_set.characterization_proxy, filepath)
|
|
41
54
|
Rails.logger.debug "Ran characterization on #{file_set.characterization_proxy.id} (#{file_set.characterization_proxy.mime_type})"
|
|
42
55
|
file_set.characterization_proxy.alpha_channels = channels(filepath) if file_set.image? && Hyrax.config.iiif_image_server?
|
|
43
56
|
file_set.characterization_proxy.save!
|
|
44
|
-
|
|
57
|
+
|
|
58
|
+
# Ensure that if the actual file content has changed, the mod timestamp on the FileSet object changes.
|
|
59
|
+
# Otherwise this does not happen when rolling back to a previous version. Perhaps this should be set as part of...
|
|
60
|
+
# `FileActor.revert_to` (or its replacement Transaction?!), where the FileSet is saved. Not sure if the...
|
|
61
|
+
# before/after checksum is readily available there though. I like this checksum verification because it allows...
|
|
62
|
+
# all changes to the current FileSet version to be detected, which in our case triggers re-creation of a...
|
|
63
|
+
# "cold storage" archive of the parent Work. It's worth noting that adding a *new* version always touches this...
|
|
64
|
+
# mod time. This is done in the versioning code.
|
|
65
|
+
file_set.date_modified = Hyrax::TimeService.time_in_utc if file_set.characterization_proxy.original_checksum.first != previous_checksum
|
|
66
|
+
|
|
67
|
+
# set title to label if that's how it was before this characterization
|
|
68
|
+
file_set.title = [file_set.characterization_proxy.original_name] if reset_title
|
|
69
|
+
# always set the label to the original_name
|
|
70
|
+
file_set.label = file_set.characterization_proxy.original_name
|
|
71
|
+
|
|
72
|
+
file_set.save!
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def clear_metadata(file_set)
|
|
76
|
+
# The characterization of additional file versions adds new height/width/size/checksum values to un-orderable...
|
|
77
|
+
# `ActiveTriples::Relation` fields on `original_file`. Values from those are then randomly pulled into Solr...
|
|
78
|
+
# fields which may have scalar or vector cardinality. So for height/width you get two scalar values pulled from...
|
|
79
|
+
# "randomized parallel arrays". Upshot is to reset all of these before (re)characterization to stop the mayhem.
|
|
80
|
+
file_set.characterization_proxy.height = []
|
|
81
|
+
file_set.characterization_proxy.width = []
|
|
82
|
+
file_set.characterization_proxy.original_checksum = []
|
|
83
|
+
file_set.characterization_proxy.file_size = []
|
|
84
|
+
file_set.characterization_proxy.format_label = []
|
|
45
85
|
end
|
|
46
86
|
|
|
47
87
|
def channels(filepath)
|
|
@@ -17,7 +17,7 @@ module Hyrax
|
|
|
17
17
|
when ActiveFedora::Base
|
|
18
18
|
::FileSet.search_with_conditions(id: work.member_ids).map(&:id)
|
|
19
19
|
when Valkyrie::Resource
|
|
20
|
-
Hyrax.custom_queries.
|
|
20
|
+
Hyrax.custom_queries.find_child_file_set_ids(resource: work)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -8,10 +8,11 @@ class ContentDepositorChangeEventJob < ContentEventJob
|
|
|
8
8
|
|
|
9
9
|
attr_accessor :reset
|
|
10
10
|
|
|
11
|
-
# @param [ActiveFedora::Base] work the work to be
|
|
11
|
+
# @param [ActiveFedora::Base, Hyrax::Work] work the work to be transferred
|
|
12
12
|
# @param [User] user the user the work is being transfered to.
|
|
13
13
|
# @param [TrueClass,FalseClass] reset (false) if true, reset the access controls. This revokes edit access from the depositor
|
|
14
14
|
def perform(work, user, reset = false)
|
|
15
|
+
Deprecation.warn("This class will be removed in the next major release. Use Hyrax::ChangeDepositorService.call instead.")
|
|
15
16
|
@reset = reset
|
|
16
17
|
super(work, user)
|
|
17
18
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Hyrax
|
|
3
|
+
# updates depositor on file sets and resets permissions if flagged. Used by
|
|
4
|
+
# ChangeDepositorService to background changes to lots of file sets
|
|
5
|
+
class PropagateChangeDepositorJob < ApplicationJob
|
|
6
|
+
# @param work_id [Valkyrie::Id, String] the id of the work
|
|
7
|
+
# that is receiving a change of depositor
|
|
8
|
+
# @param user [User] the user that will "become" the depositor of
|
|
9
|
+
# the given work
|
|
10
|
+
# @param reset [TrueClass, FalseClass] when true, first clear
|
|
11
|
+
# permissions for the given work and contained file
|
|
12
|
+
# sets; regardless of true/false make the given user
|
|
13
|
+
# the depositor of the given work
|
|
14
|
+
def perform(work_id, user, reset)
|
|
15
|
+
work = Hyrax.query_service.find_by(id: work_id)
|
|
16
|
+
Hyrax.custom_queries.find_child_file_sets(resource: work).each do |f|
|
|
17
|
+
if reset
|
|
18
|
+
f.permission_manager.acl.permissions = []
|
|
19
|
+
f.permission_manager.acl.save
|
|
20
|
+
end
|
|
21
|
+
apply_depositor_metadata(f, user)
|
|
22
|
+
Hyrax.persister.save(resource: f)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def apply_depositor_metadata(resource, depositor)
|
|
27
|
+
depositor_id = depositor.respond_to?(:user_key) ? depositor.user_key : depositor
|
|
28
|
+
resource.depositor = depositor_id if resource.respond_to? :depositor=
|
|
29
|
+
Hyrax::AccessControlList.new(resource: resource).grant(:edit).to(::User.find_by_user_key(depositor_id)).save
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
data/app/jobs/import_url_job.rb
CHANGED
|
@@ -80,12 +80,10 @@ class ImportUrlJob < Hyrax::ApplicationJob
|
|
|
80
80
|
Rails.logger.debug("ImportUrlJob: Copying <#{uri}> to #{dir}")
|
|
81
81
|
|
|
82
82
|
File.open(File.join(dir, filename), 'wb') do |f|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
send_error(e.message)
|
|
88
|
-
end
|
|
83
|
+
write_file(f)
|
|
84
|
+
yield f
|
|
85
|
+
rescue StandardError => e
|
|
86
|
+
send_error(e.message)
|
|
89
87
|
end
|
|
90
88
|
Rails.logger.debug("ImportUrlJob: Closing #{File.join(dir, filename)}")
|
|
91
89
|
end
|
|
@@ -24,7 +24,7 @@ class InheritPermissionsJob < Hyrax::ApplicationJob
|
|
|
24
24
|
# @param work [Resource]
|
|
25
25
|
# @return [Array<Hyrax::File_Set>]
|
|
26
26
|
def file_sets_for(work)
|
|
27
|
-
Hyrax.custom_queries.
|
|
27
|
+
Hyrax.custom_queries.find_child_file_sets(resource: work)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Perform the copy from the work to the contained filesets
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
class ValkyrieCreateDerivativesJob < Hyrax::ApplicationJob
|
|
3
|
+
queue_as Hyrax.config.ingest_queue_name
|
|
4
|
+
def perform(_file_set_id, file_id, _filepath = nil)
|
|
5
|
+
file_metadata = Hyrax.custom_queries.find_file_metadata_by(id: file_id)
|
|
6
|
+
return if file_metadata.video? && !Hyrax.config.enable_ffmpeg
|
|
7
|
+
# Get file into a local path.
|
|
8
|
+
file = Hyrax.storage_adapter.find_by(id: file_metadata.file_identifier)
|
|
9
|
+
# Call derivatives with the file_set.
|
|
10
|
+
derivative_service = Hyrax::DerivativeService.for(file_metadata)
|
|
11
|
+
derivative_service.create_derivatives(file.disk_path)
|
|
12
|
+
# Trigger a reindex to get the thumbnail path.
|
|
13
|
+
Hyrax.publisher.publish('file.metadata.updated', metadata: file_metadata, user: nil)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def query_service
|
|
19
|
+
Hyrax.query_service
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def storage_adapter
|
|
23
|
+
Hyrax.storage_adapter
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -1,56 +1,62 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# Ingests a {Hyrax::UploadedFile} as file member of a {Hyrax::FileSet}.
|
|
5
|
+
#
|
|
6
|
+
# The {Hyrax::UploadedFile} is passed into {#perform}, and should have a
|
|
7
|
+
# {Hyrax::UploadedFile#file_set_uri} identifying an existing {Hyrax::FileSet}.
|
|
2
8
|
class ValkyrieIngestJob < Hyrax::ApplicationJob
|
|
3
9
|
queue_as Hyrax.config.ingest_queue_name
|
|
4
10
|
|
|
5
11
|
##
|
|
6
|
-
# @param [
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
# @param [Hyrax::UploadedFile] file
|
|
13
|
+
# @param [RDF::URI] pcdm_use is the use/type to apply to the created FileMetadata
|
|
14
|
+
# @see Hyrax::FileMetadata::Use
|
|
15
|
+
def perform(file, pcdm_use: Hyrax::FileMetadata::Use::ORIGINAL_FILE)
|
|
16
|
+
ingest(file: file, pcdm_use: pcdm_use)
|
|
9
17
|
end
|
|
10
18
|
|
|
11
19
|
##
|
|
12
|
-
# @
|
|
20
|
+
# @api private
|
|
13
21
|
#
|
|
22
|
+
# @param [Hyrax::UploadedFile] file
|
|
23
|
+
# @param [RDF::URI] pcdm_use
|
|
14
24
|
# @return [void]
|
|
15
|
-
def ingest(file:)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
def ingest(file:, pcdm_use:)
|
|
26
|
+
file_set_uri = Valkyrie::ID.new(file.file_set_uri)
|
|
27
|
+
file_set = Hyrax.query_service.find_by(id: file_set_uri)
|
|
28
|
+
|
|
29
|
+
updated_metadata = upload_file(
|
|
30
|
+
file: file,
|
|
31
|
+
file_set: file_set,
|
|
32
|
+
pcdm_use: pcdm_use,
|
|
33
|
+
user: file.user
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
ValkyrieCreateDerivativesJob.perform_later(file_set.id.to_s, updated_metadata.id.to_s)
|
|
20
37
|
end
|
|
21
38
|
|
|
22
39
|
##
|
|
23
|
-
# @
|
|
24
|
-
# to reindex its membership
|
|
25
|
-
# @param [Hyrax::FileSet] file_set the file set to add to
|
|
26
|
-
# @param [Hyrax::FileMetadata] file_metadata the metadata object representing
|
|
27
|
-
# the file to add
|
|
40
|
+
# @api private
|
|
28
41
|
#
|
|
29
|
-
# @return [Hyrax::FileSet] updated file set
|
|
30
|
-
def add_file_to_file_set(file_set:, file_metadata:)
|
|
31
|
-
file_set.file_ids << file_metadata.id
|
|
32
|
-
Hyrax.persister.save(resource: file_set)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
##
|
|
36
42
|
# @param [Hyrax::UploadedFile] file
|
|
37
43
|
# @param [Hyrax::FileSet] file_set
|
|
44
|
+
# @param [RDF::URI] pcdm_use the use/type to apply to the created FileMetadata
|
|
45
|
+
# @param [User] user
|
|
38
46
|
#
|
|
39
47
|
# @return [Hyrax::FileMetadata] the metadata representing the uploaded file
|
|
40
|
-
def upload_file(file:, file_set:)
|
|
48
|
+
def upload_file(file:, file_set:, pcdm_use:, user: nil)
|
|
41
49
|
carrier_wave_sanitized_file = file.uploader.file
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
file_metadata
|
|
50
|
+
# Pull file, since carrierwave files don't respond to a proper IO #read. See
|
|
51
|
+
# https://github.com/carrierwaveuploader/carrierwave/issues/1959
|
|
52
|
+
file_io = carrier_wave_sanitized_file.to_file
|
|
53
|
+
|
|
54
|
+
::Hyrax::ValkyrieUpload.file(
|
|
55
|
+
io: file_io,
|
|
56
|
+
filename: carrier_wave_sanitized_file.original_filename,
|
|
57
|
+
file_set: file_set,
|
|
58
|
+
use: pcdm_use,
|
|
59
|
+
user: user
|
|
60
|
+
)
|
|
55
61
|
end
|
|
56
62
|
end
|
data/app/models/admin_set.rb
CHANGED
|
@@ -87,16 +87,24 @@ class AdminSet < ActiveFedora::Base
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
##
|
|
90
|
-
# @deprecated use PermissionTemplate#
|
|
90
|
+
# @deprecated use PermissionTemplate#reset_access_controls_for instead
|
|
91
91
|
#
|
|
92
92
|
# Calculate and update who should have edit access based on who
|
|
93
93
|
# has "manage" access in the PermissionTemplateAccess
|
|
94
94
|
def reset_access_controls!
|
|
95
|
-
Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#
|
|
95
|
+
Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls_for instead.")
|
|
96
96
|
|
|
97
97
|
permission_template.reset_access_controls_for(collection: self)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
+
# @api public
|
|
101
|
+
#
|
|
102
|
+
# return an id for the AdminSet.
|
|
103
|
+
# defaults to calling Hyrax::Noid, but needs a fall back if noid is off
|
|
104
|
+
def assign_id
|
|
105
|
+
super || SecureRandom.uuid
|
|
106
|
+
end
|
|
107
|
+
|
|
100
108
|
private
|
|
101
109
|
|
|
102
110
|
def destroy_permission_template
|
|
@@ -14,16 +14,19 @@ class CollectionBrandingInfo < ApplicationRecord
|
|
|
14
14
|
self.local_path = File.join(role, filename)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def save(file_location,
|
|
17
|
+
def save(file_location, upload_file = true)
|
|
18
18
|
filename = File.split(local_path).last
|
|
19
19
|
role_and_filename = File.join(role, filename)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if upload_file
|
|
22
|
+
storage.upload(resource: Hyrax::PcdmCollection.new(id: collection_id),
|
|
23
|
+
file: File.open(file_location),
|
|
24
|
+
original_filename: role_and_filename)
|
|
25
|
+
end
|
|
26
|
+
|
|
24
27
|
self.local_path = find_local_filename(collection_id, role, filename)
|
|
25
28
|
|
|
26
|
-
FileUtils.remove_file(file_location) if File.exist?(file_location) &&
|
|
29
|
+
FileUtils.remove_file(file_location) if File.exist?(file_location) && upload_file
|
|
27
30
|
super()
|
|
28
31
|
end
|
|
29
32
|
|
|
@@ -35,7 +38,6 @@ class CollectionBrandingInfo < ApplicationRecord
|
|
|
35
38
|
else
|
|
36
39
|
local_path
|
|
37
40
|
end
|
|
38
|
-
|
|
39
41
|
storage.delete(id: id)
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -87,7 +87,7 @@ module Hyrax
|
|
|
87
87
|
|
|
88
88
|
module ClassMethods
|
|
89
89
|
# This governs which partial to draw when you render this type of object
|
|
90
|
-
def _to_partial_path
|
|
90
|
+
def _to_partial_path # :nodoc:
|
|
91
91
|
@_to_partial_path ||= begin
|
|
92
92
|
element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(name))
|
|
93
93
|
collection = ActiveSupport::Inflector.tableize(name)
|
|
@@ -121,12 +121,12 @@ module Hyrax
|
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
##
|
|
124
|
-
# @deprecated use PermissionTemplate#
|
|
124
|
+
# @deprecated use PermissionTemplate#reset_access_controls_for instead
|
|
125
125
|
#
|
|
126
126
|
# Calculate and update who should have read/edit access to the collections based on who
|
|
127
127
|
# has access in PermissionTemplateAccess
|
|
128
128
|
def reset_access_controls!
|
|
129
|
-
Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#
|
|
129
|
+
Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls_for instead.")
|
|
130
130
|
|
|
131
131
|
permission_template
|
|
132
132
|
.reset_access_controls_for(collection: self, interpret_visibility: true)
|