bulkrax 9.5.1 → 10.0.1
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/README.md +49 -0
- data/app/controllers/bulkrax/application_controller.rb +83 -0
- data/app/controllers/bulkrax/entries_controller.rb +16 -13
- data/app/controllers/bulkrax/exporters_controller.rb +21 -25
- data/app/controllers/bulkrax/guided_imports_controller.rb +4 -8
- data/app/controllers/bulkrax/importers_controller.rb +84 -46
- data/app/controllers/concerns/bulkrax/datatables_behavior.rb +18 -12
- data/app/controllers/concerns/bulkrax/importer_file_handler.rb +55 -9
- data/app/errors/bulkrax/unsafe_cloud_source_error.rb +11 -0
- data/app/errors/bulkrax/unsafe_path_error.rb +8 -0
- data/app/factories/bulkrax/object_factory.rb +2 -2
- data/app/factories/bulkrax/valkyrie_object_factory.rb +29 -17
- data/app/helpers/bulkrax/validation_helper.rb +1 -1
- data/app/jobs/bulkrax/create_relationships_job.rb +1 -1
- data/app/jobs/bulkrax/download_cloud_file_job.rb +156 -21
- data/app/jobs/bulkrax/import_collection_job.rb +9 -2
- data/app/matchers/bulkrax/application_matcher.rb +5 -2
- data/app/models/bulkrax/csv_entry.rb +1 -1
- data/app/models/bulkrax/current.rb +7 -0
- data/app/models/bulkrax/export_scope.rb +21 -0
- data/app/models/bulkrax/exporter.rb +2 -2
- data/app/models/bulkrax/importer.rb +1 -1
- data/app/models/concerns/bulkrax/ability_behavior.rb +139 -0
- data/app/models/concerns/bulkrax/has_matchers.rb +1 -1
- data/app/models/concerns/bulkrax/import_behavior.rb +3 -3
- data/app/parsers/bulkrax/application_parser.rb +11 -11
- data/app/parsers/bulkrax/application_parser.rb.orig +545 -0
- data/app/parsers/bulkrax/bagit_parser.rb +10 -3
- data/app/parsers/bulkrax/csv_parser.rb +59 -27
- data/app/parsers/bulkrax/oai_dc_parser.rb +1 -1
- data/app/parsers/bulkrax/parser_export_record_set.rb +26 -8
- data/app/parsers/concerns/bulkrax/csv_parser/csv_template_generation.rb +1 -1
- data/app/parsers/concerns/bulkrax/csv_parser/csv_validation.rb +1 -2
- data/app/parsers/concerns/bulkrax/csv_parser/csv_validation_helpers.rb +18 -1
- data/app/parsers/concerns/bulkrax/csv_parser/csv_validation_hierarchy.rb +2 -2
- data/app/search_builders/bulkrax/export_search_builder.rb +9 -0
- data/app/services/bulkrax/cloud_source_validator.rb +123 -0
- data/app/services/bulkrax/csv_template/column_builder.rb +2 -2
- data/app/services/bulkrax/csv_template/mapping_manager.rb +9 -7
- data/app/services/bulkrax/csv_template/schema_analyzer.rb +1 -5
- data/app/services/bulkrax/safe_path.rb +129 -0
- data/config/locales/bulkrax.en.yml +2 -0
- data/lib/bulkrax/engine.rb +1 -1
- data/lib/bulkrax/version.rb +1 -1
- data/lib/bulkrax.rb +77 -10
- data/lib/generators/bulkrax/install_generator.rb +22 -10
- data/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb +1 -1
- metadata +58 -14
- data/app/factories/bulkrax/valkyrize-hyku.code-workspace +0 -19
- data/lib/wings/custom_queries/find_by_source_identifier.rb +0 -41
|
@@ -58,18 +58,30 @@ class Bulkrax::InstallGenerator < Rails::Generators::Base
|
|
|
58
58
|
def add_ability
|
|
59
59
|
file = 'app/models/ability.rb'
|
|
60
60
|
file_text = File.read(file)
|
|
61
|
-
|
|
62
|
-
export_line = 'def can_export_works?'
|
|
63
|
-
unless file_text.include?(import_line)
|
|
64
|
-
insert_into_file file, before: /^end/ do
|
|
65
|
-
" def can_import_works?\n can_create_any_work?\n end"
|
|
66
|
-
end
|
|
67
|
-
end
|
|
61
|
+
include_line = 'include Bulkrax::AbilityBehavior'
|
|
68
62
|
|
|
69
63
|
# rubocop:disable Style/GuardClause
|
|
70
|
-
unless file_text.include?(
|
|
71
|
-
insert_into_file file,
|
|
72
|
-
"
|
|
64
|
+
unless file_text.include?(include_line)
|
|
65
|
+
insert_into_file file, after: /include\s+\S+Ability[^\n]*\n/ do
|
|
66
|
+
" include Bulkrax::AbilityBehavior\n" \
|
|
67
|
+
" self.ability_logic += [:bulkrax_default_abilities]\n\n" \
|
|
68
|
+
" # Override Bulkrax::AbilityBehavior methods as needed, for example:\n" \
|
|
69
|
+
" #\n" \
|
|
70
|
+
" # def can_import_works?\n" \
|
|
71
|
+
" # can_create_any_work?\n" \
|
|
72
|
+
" # end\n" \
|
|
73
|
+
" #\n" \
|
|
74
|
+
" # def can_export_works?\n" \
|
|
75
|
+
" # can_create_any_work?\n" \
|
|
76
|
+
" # end\n" \
|
|
77
|
+
" #\n" \
|
|
78
|
+
" # def can_admin_importers?\n" \
|
|
79
|
+
" # current_user.admin?\n" \
|
|
80
|
+
" # end\n" \
|
|
81
|
+
" #\n" \
|
|
82
|
+
" # def can_admin_exporters?\n" \
|
|
83
|
+
" # current_user.admin?\n" \
|
|
84
|
+
" # end\n"
|
|
73
85
|
end
|
|
74
86
|
end
|
|
75
87
|
# rubocop:enable Style/GuardClause
|
|
@@ -83,6 +83,6 @@ end
|
|
|
83
83
|
|
|
84
84
|
# Sidebar for hyrax 3+ support
|
|
85
85
|
# rubocop:disable Style/IfUnlessModifier
|
|
86
|
-
if
|
|
86
|
+
if Bulkrax.hyrax_loaded? && ::Hyrax::DashboardController&.respond_to?(:sidebar_partials)
|
|
87
87
|
Hyrax::DashboardController.sidebar_partials[:repository_content] << "hyrax/dashboard/sidebar/bulkrax_sidebar_additions"
|
|
88
88
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bulkrax
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 10.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rob Kaufman
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rails
|
|
@@ -16,20 +15,20 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 5.
|
|
18
|
+
version: '5.2'
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 8.
|
|
21
|
+
version: 8.2.0
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 5.
|
|
28
|
+
version: '5.2'
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 8.
|
|
31
|
+
version: 8.2.0
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
34
33
|
name: bagit
|
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,6 +71,20 @@ dependencies:
|
|
|
72
71
|
- - ">="
|
|
73
72
|
- !ruby/object:Gem::Version
|
|
74
73
|
version: '0'
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: deprecation
|
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - "~>"
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '1.0'
|
|
81
|
+
type: :runtime
|
|
82
|
+
prerelease: false
|
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - "~>"
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '1.0'
|
|
75
88
|
- !ruby/object:Gem::Dependency
|
|
76
89
|
name: marcel
|
|
77
90
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -244,6 +257,26 @@ dependencies:
|
|
|
244
257
|
- - ">="
|
|
245
258
|
- !ruby/object:Gem::Version
|
|
246
259
|
version: '0'
|
|
260
|
+
- !ruby/object:Gem::Dependency
|
|
261
|
+
name: ssrf_filter
|
|
262
|
+
requirement: !ruby/object:Gem::Requirement
|
|
263
|
+
requirements:
|
|
264
|
+
- - ">="
|
|
265
|
+
- !ruby/object:Gem::Version
|
|
266
|
+
version: '1.0'
|
|
267
|
+
- - "<"
|
|
268
|
+
- !ruby/object:Gem::Version
|
|
269
|
+
version: '2.0'
|
|
270
|
+
type: :runtime
|
|
271
|
+
prerelease: false
|
|
272
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
273
|
+
requirements:
|
|
274
|
+
- - ">="
|
|
275
|
+
- !ruby/object:Gem::Version
|
|
276
|
+
version: '1.0'
|
|
277
|
+
- - "<"
|
|
278
|
+
- !ruby/object:Gem::Version
|
|
279
|
+
version: '2.0'
|
|
247
280
|
- !ruby/object:Gem::Dependency
|
|
248
281
|
name: dry-monads
|
|
249
282
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -262,16 +295,22 @@ dependencies:
|
|
|
262
295
|
name: sqlite3
|
|
263
296
|
requirement: !ruby/object:Gem::Requirement
|
|
264
297
|
requirements:
|
|
265
|
-
- - "
|
|
298
|
+
- - ">="
|
|
266
299
|
- !ruby/object:Gem::Version
|
|
267
300
|
version: '1.4'
|
|
301
|
+
- - "<"
|
|
302
|
+
- !ruby/object:Gem::Version
|
|
303
|
+
version: '3'
|
|
268
304
|
type: :development
|
|
269
305
|
prerelease: false
|
|
270
306
|
version_requirements: !ruby/object:Gem::Requirement
|
|
271
307
|
requirements:
|
|
272
|
-
- - "
|
|
308
|
+
- - ">="
|
|
273
309
|
- !ruby/object:Gem::Version
|
|
274
310
|
version: '1.4'
|
|
311
|
+
- - "<"
|
|
312
|
+
- !ruby/object:Gem::Version
|
|
313
|
+
version: '3'
|
|
275
314
|
- !ruby/object:Gem::Dependency
|
|
276
315
|
name: simplecov
|
|
277
316
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -365,11 +404,12 @@ files:
|
|
|
365
404
|
- app/controllers/concerns/bulkrax/download_behavior.rb
|
|
366
405
|
- app/controllers/concerns/bulkrax/guided_import_demo_scenarios.rb
|
|
367
406
|
- app/controllers/concerns/bulkrax/importer_file_handler.rb
|
|
407
|
+
- app/errors/bulkrax/unsafe_cloud_source_error.rb
|
|
408
|
+
- app/errors/bulkrax/unsafe_path_error.rb
|
|
368
409
|
- app/errors/bulkrax/unzip_error.rb
|
|
369
410
|
- app/factories/bulkrax/object_factory.rb
|
|
370
411
|
- app/factories/bulkrax/object_factory_interface.rb
|
|
371
412
|
- app/factories/bulkrax/valkyrie_object_factory.rb
|
|
372
|
-
- app/factories/bulkrax/valkyrize-hyku.code-workspace
|
|
373
413
|
- app/helpers/bulkrax/application_helper.rb
|
|
374
414
|
- app/helpers/bulkrax/exporters_helper.rb
|
|
375
415
|
- app/helpers/bulkrax/importers_helper.rb
|
|
@@ -402,7 +442,9 @@ files:
|
|
|
402
442
|
- app/models/bulkrax/csv_collection_entry.rb
|
|
403
443
|
- app/models/bulkrax/csv_entry.rb
|
|
404
444
|
- app/models/bulkrax/csv_file_set_entry.rb
|
|
445
|
+
- app/models/bulkrax/current.rb
|
|
405
446
|
- app/models/bulkrax/entry.rb
|
|
447
|
+
- app/models/bulkrax/export_scope.rb
|
|
406
448
|
- app/models/bulkrax/exporter.rb
|
|
407
449
|
- app/models/bulkrax/exporter_run.rb
|
|
408
450
|
- app/models/bulkrax/import_failed.rb
|
|
@@ -418,6 +460,7 @@ files:
|
|
|
418
460
|
- app/models/bulkrax/rdf_file_set_entry.rb
|
|
419
461
|
- app/models/bulkrax/status.rb
|
|
420
462
|
- app/models/bulkrax/xml_entry.rb
|
|
463
|
+
- app/models/concerns/bulkrax/ability_behavior.rb
|
|
421
464
|
- app/models/concerns/bulkrax/dynamic_record_lookup.rb
|
|
422
465
|
- app/models/concerns/bulkrax/errored_entries.rb
|
|
423
466
|
- app/models/concerns/bulkrax/export_behavior.rb
|
|
@@ -429,6 +472,7 @@ files:
|
|
|
429
472
|
- app/models/concerns/bulkrax/importer_exporter_behavior.rb
|
|
430
473
|
- app/models/concerns/bulkrax/status_info.rb
|
|
431
474
|
- app/parsers/bulkrax/application_parser.rb
|
|
475
|
+
- app/parsers/bulkrax/application_parser.rb.orig
|
|
432
476
|
- app/parsers/bulkrax/bagit_parser.rb
|
|
433
477
|
- app/parsers/bulkrax/csv_parser.rb
|
|
434
478
|
- app/parsers/bulkrax/oai_dc_parser.rb
|
|
@@ -439,6 +483,8 @@ files:
|
|
|
439
483
|
- app/parsers/concerns/bulkrax/csv_parser/csv_validation.rb
|
|
440
484
|
- app/parsers/concerns/bulkrax/csv_parser/csv_validation_helpers.rb
|
|
441
485
|
- app/parsers/concerns/bulkrax/csv_parser/csv_validation_hierarchy.rb
|
|
486
|
+
- app/search_builders/bulkrax/export_search_builder.rb
|
|
487
|
+
- app/services/bulkrax/cloud_source_validator.rb
|
|
442
488
|
- app/services/bulkrax/csv_template/column_builder.rb
|
|
443
489
|
- app/services/bulkrax/csv_template/column_descriptor.rb
|
|
444
490
|
- app/services/bulkrax/csv_template/csv_builder.rb
|
|
@@ -454,6 +500,7 @@ files:
|
|
|
454
500
|
- app/services/bulkrax/csv_template/value_determiner.rb
|
|
455
501
|
- app/services/bulkrax/factory_class_finder.rb
|
|
456
502
|
- app/services/bulkrax/remove_relationships_for_importer.rb
|
|
503
|
+
- app/services/bulkrax/safe_path.rb
|
|
457
504
|
- app/services/bulkrax/split_pattern_coercion.rb
|
|
458
505
|
- app/services/bulkrax/stepper_response_formatter.rb
|
|
459
506
|
- app/services/bulkrax/validation_error_csv_builder.rb
|
|
@@ -565,12 +612,10 @@ files:
|
|
|
565
612
|
- lib/generators/bulkrax/templates/config/initializers/bulkrax.rb
|
|
566
613
|
- lib/tasks/bulkrax_tasks.rake
|
|
567
614
|
- lib/tasks/reset.rake
|
|
568
|
-
- lib/wings/custom_queries/find_by_source_identifier.rb
|
|
569
615
|
homepage: https://github.com/samvera-labs/bulkrax
|
|
570
616
|
licenses:
|
|
571
617
|
- Apache-2.0
|
|
572
618
|
metadata: {}
|
|
573
|
-
post_install_message:
|
|
574
619
|
rdoc_options: []
|
|
575
620
|
require_paths:
|
|
576
621
|
- lib
|
|
@@ -585,8 +630,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
585
630
|
- !ruby/object:Gem::Version
|
|
586
631
|
version: '0'
|
|
587
632
|
requirements: []
|
|
588
|
-
rubygems_version: 3.
|
|
589
|
-
signing_key:
|
|
633
|
+
rubygems_version: 3.6.8
|
|
590
634
|
specification_version: 4
|
|
591
635
|
summary: Import and export tool for Hyrax and Hyku
|
|
592
636
|
test_files: []
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"folders": [
|
|
3
|
-
{
|
|
4
|
-
"path": "../../../../../hyku"
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
"path": "../../../../hyrax"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"path": "../../.."
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"path": "../../../../iiif_print"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"settings": {
|
|
17
|
-
"github.copilot.inlineSuggest.enable": true
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Wings
|
|
4
|
-
module CustomQueries
|
|
5
|
-
class FindBySourceIdentifier
|
|
6
|
-
# Custom query override specific to Wings
|
|
7
|
-
|
|
8
|
-
def self.queries
|
|
9
|
-
[:find_by_property_value]
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
attr_reader :query_service
|
|
13
|
-
delegate :resource_factory, to: :query_service
|
|
14
|
-
|
|
15
|
-
def initialize(query_service:)
|
|
16
|
-
@query_service = query_service
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
|
20
|
-
def find_by_property_value(property:, value:, search_field:, use_valkyrie: Hyrax.config.use_valkyrie?)
|
|
21
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
|
22
|
-
# NOTE: This is using the Bulkrax::ObjectFactory (e.g. the one envisioned for ActiveFedora).
|
|
23
|
-
# In doing this, we avoid the situation where Bulkrax::ValkyrieObjectFactory calls this custom query.
|
|
24
|
-
|
|
25
|
-
# This is doing a solr search first, so we have to use the search_field instead of the property for "field"
|
|
26
|
-
# If it cannot find the object in Solr, it falls back to an ActiveFedora search, if the object is an ActiveFedora object
|
|
27
|
-
af_object = Bulkrax::ObjectFactory.search_by_property(
|
|
28
|
-
value: value,
|
|
29
|
-
klass: ActiveFedora::Base,
|
|
30
|
-
field: search_field,
|
|
31
|
-
name_field: property
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
return if af_object.blank?
|
|
35
|
-
return af_object unless use_valkyrie
|
|
36
|
-
|
|
37
|
-
resource_factory.to_resource(object: af_object)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|