hyrax 5.0.0.rc1 → 5.0.0.rc2
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 +11 -4
- data/.dassie/.env +5 -1
- data/.dassie/Gemfile +27 -42
- data/.dassie/Gemfile.dassie +2 -0
- data/.dassie/app/assets/config/manifest.js +2 -0
- data/.dassie/app/assets/stylesheets/hyrax.scss +1 -0
- data/.dassie/config/initializers/riiif.rb +5 -11
- data/.dassie/config/metadata/collection_resource.yaml +3 -0
- data/.dassie/config/metadata/monograph.yaml +8 -0
- data/.dassie/config/metadata/sample_metadata.yaml +1 -0
- data/.dassie/config/redis.yml +2 -0
- data/.dassie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
- data/.dassie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
- data/.dassie/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.hyrax.rb +8 -0
- data/.dassie/db/migrate/20230821153635_add_fields_to_counter_metric.rb +8 -0
- data/.dassie/db/schema.rb +20 -1
- data/.dockerignore +2 -1
- data/.gitignore +1 -1
- data/.koppie/.env +10 -4
- data/.koppie/Gemfile +10 -12
- data/.koppie/Gemfile.koppie +2 -0
- data/.koppie/Rakefile +0 -2
- data/.koppie/app/forms/collection_resource_form.rb +0 -1
- data/.koppie/app/indexers/collection_resource_indexer.rb +0 -1
- data/.koppie/app/models/ability.rb +1 -5
- data/.koppie/app/models/collection_resource.rb +0 -1
- data/.koppie/app/models/user.rb +0 -2
- data/.koppie/config/application.rb +2 -1
- data/.koppie/config/arkivo.yml +6 -0
- data/.koppie/config/blacklight.yml +2 -2
- data/.koppie/config/features.yml +2 -0
- data/.koppie/config/initializers/1_valkyrie.rb +29 -6
- data/.koppie/config/initializers/arkivo_constraint.rb +12 -0
- data/.koppie/config/initializers/hyrax.rb +2 -2
- data/.koppie/config/initializers/riiif.rb +6 -11
- data/.koppie/config/metadata/collection_resource.yaml +177 -1
- data/.koppie/config/metadata/generic_work.yaml +2 -0
- data/.koppie/config/metadata/monograph.yaml +10 -0
- data/.koppie/config/role_map.yml +3 -25
- data/.koppie/config/routes.rb +1 -2
- data/.koppie/config/solr.yml +1 -1
- data/.koppie/config/valkyrie_index.yml +4 -10
- data/.koppie/config/zotero.yml +6 -0
- data/.koppie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
- data/.koppie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
- data/.koppie/db/schema.rb +12 -1
- data/CONTAINERS.md +1 -3
- data/Dockerfile +11 -2
- data/Gemfile +4 -21
- data/Gemfile.dassie +2 -0
- data/Gemfile.koppie +2 -0
- data/README.md +0 -1
- data/Rakefile +0 -11
- data/app/actors/hyrax/actors/embargo_actor.rb +3 -6
- data/app/assets/javascripts/hyrax/batch_select_all.js +1 -1
- data/app/assets/javascripts/hyrax/file_manager/member.es6 +1 -1
- data/app/assets/stylesheets/hyrax/_file-listing.scss +0 -2
- data/app/assets/stylesheets/hyrax/_work-show.scss +19 -3
- data/app/assets/stylesheets/hyrax/sidebar.scss +23 -0
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +7 -1
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +7 -1
- data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +14 -9
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +50 -9
- data/app/controllers/hyrax/api/items_controller.rb +2 -3
- data/app/controllers/hyrax/batch_edits_controller.rb +6 -6
- data/app/controllers/hyrax/batch_uploads_controller.rb +5 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
- data/app/controllers/hyrax/file_sets_controller.rb +49 -6
- data/app/controllers/hyrax/my/collections_controller.rb +2 -0
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +16 -2
- data/app/forms/concerns/hyrax/basic_metadata_form_fields_behavior.rb +38 -0
- data/app/forms/hyrax/forms/collection_form.rb +0 -15
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +0 -34
- data/app/forms/hyrax/forms/file_set_form.rb +2 -2
- data/app/forms/hyrax/forms/pcdm_object_form.rb +21 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +0 -7
- data/app/forms/hyrax/forms/resource_batch_edit_form.rb +49 -21
- data/app/forms/hyrax/forms/resource_form.rb +21 -34
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +13 -0
- data/app/indexers/hyrax/location_indexer.rb +29 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +0 -8
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +1 -6
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +1 -0
- data/app/inputs/controlled_vocabulary_input.rb +1 -1
- data/app/jobs/characterize_job.rb +1 -1
- data/app/jobs/create_work_job.rb +36 -4
- data/app/jobs/valkyrie_characterization_job.rb +9 -0
- data/app/jobs/valkyrie_ingest_job.rb +1 -3
- data/app/models/collection_branding_info.rb +2 -9
- data/app/models/concerns/hyrax/ability.rb +2 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +4 -12
- data/app/models/concerns/hyrax/riiif_file.rb +30 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +19 -2
- data/app/models/hyrax/counter_metric.rb +7 -0
- data/app/models/hyrax/file_metadata.rb +3 -2
- data/app/models/hyrax/file_set.rb +75 -22
- data/app/models/hyrax/orcid_validator.rb +0 -6
- data/app/models/hyrax/work.rb +2 -5
- data/app/presenters/hyrax/collection_presenter.rb +0 -17
- data/app/presenters/hyrax/embargo_presenter.rb +4 -0
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +6 -4
- data/app/presenters/hyrax/version_list_presenter.rb +19 -10
- data/app/presenters/hyrax/version_presenter.rb +19 -4
- data/app/services/hyrax/admin_set_create_service.rb +0 -17
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +5 -0
- data/app/services/hyrax/collections/collection_member_service.rb +1 -1
- data/app/services/hyrax/embargo_manager.rb +45 -18
- data/app/services/hyrax/embargo_service.rb +12 -10
- data/app/services/hyrax/file_set_derivatives_service.rb +11 -11
- data/app/services/hyrax/fixity_check_failure_service.rb +1 -1
- data/app/services/hyrax/identifier/dispatcher.rb +9 -2
- data/app/services/hyrax/listeners/file_metadata_listener.rb +14 -6
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +2 -28
- data/app/services/hyrax/listeners/metadata_index_listener.rb +11 -0
- data/app/services/hyrax/lock_manager.rb +1 -2
- data/app/services/hyrax/riiif_file_resolver.rb +50 -0
- data/app/services/hyrax/simple_schema_loader.rb +31 -0
- data/app/services/hyrax/valkyrie_persist_derivatives.rb +1 -1
- data/app/services/hyrax/valkyrie_upload.rb +12 -26
- data/app/services/hyrax/versioning_service.rb +29 -15
- data/app/services/hyrax/work_uploads_handler.rb +1 -1
- data/app/validators/hyrax/collection_membership_validator.rb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_file_manager_resource_form.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_component.html.erb +4 -4
- data/app/views/hyrax/base/_show_actions.html.erb +1 -1
- data/app/views/hyrax/base/_workflow_actions.html.erb +25 -23
- data/app/views/hyrax/base/show.json.jbuilder +2 -1
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +3 -3
- data/app/views/hyrax/file_sets/_versioning.html.erb +5 -5
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +4 -4
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +2 -2
- data/app/views/hyrax/my/_search_form.html.erb +1 -1
- data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
- data/app/views/hyrax/users/_vitals.html.erb +1 -1
- data/bin/dev-entrypoint.sh +13 -0
- data/chart/hyrax/Chart.yaml +3 -3
- data/chart/hyrax/templates/_helpers.tpl +8 -0
- data/chart/hyrax/templates/configmap-env.yaml +1 -1
- data/chart/hyrax/values.yaml +3 -0
- data/config/initializers/file_length_patch.rb +10 -0
- data/config/metadata/basic_metadata.yaml +52 -0
- data/config/metadata/core_metadata.yaml +4 -0
- data/config/metadata/file_set_metadata.yaml +19 -0
- data/config/metadata/hyrax_internal_metadata.yaml +57 -0
- data/docker-compose-koppie.yml +23 -22
- data/docker-compose-sirenia.yml +202 -0
- data/docker-compose.yml +27 -24
- data/documentation/developing-your-hyrax-based-app.md +2 -2
- data/hyrax.gemspec +10 -11
- data/karma.conf.js +1 -1
- data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +2 -0
- data/lib/generators/hyrax/templates/config/initializers/riiif.rb +13 -19
- data/lib/generators/hyrax/templates/db/migrate/20230725222727_create_hyrax_counter_metrics.rb.erb +14 -0
- data/lib/generators/hyrax/templates/db/migrate/20230803165135_change_work_id_to_string.rb.erb +5 -0
- data/lib/generators/hyrax/templates/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.rb.erb +8 -0
- data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +8 -0
- data/lib/generators/hyrax/templates/db/seeds.rb +1 -1
- data/lib/generators/hyrax/work_resource/templates/form.rb.erb +1 -1
- data/lib/generators/hyrax/work_resource/templates/metadata.yaml +2 -0
- data/lib/hyrax/configuration.rb +147 -49
- data/lib/hyrax/controlled_vocabularies/location.rb +7 -1
- data/lib/hyrax/engine.rb +0 -1
- data/lib/hyrax/form_fields.rb +6 -0
- data/lib/hyrax/publisher.rb +4 -0
- data/lib/hyrax/redis_event_store.rb +7 -8
- data/lib/hyrax/resource_name.rb +4 -0
- data/lib/hyrax/specs/capybara.rb +25 -42
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +34 -7
- data/lib/hyrax/specs/shared_specs/indexers.rb +24 -6
- data/lib/hyrax/transactions/collection_destroy.rb +3 -2
- data/lib/hyrax/transactions/container.rb +42 -0
- data/lib/hyrax/transactions/file_metadata_destroy.rb +20 -0
- data/lib/hyrax/transactions/file_set_destroy.rb +3 -1
- data/lib/hyrax/transactions/file_set_update.rb +21 -0
- data/lib/hyrax/transactions/steps/add_to_parent.rb +1 -1
- data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +46 -0
- data/lib/hyrax/transactions/steps/delete_all_file_sets.rb +46 -0
- data/lib/hyrax/transactions/steps/file_metadata_delete.rb +40 -0
- data/lib/hyrax/transactions/steps/remove_from_membership.rb +45 -0
- data/lib/hyrax/transactions/work_destroy.rb +3 -2
- data/lib/hyrax/version.rb +1 -1
- data/lib/tasks/collection_type_global_id.rake +9 -4
- data/lib/tasks/embargo_lease.rake +1 -0
- data/lib/valkyrie/indexing/solr/indexing_adapter.rb +2 -0
- data/lib/wings/active_fedora_converter.rb +6 -0
- data/lib/wings/attribute_transformer.rb +24 -17
- data/lib/wings/model_transformer.rb +0 -8
- data/lib/wings/orm_converter.rb +23 -18
- data/lib/wings/setup.rb +2 -2
- data/lib/wings/valkyrie/storage.rb +8 -90
- data/lib/wings.rb +5 -0
- data/tasks/hyrax_dev.rake +2 -33
- data/template.rb +1 -1
- metadata +90 -72
- data/.engine_cart.yml +0 -3
- data/app/views/hyrax/users/_user_util_links_extra.html.erb +0 -0
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +0 -9
data/lib/hyrax/configuration.rb
CHANGED
@@ -9,6 +9,8 @@ module Hyrax
|
|
9
9
|
# engine options. For convenient reference, options are grouped into the
|
10
10
|
# following functional areas:
|
11
11
|
#
|
12
|
+
# - Analytics
|
13
|
+
# - Files
|
12
14
|
# - Groups
|
13
15
|
# - Identifiers
|
14
16
|
# - IIIF
|
@@ -148,6 +150,132 @@ module Hyrax
|
|
148
150
|
attr_writer :analytic_start_date
|
149
151
|
attr_reader :analytic_start_date
|
150
152
|
|
153
|
+
# @!endgroup
|
154
|
+
# @!group Files
|
155
|
+
|
156
|
+
##
|
157
|
+
# @!attribute [rw] characterization_service
|
158
|
+
# @return [#run] the service to use for charactaerization for Valkyrie
|
159
|
+
# objects
|
160
|
+
# @ see Hyrax::Characterization::ValkyrieCharacterizationService
|
161
|
+
attr_writer :characterization_service
|
162
|
+
def characterization_service
|
163
|
+
@characterization_service ||=
|
164
|
+
Hyrax::Characterization::ValkyrieCharacterizationService
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# Options to pass to the characterization service
|
169
|
+
# @!attribute [rw] characterization_options
|
170
|
+
# @return [Hash] of options like {ch12n_tool: :fits_servlet}
|
171
|
+
attr_writer :characterization_options
|
172
|
+
def characterization_options
|
173
|
+
@characterization_options ||= {}
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# @!attribute [w] characterization_proxy
|
178
|
+
# Which FileSet file to use for mime type resolution
|
179
|
+
# @ see Hyrax::FileSetTypeService
|
180
|
+
attr_writer :characterization_proxy
|
181
|
+
def characterization_proxy
|
182
|
+
@characterization_proxy ||= :original_file
|
183
|
+
end
|
184
|
+
|
185
|
+
# Override characterization runner
|
186
|
+
attr_accessor :characterization_runner
|
187
|
+
|
188
|
+
def mime_types_map # rubocop:disable Metrics/MethodLength
|
189
|
+
{
|
190
|
+
audio_mime_types: [
|
191
|
+
'audio/mp3',
|
192
|
+
'audio/mpeg',
|
193
|
+
'audio/wav',
|
194
|
+
'audio/x-wave',
|
195
|
+
'audio/x-wav',
|
196
|
+
'audio/ogg'
|
197
|
+
],
|
198
|
+
image_mime_types: [
|
199
|
+
'image/png',
|
200
|
+
'image/jpeg',
|
201
|
+
'image/jpg',
|
202
|
+
'image/jp2',
|
203
|
+
'image/bmp',
|
204
|
+
'image/gif',
|
205
|
+
'image/tiff'
|
206
|
+
],
|
207
|
+
office_mime_types: [
|
208
|
+
'text/rtf',
|
209
|
+
'application/msword',
|
210
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
211
|
+
'application/vnd.oasis.opendocument.text',
|
212
|
+
'application/vnd.ms-excel',
|
213
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
214
|
+
'application/vnd.ms-powerpoint',
|
215
|
+
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
216
|
+
],
|
217
|
+
pdf_mime_types: ['application/pdf'],
|
218
|
+
video_mime_types: [
|
219
|
+
'video/mpeg',
|
220
|
+
'video/mp4',
|
221
|
+
'video/webm',
|
222
|
+
'video/x-msvideo',
|
223
|
+
'video/avi',
|
224
|
+
'video/quicktime',
|
225
|
+
'application/mxf'
|
226
|
+
]
|
227
|
+
}
|
228
|
+
end
|
229
|
+
|
230
|
+
# First see if we can get them from the FileSet model. If not, use
|
231
|
+
# configuration.
|
232
|
+
# @param [Symbol] type as listed in mime_types_map keys, aligned with
|
233
|
+
# FileSet method names for backwards compatibility.
|
234
|
+
def lookup_mimes(type)
|
235
|
+
vals = "FileSet".safe_constantize.try(type)
|
236
|
+
return vals if vals.is_a?(Array)
|
237
|
+
mime_types_map[type]
|
238
|
+
end
|
239
|
+
|
240
|
+
attr_writer :derivative_mime_type_mappings
|
241
|
+
|
242
|
+
##
|
243
|
+
# Maps mimetypes to create_*_derivatives methods
|
244
|
+
#
|
245
|
+
# @note these used to be set by +Hydra::Works::MimeTypes+ methods injected
|
246
|
+
# into `FileSet`. for backwards compatibility, those are used as defaults
|
247
|
+
# if present, but since `FileSet` is an application side model (and slated
|
248
|
+
# to be removed) we shouldn't count on it providing these methods.
|
249
|
+
#
|
250
|
+
# @see Hyrax::VaDerivativeService
|
251
|
+
def derivative_mime_type_mappings
|
252
|
+
@derivative_mime_type_mappings ||=
|
253
|
+
{ audio: lookup_mimes(:audio_mime_types),
|
254
|
+
image: lookup_mimes(:image_mime_types),
|
255
|
+
office: lookup_mimes(:office_mime_types),
|
256
|
+
pdf: lookup_mimes(:pdf_mime_types),
|
257
|
+
video: lookup_mimes(:video_mime_types) }
|
258
|
+
end
|
259
|
+
|
260
|
+
attr_writer :derivative_services
|
261
|
+
# The registered candidate derivative services. In the array, the first `valid?` candidate will
|
262
|
+
# handle the derivative generation.
|
263
|
+
#
|
264
|
+
# @return [Array] of objects that conform to Hyrax::DerivativeService interface.
|
265
|
+
# @see Hyrax::DerivativeService
|
266
|
+
def derivative_services
|
267
|
+
@derivative_services ||= [Hyrax::FileSetDerivativesService]
|
268
|
+
end
|
269
|
+
|
270
|
+
attr_writer :fixity_service
|
271
|
+
def fixity_service
|
272
|
+
@fixity_service ||= Hyrax::Fixity::ActiveFedoraFixityService
|
273
|
+
end
|
274
|
+
|
275
|
+
attr_writer :max_days_between_fixity_checks
|
276
|
+
def max_days_between_fixity_checks
|
277
|
+
@max_days_between_fixity_checks ||= 7
|
278
|
+
end
|
151
279
|
# @!endgroup
|
152
280
|
# @!group Groups
|
153
281
|
|
@@ -440,6 +568,20 @@ module Hyrax
|
|
440
568
|
@derivatives_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym)
|
441
569
|
end
|
442
570
|
|
571
|
+
# A HTTP connection to use for Valkyrie Fedora requests
|
572
|
+
#
|
573
|
+
# @return [#call] lambda/proc that generates a Faraday connection
|
574
|
+
def fedora_connection_builder
|
575
|
+
@fedora_connection_builder ||= lambda { |url|
|
576
|
+
Faraday.new(url) do |f|
|
577
|
+
f.request :multipart
|
578
|
+
f.request :url_encoded
|
579
|
+
f.adapter Faraday.default_adapter
|
580
|
+
end
|
581
|
+
}
|
582
|
+
end
|
583
|
+
attr_writer :fedora_connection_builder
|
584
|
+
|
443
585
|
##
|
444
586
|
# @return [#save, #save_all, #delete, #wipe!] an indexing adapter
|
445
587
|
def index_adapter
|
@@ -485,45 +627,6 @@ module Hyrax
|
|
485
627
|
@microdata_default_type ||= 'http://schema.org/CreativeWork'
|
486
628
|
end
|
487
629
|
|
488
|
-
attr_writer :fixity_service
|
489
|
-
def fixity_service
|
490
|
-
@fixity_service ||= Hyrax::Fixity::ActiveFedoraFixityService
|
491
|
-
end
|
492
|
-
|
493
|
-
attr_writer :max_days_between_fixity_checks
|
494
|
-
def max_days_between_fixity_checks
|
495
|
-
@max_days_between_fixity_checks ||= 7
|
496
|
-
end
|
497
|
-
|
498
|
-
# Override characterization runner
|
499
|
-
attr_accessor :characterization_runner
|
500
|
-
|
501
|
-
##
|
502
|
-
# @!attribute [rw] characterization_service
|
503
|
-
# @return [#run] the service to use for charactaerization for Valkyrie
|
504
|
-
# objects
|
505
|
-
# @ see Hyrax::Characterization::ValkyrieCharacterizationService
|
506
|
-
attr_writer :characterization_service
|
507
|
-
def characterization_service
|
508
|
-
@characterization_service ||=
|
509
|
-
Hyrax::Characterization::ValkyrieCharacterizationService
|
510
|
-
end
|
511
|
-
|
512
|
-
##
|
513
|
-
# @!attribute [w] characterization_proxy
|
514
|
-
# Which FileSet file to use for mime type resolution
|
515
|
-
# @ see Hyrax::FileSetTypeService
|
516
|
-
attr_writer :characterization_proxy
|
517
|
-
def characterization_proxy
|
518
|
-
@characterization_proxy ||= :original_file
|
519
|
-
end
|
520
|
-
|
521
|
-
##
|
522
|
-
# Options to pass to the characterization service
|
523
|
-
# @!attribute [rw] characterization_options
|
524
|
-
# @return [Hash] of options like {ch12n_tool: :fits_servlet}
|
525
|
-
attr_accessor :characterization_options
|
526
|
-
|
527
630
|
# Attributes for the lock manager which ensures a single process/thread is mutating a ore:Aggregation at once.
|
528
631
|
# @!attribute [w] lock_retry_count
|
529
632
|
# How many times to retry to acquire the lock before raising UnableToAcquireLockError
|
@@ -678,6 +781,11 @@ module Hyrax
|
|
678
781
|
Qa::Authorities::Geonames.username = username
|
679
782
|
end
|
680
783
|
|
784
|
+
def location_service
|
785
|
+
@location_service ||= Hyrax::LocationService.new
|
786
|
+
end
|
787
|
+
attr_writer :location_service
|
788
|
+
|
681
789
|
attr_writer :active_deposit_agreement_acceptance
|
682
790
|
def active_deposit_agreement_acceptance?
|
683
791
|
return true if @active_deposit_agreement_acceptance.nil?
|
@@ -882,16 +990,6 @@ module Hyrax
|
|
882
990
|
@range_for_number_of_results_to_display_per_page ||= [10, 20, 50, 100]
|
883
991
|
end
|
884
992
|
|
885
|
-
attr_writer :derivative_services
|
886
|
-
# The registered candidate derivative services. In the array, the first `valid?` candidate will
|
887
|
-
# handle the derivative generation.
|
888
|
-
#
|
889
|
-
# @return [Array] of objects that conform to Hyrax::DerivativeService interface.
|
890
|
-
# @see Hyrax::DerivativeService
|
891
|
-
def derivative_services
|
892
|
-
@derivative_services ||= [Hyrax::FileSetDerivativesService]
|
893
|
-
end
|
894
|
-
|
895
993
|
attr_writer :visibility_map
|
896
994
|
# A mapping from visibility string values to permissions; the default and
|
897
995
|
# reference implementation is provided by {Hyrax::VisibilityMap}.
|
@@ -14,7 +14,13 @@ module Hyrax
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def full_label
|
17
|
-
|
17
|
+
location_service.full_label(rdf_subject.to_s)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def location_service
|
23
|
+
Hyrax.config.location_service
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
data/lib/hyrax/engine.rb
CHANGED
data/lib/hyrax/form_fields.rb
CHANGED
@@ -51,6 +51,12 @@ module Hyrax
|
|
51
51
|
descendant.property field_name.to_sym, options.merge(display: true, default: [])
|
52
52
|
descendant.validates field_name.to_sym, presence: true if options.fetch(:required, false)
|
53
53
|
end
|
54
|
+
|
55
|
+
# Auto include any matching FormFieldBehaviors
|
56
|
+
schema_name = name.to_s.camelcase
|
57
|
+
behavior = "#{schema_name}FormFieldsBehavior".safe_constantize ||
|
58
|
+
"Hyrax::#{schema_name}FormFieldsBehavior".safe_constantize
|
59
|
+
descendant.include(behavior) if behavior
|
54
60
|
end
|
55
61
|
end
|
56
62
|
end
|
data/lib/hyrax/publisher.rb
CHANGED
@@ -137,6 +137,10 @@ module Hyrax
|
|
137
137
|
# a system user.
|
138
138
|
register_event('file.metadata.updated')
|
139
139
|
|
140
|
+
# @since 5.0.0
|
141
|
+
# @macro a_registered_event
|
142
|
+
register_event('file.metadata.deleted')
|
143
|
+
|
140
144
|
# @since 5.0.0
|
141
145
|
# @macro a_registered_event
|
142
146
|
register_event('file.uploaded')
|
@@ -25,15 +25,14 @@ module Hyrax
|
|
25
25
|
#
|
26
26
|
# @return [Redis]
|
27
27
|
def instance
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
Redis.current = Redis::Namespace.new(namespace, redis: connection)
|
28
|
+
if Hyrax.config.redis_connection&.is_a?(Redis::Namespace)
|
29
|
+
c = Hyrax.config.redis_connection
|
30
|
+
c.namespace = namespace
|
31
|
+
c
|
32
|
+
elsif Hyrax.config.redis_connection
|
33
|
+
Hyrax.config.redis_connection
|
35
34
|
else
|
36
|
-
|
35
|
+
Redis::Namespace.new(namespace, redis: Redis.new)
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
data/lib/hyrax/resource_name.rb
CHANGED
data/lib/hyrax/specs/capybara.rb
CHANGED
@@ -15,57 +15,40 @@ require 'capybara/rspec'
|
|
15
15
|
require 'capybara/rails'
|
16
16
|
require 'capybara-screenshot/rspec'
|
17
17
|
require 'selenium-webdriver'
|
18
|
-
require 'webdrivers' unless ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
|
19
18
|
|
20
19
|
Capybara.save_path = ENV['CI'] ? "/tmp/test-results" : Rails.root.join('tmp', 'capybara')
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
|
34
|
-
driver = Capybara::Selenium::Driver.new(app,
|
35
|
-
browser: :remote,
|
36
|
-
capabilities: options,
|
37
|
-
url: ENV['HUB_URL'])
|
21
|
+
options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
|
22
|
+
opts.add_argument("--headless") if ENV["CHROME_HEADLESS_MODE"]
|
23
|
+
opts.add_argument("--disable-gpu") if Gem.win_platform?
|
24
|
+
# Workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=2650&q=load&sort=-id&colspec=ID%20Status%20Pri%20Owner%20Summary
|
25
|
+
opts.add_argument("--disable-site-isolation-trials")
|
26
|
+
opts.add_argument("--window-size=1440,1440")
|
27
|
+
opts.add_argument("--enable-features=NetworkService,NetworkServiceInProcess")
|
28
|
+
opts.add_argument("--disable-features=VizDisplayCompositor")
|
29
|
+
end
|
38
30
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
31
|
+
Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
|
32
|
+
driver = Capybara::Selenium::Driver.new(app,
|
33
|
+
browser: :remote,
|
34
|
+
capabilities: options,
|
35
|
+
url: ENV['HUB_URL'])
|
44
36
|
|
45
|
-
|
37
|
+
# Fix for capybara vs remote files. Selenium handles this for us
|
38
|
+
driver.browser.file_detector = lambda do |args|
|
39
|
+
str = args.first.to_s
|
40
|
+
str if File.exist?(str)
|
46
41
|
end
|
47
42
|
|
48
|
-
|
49
|
-
Capybara.server_port = 3010
|
50
|
-
|
51
|
-
ip = IPSocket.getaddress(Socket.gethostname)
|
52
|
-
Capybara.app_host = "http://#{ip}:#{Capybara.server_port}"
|
53
|
-
else
|
54
|
-
TEST_HOST = 'localhost:3000'.freeze
|
55
|
-
# @note In January 2018, TravisCI disabled Chrome sandboxing in its Linux
|
56
|
-
# container build environments to mitigate Meltdown/Spectre
|
57
|
-
# vulnerabilities, at which point Hyrax could no longer use the
|
58
|
-
# Capybara-provided :selenium_chrome_headless driver (which does not
|
59
|
-
# include the `--no-sandbox` argument).
|
60
|
-
Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
|
61
|
-
browser_options = ::Selenium::WebDriver::Chrome::Options.new
|
62
|
-
browser_options.args << '--headless'
|
63
|
-
browser_options.args << '--disable-gpu'
|
64
|
-
browser_options.args << '--no-sandbox'
|
65
|
-
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
|
66
|
-
end
|
43
|
+
driver
|
67
44
|
end
|
68
45
|
|
46
|
+
Capybara.server_host = '0.0.0.0'
|
47
|
+
Capybara.server_port = 3010
|
48
|
+
|
49
|
+
ip = IPSocket.getaddress(Socket.gethostname)
|
50
|
+
Capybara.app_host = "http://#{ip}:#{Capybara.server_port}"
|
51
|
+
|
69
52
|
Capybara.default_driver = :rack_test # This is a faster driver
|
70
53
|
Capybara.javascript_driver = :selenium_chrome_headless_sandboxless # This is slower
|
71
54
|
Capybara.default_max_wait_time = ENV.fetch('CAPYBARA_WAIT_TIME', 10) # We may have a slow application, let's give it some time.
|
@@ -249,7 +249,7 @@ RSpec.shared_examples 'a Hyrax::Work' do
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
-
RSpec.shared_examples 'a Hyrax::FileSet' do
|
252
|
+
RSpec.shared_examples 'a Hyrax::FileSet', valkyrie_adapter: :test_adapter do
|
253
253
|
subject(:fileset) { described_class.new }
|
254
254
|
let(:adapter) { Valkyrie::MetadataAdapter.find(:test_adapter) }
|
255
255
|
let(:persister) { adapter.persister }
|
@@ -275,12 +275,10 @@ RSpec.shared_examples 'a Hyrax::FileSet' do
|
|
275
275
|
end
|
276
276
|
|
277
277
|
context 'with files' do
|
278
|
-
let(:
|
279
|
-
let(:
|
280
|
-
|
281
|
-
|
282
|
-
end
|
283
|
-
|
278
|
+
let(:original_file) { FactoryBot.valkyrie_create :hyrax_file_metadata, :original_file }
|
279
|
+
let(:thumbnail) { FactoryBot.valkyrie_create :hyrax_file_metadata, :thumbnail }
|
280
|
+
let(:extracted_text) { FactoryBot.valkyrie_create :hyrax_file_metadata, :extracted_text }
|
281
|
+
let(:files) { [original_file, thumbnail, extracted_text] }
|
284
282
|
let(:file_ids) { files.map(&:id) }
|
285
283
|
|
286
284
|
before { fileset.file_ids = file_ids }
|
@@ -301,6 +299,35 @@ RSpec.shared_examples 'a Hyrax::FileSet' do
|
|
301
299
|
expect { fileset.file_ids << file_ids.first }
|
302
300
|
.not_to change { query_service.custom_queries.find_files(file_set: fileset) }
|
303
301
|
end
|
302
|
+
|
303
|
+
it 'returns an original_file' do
|
304
|
+
expect(fileset.original_file).to eq original_file
|
305
|
+
expect(fileset.original_file_id).to eq original_file.id
|
306
|
+
end
|
307
|
+
|
308
|
+
it 'returns a thumbnail' do
|
309
|
+
expect(fileset.thumbnail).to eq thumbnail
|
310
|
+
expect(fileset.thumbnail_id).to eq thumbnail.id
|
311
|
+
end
|
312
|
+
|
313
|
+
it 'returns an extracted_text' do
|
314
|
+
expect(fileset.extracted_text).to eq extracted_text
|
315
|
+
expect(fileset.extracted_text_id).to eq extracted_text.id
|
316
|
+
end
|
317
|
+
|
318
|
+
context 'with simulated original file' do
|
319
|
+
let(:file_metadata_double) { double("Fake Hyrax::FileMetadata", id: SecureRandom.uuid, file_identifier: SecureRandom.uuid, versions: [file_double]) }
|
320
|
+
let(:file_double) { double("Fake Valkyrie::StorageAdapter::File", id: SecureRandom.uuid, version_id: SecureRandom.uuid)}
|
321
|
+
|
322
|
+
before do
|
323
|
+
allow(fileset).to receive(:original_file).and_return(file_metadata_double)
|
324
|
+
fileset.id = Valkyrie::ID.new(SecureRandom.uuid)
|
325
|
+
end
|
326
|
+
|
327
|
+
it 'returns a iiif_id with matching ids' do
|
328
|
+
expect(fileset.iiif_id).to eq "#{fileset.id}/files/#{fileset.original_file_id}/#{Digest::MD5.hexdigest(file_double.version_id)}"
|
329
|
+
end
|
330
|
+
end
|
304
331
|
end
|
305
332
|
end
|
306
333
|
end
|
@@ -89,8 +89,6 @@ RSpec.shared_examples 'a thumbnail indexer' do
|
|
89
89
|
before do
|
90
90
|
raise 'indexer_class must be set with `let(:indexer_class)`' unless defined? indexer_class
|
91
91
|
raise 'resource must be set with `let(:resource)` and is expected to be a kind of Hyrax::Resource' unless defined?(resource) && resource.kind_of?(Hyrax::Resource)
|
92
|
-
# optionally can pass in default_visibility by setting it with a let statement if your application changes the default; Hyrax defines this as 'restricted'
|
93
|
-
# See samvera/hyrda-head hydra-access-controls/app/models/concerns/hydra/access_controls/access_rights.rb for possible VISIBILITY_TEXT_VALUE_...'
|
94
92
|
end
|
95
93
|
subject(:indexer) { indexer_class.new(resource: resource) }
|
96
94
|
let(:thumbnail_path) { '/downloads/foo12345?file=thumbnail' }
|
@@ -106,6 +104,27 @@ RSpec.shared_examples 'a thumbnail indexer' do
|
|
106
104
|
end
|
107
105
|
end
|
108
106
|
|
107
|
+
RSpec.shared_examples 'a location indexer' do
|
108
|
+
before do
|
109
|
+
raise 'indexer_class must be set with `let(:indexer_class)`' unless defined? indexer_class
|
110
|
+
raise 'resource must be set with `let(:resource)` and is expected to be a kind of Hyrax::Resource' unless defined?(resource) && resource.kind_of?(Hyrax::Resource)
|
111
|
+
resource.based_near = based_near
|
112
|
+
end
|
113
|
+
subject(:indexer) { indexer_class.new(resource: resource) }
|
114
|
+
let(:based_near) { ["https://sws.geonames.org/4254679/"] }
|
115
|
+
let(:based_near_label) { ["Bloomington, Indiana, United States"] }
|
116
|
+
|
117
|
+
before do
|
118
|
+
allow(Hyrax.config.location_service).to receive(:full_label).with(based_near[0]).and_return(based_near_label[0])
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#to_solr' do
|
122
|
+
it 'indexes locations' do
|
123
|
+
expect(indexer.to_solr).to include(based_near_tesim: based_near, based_near_label_tesim: based_near_label)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
109
128
|
RSpec.shared_examples 'a Core metadata indexer' do
|
110
129
|
before do
|
111
130
|
raise 'indexer_class must be set with `let(:indexer_class)`' unless defined? indexer_class
|
@@ -138,9 +157,10 @@ RSpec.shared_examples 'a Basic metadata indexer' do
|
|
138
157
|
end
|
139
158
|
subject(:indexer) { indexer_class.new(resource: resource) }
|
140
159
|
|
160
|
+
it_behaves_like 'a location indexer'
|
161
|
+
|
141
162
|
let(:attributes) do
|
142
163
|
{
|
143
|
-
based_near: ['helsinki', 'finland'],
|
144
164
|
date_created: ['tuesday'],
|
145
165
|
keyword: ['comic strip'],
|
146
166
|
related_url: ['http://example.com/moomin'],
|
@@ -152,9 +172,7 @@ RSpec.shared_examples 'a Basic metadata indexer' do
|
|
152
172
|
describe '#to_solr' do
|
153
173
|
it 'indexes basic metadata' do
|
154
174
|
expect(indexer.to_solr)
|
155
|
-
.to include(
|
156
|
-
based_near_sim: a_collection_containing_exactly(*attributes[:based_near]),
|
157
|
-
date_created_tesim: a_collection_containing_exactly(*attributes[:date_created]),
|
175
|
+
.to include(date_created_tesim: a_collection_containing_exactly(*attributes[:date_created]),
|
158
176
|
keyword_sim: a_collection_containing_exactly(*attributes[:keyword]),
|
159
177
|
related_url_tesim: a_collection_containing_exactly(*attributes[:related_url]),
|
160
178
|
resource_type_tesim: a_collection_containing_exactly(*attributes[:resource_type]),
|
@@ -9,8 +9,9 @@ module Hyrax
|
|
9
9
|
# @since 3.4.0
|
10
10
|
class CollectionDestroy < Transaction
|
11
11
|
# TODO: Add step that checks if collection is empty for collections of types that require it
|
12
|
-
DEFAULT_STEPS = ['collection_resource.
|
13
|
-
'collection_resource.
|
12
|
+
DEFAULT_STEPS = ['collection_resource.delete_acl',
|
13
|
+
'collection_resource.remove_from_membership',
|
14
|
+
'collection_resource.delete'].freeze
|
14
15
|
|
15
16
|
##
|
16
17
|
# @see Hyrax::Transactions::Transaction
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'dry/container'
|
4
|
+
|
3
5
|
module Hyrax
|
4
6
|
module Transactions
|
5
7
|
##
|
@@ -23,7 +25,9 @@ module Hyrax
|
|
23
25
|
require 'hyrax/transactions/collection_create'
|
24
26
|
require 'hyrax/transactions/collection_destroy'
|
25
27
|
require 'hyrax/transactions/collection_update'
|
28
|
+
require 'hyrax/transactions/file_metadata_destroy'
|
26
29
|
require 'hyrax/transactions/file_set_destroy'
|
30
|
+
require 'hyrax/transactions/file_set_update'
|
27
31
|
require 'hyrax/transactions/work_create'
|
28
32
|
require 'hyrax/transactions/work_destroy'
|
29
33
|
require 'hyrax/transactions/work_update'
|
@@ -35,10 +39,14 @@ module Hyrax
|
|
35
39
|
require 'hyrax/transactions/steps/change_depositor'
|
36
40
|
require 'hyrax/transactions/steps/check_for_empty_admin_set'
|
37
41
|
require 'hyrax/transactions/steps/delete_access_control'
|
42
|
+
require 'hyrax/transactions/steps/delete_all_file_metadata'
|
43
|
+
require 'hyrax/transactions/steps/delete_all_file_sets'
|
38
44
|
require 'hyrax/transactions/steps/delete_resource'
|
39
45
|
require 'hyrax/transactions/steps/ensure_admin_set'
|
46
|
+
require 'hyrax/transactions/steps/file_metadata_delete'
|
40
47
|
require 'hyrax/transactions/steps/set_collection_type_gid'
|
41
48
|
require 'hyrax/transactions/steps/remove_file_set_from_work'
|
49
|
+
require 'hyrax/transactions/steps/remove_from_membership'
|
42
50
|
require 'hyrax/transactions/steps/save'
|
43
51
|
require 'hyrax/transactions/steps/save_access_control'
|
44
52
|
require 'hyrax/transactions/steps/save_collection_banner'
|
@@ -112,6 +120,10 @@ module Hyrax
|
|
112
120
|
CollectionUpdate.new
|
113
121
|
end
|
114
122
|
|
123
|
+
ops.register 'update_file_set' do
|
124
|
+
FileSetUpdate.new
|
125
|
+
end
|
126
|
+
|
115
127
|
ops.register 'update_work' do
|
116
128
|
WorkUpdate.new
|
117
129
|
end
|
@@ -121,11 +133,25 @@ module Hyrax
|
|
121
133
|
end
|
122
134
|
end
|
123
135
|
|
136
|
+
namespace "file_metadata" do |ops| # Hyrax::FileMetadata
|
137
|
+
ops.register 'destroy' do
|
138
|
+
FileMetadataDestroy.new
|
139
|
+
end
|
140
|
+
|
141
|
+
ops.register 'delete' do
|
142
|
+
Steps::FileMetadataDelete.new
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
124
146
|
namespace 'file_set' do |ops| # Hyrax::FileSet resource
|
125
147
|
ops.register 'delete' do
|
126
148
|
Steps::DeleteResource.new
|
127
149
|
end
|
128
150
|
|
151
|
+
ops.register 'delete_all_file_metadata' do
|
152
|
+
Steps::DeleteAllFileMetadata.new
|
153
|
+
end
|
154
|
+
|
129
155
|
ops.register 'destroy' do
|
130
156
|
FileSetDestroy.new
|
131
157
|
end
|
@@ -133,6 +159,14 @@ module Hyrax
|
|
133
159
|
ops.register 'remove_from_work' do
|
134
160
|
Steps::RemoveFileSetFromWork.new
|
135
161
|
end
|
162
|
+
|
163
|
+
ops.register 'delete_acl' do
|
164
|
+
Steps::DeleteAccessControl.new
|
165
|
+
end
|
166
|
+
|
167
|
+
ops.register 'save_acl' do
|
168
|
+
Steps::SaveAccessControl.new
|
169
|
+
end
|
136
170
|
end
|
137
171
|
|
138
172
|
namespace 'admin_set_resource' do |ops| # Hyrax::AdministrativeSet resource
|
@@ -182,6 +216,10 @@ module Hyrax
|
|
182
216
|
Steps::DeleteAccessControl.new
|
183
217
|
end
|
184
218
|
|
219
|
+
ops.register 'remove_from_membership' do
|
220
|
+
Steps::RemoveFromMembership.new
|
221
|
+
end
|
222
|
+
|
185
223
|
ops.register 'save_acl' do
|
186
224
|
Steps::SaveAccessControl.new
|
187
225
|
end
|
@@ -216,6 +254,10 @@ module Hyrax
|
|
216
254
|
Steps::DeleteResource.new
|
217
255
|
end
|
218
256
|
|
257
|
+
ops.register 'delete_all_file_sets' do
|
258
|
+
Steps::DeleteAllFileSets.new
|
259
|
+
end
|
260
|
+
|
219
261
|
ops.register 'destroy' do
|
220
262
|
WorkDestroy.new
|
221
263
|
end
|
@@ -0,0 +1,20 @@
|
|
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 FileMetadataDestroy < Transaction
|
11
|
+
DEFAULT_STEPS = ['file_metadata.delete'].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
|
@@ -8,7 +8,9 @@ module Hyrax
|
|
8
8
|
#
|
9
9
|
# @since 3.1.0
|
10
10
|
class FileSetDestroy < Transaction
|
11
|
-
DEFAULT_STEPS = ['file_set.
|
11
|
+
DEFAULT_STEPS = ['file_set.delete_all_file_metadata',
|
12
|
+
'file_set.remove_from_work',
|
13
|
+
'file_set.delete_acl',
|
12
14
|
'file_set.delete'].freeze
|
13
15
|
|
14
16
|
##
|