hyrax 3.4.1 → 3.5.0

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.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +26 -17
  3. data/.dassie/.env +1 -1
  4. data/.dassie/Gemfile +1 -1
  5. data/.dassie/app/forms/collection_resource_form.rb +8 -0
  6. data/.dassie/app/indexers/collection_resource_indexer.rb +8 -0
  7. data/.dassie/app/models/collection_resource.rb +35 -0
  8. data/.dassie/config/initializers/file_services.rb +4 -0
  9. data/.dassie/config/initializers/hyrax.rb +2 -1
  10. data/.dassie/config/metadata/collection_resource.yaml +23 -0
  11. data/.dassie/db/seeds.rb +2 -0
  12. data/.dassie/spec/forms/collection_resource_form_spec.rb +13 -0
  13. data/.dassie/spec/indexers/collection_resource_indexer_spec.rb +14 -0
  14. data/.dassie/spec/models/collection_resource_spec.rb +13 -0
  15. data/.regen +1 -1
  16. data/.rubocop.yml +1 -1
  17. data/.rubocop_fixme.yml +19 -2
  18. data/CONTAINERS.md +18 -13
  19. data/Dockerfile +2 -2
  20. data/app/actors/hyrax/actors/collections_membership_actor.rb +1 -1
  21. data/app/actors/hyrax/actors/embargo_actor.rb +11 -4
  22. data/app/actors/hyrax/actors/lease_actor.rb +11 -4
  23. data/app/assets/javascripts/hyrax/app.js.erb +1 -1
  24. data/app/assets/javascripts/hyrax/collections_v2.es6 +13 -0
  25. data/app/assets/javascripts/hyrax/permissions/control.es6 +8 -1
  26. data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +1 -3
  27. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +11 -2
  28. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +11 -2
  29. data/app/controllers/concerns/hyrax/manages_embargoes.rb +13 -1
  30. data/app/controllers/hyrax/dashboard/collections_controller.rb +159 -76
  31. data/app/controllers/hyrax/downloads_controller.rb +16 -1
  32. data/app/controllers/hyrax/file_sets_controller.rb +10 -1
  33. data/app/controllers/hyrax/permissions_controller.rb +1 -1
  34. data/app/controllers/hyrax/single_use_links_viewer_controller.rb +1 -1
  35. data/app/controllers/hyrax/transfers_controller.rb +0 -2
  36. data/app/controllers/hyrax/workflow_actions_controller.rb +3 -2
  37. data/app/forms/hyrax/forms/collection_form.rb +1 -1
  38. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +2 -0
  39. data/app/forms/hyrax/forms/embargo.rb +13 -0
  40. data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
  41. data/app/forms/hyrax/forms/file_set_form.rb +8 -35
  42. data/app/forms/hyrax/forms/lease.rb +13 -0
  43. data/app/forms/hyrax/forms/pcdm_collection_form.rb +29 -2
  44. data/app/forms/hyrax/forms/pcdm_object_form.rb +46 -0
  45. data/app/forms/hyrax/forms/resource_form.rb +39 -21
  46. data/app/forms/hyrax/forms/widgets/admin_set_visibility.rb +1 -1
  47. data/app/forms/hyrax/forms/work_embargo_form.rb +35 -0
  48. data/app/forms/hyrax/forms/work_lease_form.rb +35 -0
  49. data/app/helpers/hyrax/embargo_helper.rb +11 -0
  50. data/app/helpers/hyrax/lease_helper.rb +11 -0
  51. data/app/indexers/hyrax/pcdm_collection_indexer.rb +1 -1
  52. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +2 -8
  53. data/app/jobs/characterize_job.rb +5 -1
  54. data/app/jobs/content_event_job.rb +1 -1
  55. data/app/jobs/import_url_job.rb +4 -6
  56. data/app/jobs/valkyrie_ingest_job.rb +15 -77
  57. data/app/models/admin_set.rb +8 -0
  58. data/app/models/concerns/hyrax/collection_behavior.rb +3 -2
  59. data/app/models/concerns/hyrax/collection_nesting.rb +10 -1
  60. data/app/models/concerns/hyrax/file_set_behavior.rb +1 -0
  61. data/app/models/concerns/hyrax/user.rb +11 -0
  62. data/app/models/concerns/hyrax/work_behavior.rb +3 -2
  63. data/app/models/featured_work_list.rb +0 -1
  64. data/app/models/hyrax/embargo.rb +1 -1
  65. data/app/models/hyrax/file_metadata.rb +32 -2
  66. data/app/models/hyrax/file_set.rb +4 -6
  67. data/app/models/hyrax/group.rb +19 -0
  68. data/app/models/hyrax/lease.rb +1 -1
  69. data/app/models/hyrax/pcdm_collection.rb +0 -1
  70. data/app/models/job_io_wrapper.rb +1 -1
  71. data/app/models/proxy_deposit_request.rb +1 -1
  72. data/app/presenters/hyrax/member_presenter_factory.rb +2 -4
  73. data/app/presenters/hyrax/permission_badge.rb +3 -2
  74. data/app/presenters/hyrax/version_list_presenter.rb +6 -1
  75. data/app/presenters/hyrax/work_show_presenter.rb +3 -3
  76. data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +13 -5
  77. data/app/services/hyrax/access_control_list.rb +7 -6
  78. data/app/services/hyrax/adapters/nesting_index_adapter.rb +3 -3
  79. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +3 -5
  80. data/app/services/hyrax/collections/collection_member_service.rb +3 -5
  81. data/app/services/hyrax/collections/nested_collection_query_service.rb +1 -1
  82. data/app/services/hyrax/edit_permissions_service.rb +21 -3
  83. data/app/services/hyrax/embargo_manager.rb +9 -0
  84. data/app/services/hyrax/file_set_file_service.rb +55 -0
  85. data/app/services/hyrax/lease_manager.rb +9 -0
  86. data/app/services/hyrax/listeners/file_metadata_listener.rb +11 -0
  87. data/app/services/hyrax/listeners/member_cleanup_listener.rb +14 -18
  88. data/app/services/hyrax/multiple_membership_checker.rb +2 -0
  89. data/app/services/hyrax/user_stat_importer.rb +2 -0
  90. data/app/services/hyrax/valkyrie_persist_derivatives.rb +50 -0
  91. data/app/services/hyrax/valkyrie_upload.rb +94 -0
  92. data/app/services/hyrax/versioning_service.rb +77 -9
  93. data/app/services/hyrax/visibility_propagator.rb +5 -5
  94. data/app/services/hyrax/work_resource_query_service.rb +45 -0
  95. data/app/services/hyrax/workflow/workflow_importer.rb +7 -9
  96. data/app/services/hyrax/workflow/workflow_schema.rb +3 -5
  97. data/app/strategies/hyrax/strategies/yaml_strategy.rb +4 -6
  98. data/app/uploaders/hyrax/uploaded_file_uploader.rb +4 -4
  99. data/app/validators/hyrax/collection_membership_validator.rb +16 -15
  100. data/app/views/catalog/_index_header_list_default.html.erb +8 -1
  101. data/app/views/catalog/_thumbnail_list_default.html.erb +8 -3
  102. data/app/views/collections/edit_fields/_based_near.html.erb +7 -7
  103. data/app/views/hyrax/base/_form_progress.html.erb +1 -1
  104. data/app/views/hyrax/base/_form_visibility_component.html.erb +5 -1
  105. data/app/views/hyrax/dashboard/collections/_form.html.erb +3 -2
  106. data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +1 -0
  107. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +1 -1
  108. data/app/views/hyrax/embargoes/edit.html.erb +3 -3
  109. data/app/views/hyrax/file_sets/_permission.html.erb +1 -1
  110. data/app/views/hyrax/file_sets/_permission_form.html.erb +1 -6
  111. data/app/views/hyrax/file_sets/edit.html.erb +2 -2
  112. data/app/views/hyrax/leases/edit.html.erb +3 -3
  113. data/app/views/hyrax/my/works/_tabs.html.erb +6 -1
  114. data/app/views/hyrax/transfers/new.html.erb +1 -1
  115. data/chart/hyrax/Chart.yaml +10 -6
  116. data/chart/hyrax/templates/_helpers.tpl +4 -0
  117. data/chart/hyrax/templates/cron-embargo.yaml +5 -0
  118. data/chart/hyrax/templates/cron-lease.yaml +5 -0
  119. data/chart/hyrax/templates/deployment-worker.yaml +11 -0
  120. data/chart/hyrax/templates/ingress.yaml +7 -6
  121. data/chart/hyrax/values.yaml +152 -0
  122. data/config/features.rb +48 -50
  123. data/config/initializers/{valkryrie_storage.rb → storage_adapter_initializer.rb} +5 -0
  124. data/config/locales/hyrax.de.yml +14 -13
  125. data/config/locales/hyrax.en.yml +3 -0
  126. data/config/locales/hyrax.es.yml +1 -0
  127. data/config/locales/hyrax.fr.yml +2 -1
  128. data/config/locales/hyrax.it.yml +1 -0
  129. data/config/locales/hyrax.pt-BR.yml +1 -0
  130. data/config/locales/hyrax.zh.yml +1 -0
  131. data/config/metadata/file_set_metadata.yaml +130 -0
  132. data/docker-compose.yml +1 -0
  133. data/documentation/developing-your-hyrax-based-app.md +2 -2
  134. data/documentation/legacyREADME.md +3 -3
  135. data/hyrax.gemspec +7 -3
  136. data/lib/generators/hyrax/collection_resource/USAGE +20 -0
  137. data/lib/generators/hyrax/collection_resource/collection_resource_generator.rb +133 -0
  138. data/lib/generators/hyrax/collection_resource/templates/collection.rb.erb +34 -0
  139. data/lib/generators/hyrax/collection_resource/templates/collection_form.rb.erb +7 -0
  140. data/lib/generators/hyrax/collection_resource/templates/collection_form_spec.rb.erb +13 -0
  141. data/lib/generators/hyrax/collection_resource/templates/collection_indexer.rb.erb +7 -0
  142. data/lib/generators/hyrax/collection_resource/templates/collection_indexer_spec.rb.erb +13 -0
  143. data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +22 -0
  144. data/lib/generators/hyrax/collection_resource/templates/collection_spec.rb.erb +12 -0
  145. data/lib/generators/hyrax/install_generator.rb +9 -0
  146. data/lib/generators/hyrax/templates/config/locales/hyrax.de.yml +1 -1
  147. data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +1 -1
  148. data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +1 -1
  149. data/lib/generators/hyrax/templates/config/locales/hyrax.fr.yml +1 -1
  150. data/lib/generators/hyrax/templates/config/locales/hyrax.it.yml +1 -1
  151. data/lib/generators/hyrax/templates/config/locales/hyrax.zh.yml +1 -1
  152. data/lib/hyrax/active_fedora_dummy_model.rb +13 -0
  153. data/lib/hyrax/configuration.rb +21 -2
  154. data/lib/hyrax/errors.rb +2 -0
  155. data/lib/hyrax/publisher.rb +4 -0
  156. data/lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb +6 -0
  157. data/lib/hyrax/specs/shared_specs/hydra_works.rb +0 -1
  158. data/lib/hyrax/specs/shared_specs/indexers.rb +5 -0
  159. data/lib/hyrax/transactions/collection_update.rb +2 -0
  160. data/lib/hyrax/transactions/container.rb +10 -0
  161. data/lib/hyrax/transactions/steps/save_collection_banner.rb +59 -0
  162. data/lib/hyrax/transactions/steps/save_collection_logo.rb +109 -0
  163. data/lib/hyrax/version.rb +1 -1
  164. data/lib/wings/active_fedora_converter/file_metadata_node.rb +48 -0
  165. data/lib/wings/active_fedora_converter/instance_builder.rb +68 -0
  166. data/lib/wings/active_fedora_converter.rb +3 -3
  167. data/lib/wings/services/custom_queries/find_file_metadata.rb +19 -8
  168. data/lib/wings/valkyrie/query_service.rb +4 -6
  169. data/lib/wings/valkyrie/storage.rb +6 -2
  170. data/template.rb +1 -1
  171. metadata +99 -13
  172. data/app/views/catalog/_index_header_list_hyrax_pcdm_collection.html.erb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 865d623446e36dc64e73cf82ef855955e83d8d8f730a65f439b9b89664641c3f
4
- data.tar.gz: 87aec067e009093bbd119d6d39639c5c6927b2b26173088ca7000b1241f71caa
3
+ metadata.gz: 98e61b637b4f510e877e88c3f2f8020a411b7d83cd0c074e142f666fbda964f1
4
+ data.tar.gz: 17a8be1a76c9755d5e8b2b1387e907c2d70722809cdb28a62088d913dc584384
5
5
  SHA512:
6
- metadata.gz: d75dbf03372ee072f394a88af8449ff947ff42b21de9b10a83428ac98af5d01783f21e7f123ee00e3c0dd7b6d3808d4e7d59f0238e1fda703da8358d2b567447
7
- data.tar.gz: 6dae952fde3a2f2fdc329775d8efe14929e23c0f92284d1848abfa8a7a8a041e4b5a197a4fa0581d3934ddc9267d0e3ca64c455a5f65b81f5287bde8110fb19e
6
+ metadata.gz: 445d46c5b5b5ee45ea4262e1809e92356f9536f2f919af929b9d33fafcc13c584ae0ff1c6c2b27cac8ffbcdf35f9be6fd9a726b9bf5c9cafc0632fbd8596a90c
7
+ data.tar.gz: d5d5ca3a839a02af1fec27d262eb8301a5880a07caba29b9ce383b37a7c7aea098e57f3ddf9c3fbc1582f5a9ffa227e7d0fc3702833a645ae86b7ab94745a2f9
data/.circleci/config.yml CHANGED
@@ -6,7 +6,7 @@ jobs:
6
6
  parameters:
7
7
  ruby_version:
8
8
  type: string
9
- default: 2.5.8
9
+ default: 2.5.9
10
10
  bundler_version:
11
11
  type: string
12
12
  default: 1.17.3
@@ -67,7 +67,7 @@ jobs:
67
67
  parameters:
68
68
  ruby_version:
69
69
  type: string
70
- default: 2.5.8
70
+ default: 2.5.9
71
71
  bundler_version:
72
72
  type: string
73
73
  default: 1.17.3
@@ -86,6 +86,15 @@ jobs:
86
86
  steps:
87
87
  - attach_workspace:
88
88
  at: ~/
89
+ - when:
90
+ condition:
91
+ equal: [ '2.5.9', << parameters.ruby_version >> ]
92
+ steps:
93
+ - run:
94
+ name: "Lock browse everything for Ruby 2.5"
95
+ command: |
96
+ sed -i.bak "s/browse-everything.*/browse-everything\', \'1.1.2\'/" hyrax.gemspec
97
+ bundle
89
98
  - samvera/engine_cart_generate:
90
99
  cache_key: v1-internal-test-app-{{ checksum "hyrax.gemspec" }}-{{ checksum ".regen" }}-{{ checksum ".circleci/config.yml" }}-<< parameters.rails_version >>-<< parameters.ruby_version >>
91
100
  - samvera/bundle:
@@ -101,7 +110,7 @@ jobs:
101
110
  parameters:
102
111
  ruby_version:
103
112
  type: string
104
- default: 2.5.8
113
+ default: 2.5.9
105
114
  bundler_version:
106
115
  type: string
107
116
  default: 1.17.3
@@ -150,43 +159,43 @@ jobs:
150
159
  --header 'Content-Type: application/json'
151
160
  workflows:
152
161
  version: 2
153
- ruby2-5-8:
162
+ ruby2-5:
154
163
  jobs:
155
164
  - bundle:
156
- ruby_version: "2.5.8"
165
+ ruby_version: "2.5.9"
157
166
  rails_version: "5.2.6"
158
167
  - build:
159
- ruby_version: "2.5.8"
168
+ ruby_version: "2.5.9"
160
169
  rails_version: "5.2.6"
161
170
  requires:
162
171
  - bundle
163
172
  - test:
164
- name: "ruby2-5-8"
165
- ruby_version: "2.5.8"
173
+ name: "ruby2-5"
174
+ ruby_version: "2.5.9"
166
175
  requires:
167
176
  - build
168
- ruby2-6-6:
177
+ ruby2-6:
169
178
  jobs:
170
179
  - bundle:
171
- ruby_version: "2.6.6"
180
+ ruby_version: "2.6.7"
172
181
  rails_version: "5.2.6"
173
182
  - build:
174
- ruby_version: "2.6.6"
183
+ ruby_version: "2.6.7"
175
184
  rails_version: "5.2.6"
176
185
  requires:
177
186
  - bundle
178
187
  - test:
179
- name: "ruby2-6-6"
180
- ruby_version: "2.6.6"
188
+ name: "ruby2-6"
189
+ ruby_version: "2.6.7"
181
190
  requires:
182
191
  - build
183
192
  - test:
184
- name: "ruby2-6-6-valkyrie"
185
- ruby_version: "2.6.6"
193
+ name: "ruby2-6-valkyrie"
194
+ ruby_version: "2.6.7"
186
195
  hyrax_valkyrie: "true"
187
196
  requires:
188
197
  - build
189
- ruby2-7-4:
198
+ ruby2-7:
190
199
  jobs:
191
200
  - bundle:
192
201
  ruby_version: "2.7.4"
@@ -199,7 +208,7 @@ workflows:
199
208
  requires:
200
209
  - bundle
201
210
  - test:
202
- name: "ruby2-7-4"
211
+ name: "ruby2-7"
203
212
  ruby_version: "2.7.4"
204
213
  bundler_version: "2.1.4"
205
214
  requires:
data/.dassie/.env CHANGED
@@ -1,4 +1,4 @@
1
1
  MEMCACHED_HOST=memcached
2
2
  REDIS_PROVIDER=SIDEKIQ_REDIS_URL
3
- SIDEKIQ_REDIS_URL=redis://redis:6379/0
4
3
  SEED_DASSIE=true
4
+ SIDEKIQ_REDIS_URL=redis://redis:6379/0
data/.dassie/Gemfile CHANGED
@@ -8,7 +8,7 @@ else
8
8
  end
9
9
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
10
10
 
11
- ruby '2.7.4'
11
+ ruby '2.7.5'
12
12
 
13
13
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
14
14
  gem 'rails', '~> 5.2.4', '>= 5.2.4.4'
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated via
4
+ # `rails generate hyrax:collection_resource CollectionResource`
5
+ class CollectionResourceForm < Hyrax::Forms::PcdmCollectionForm
6
+ include Hyrax::FormFields(:basic_metadata)
7
+ include Hyrax::FormFields(:collection_resource)
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated via
4
+ # `rails generate hyrax:collection_resource CollectionResource`
5
+ class CollectionResourceIndexer < Hyrax::PcdmCollectionIndexer
6
+ include Hyrax::Indexer(:basic_metadata)
7
+ include Hyrax::Indexer(:collection_resource)
8
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated via
4
+ # `rails generate hyrax:collection_resource CollectionResource`
5
+ class CollectionResource < Hyrax::PcdmCollection
6
+ # @note Do not directly update `basic_metadata.yaml`. It is also used by works.
7
+ #
8
+ # To change metadata for collections
9
+ # * extend by adding fields to `/config/metadata/collection_resource.yaml`
10
+ # * remove all basic metadata
11
+ # * if you generated `with_basic_metadata` and now don't want any basic metadata,
12
+ # comment out or delete the schema include statement for `:basic_metadata`
13
+ # * update form and indexer classes to also remove the `:basic_metadata` schema include
14
+ # * remove some basic metadata
15
+ # * comment out or delete the schema include statement for `:basic_metadata`
16
+ # * update form and indexer classes to also remove the `:basic_metadata` schema include
17
+ # * copy fields you want to keep from `/config/metadata/basic_metadata.yaml`
18
+ # to `/config/metadata/collection_resource.yaml`
19
+ # * override some basic metadata
20
+ # * fields are not allowed to repeat, so to override any basic metadata, you
21
+ # must first comment out or delete the schema include statement for `:basic_metadata`
22
+ # * update form and indexer classes to also remove the `:basic_metadata` schema include
23
+ # * copy all fields you want to keep unchanged or to override from `/config/metadata/basic_metadata.yaml`
24
+ # to `/config/metadata/collection_resource.yaml`
25
+ # * update them in `config/metadata/collection_resource.yaml to have the desired
26
+ # characteristics
27
+ #
28
+ # Alternative:
29
+ # * comment out or delete schema include statements
30
+ # * add Valkyrie attributes to this class
31
+ # * update form and indexer to process the attributes
32
+ #
33
+ include Hyrax::Schema(:basic_metadata)
34
+ include Hyrax::Schema(:collection_resource)
35
+ end
@@ -0,0 +1,4 @@
1
+ ActiveSupport::Reloader.to_prepare do
2
+ Hydra::Derivatives.config.output_file_service = Hyrax::ValkyriePersistDerivatives
3
+ Hydra::Derivatives.config.source_file_service = Hyrax::LocalFileService
4
+ end
@@ -54,7 +54,8 @@ Hyrax.config do |config|
54
54
  ##
55
55
  # NOTE: To Valkyrie works, use Monograph which is_a Hyrax::Work is_a Valkyrie::Resource
56
56
  # To use Valkyrie models, uncomment the following lines.
57
- # config.collection_model = 'Hyrax::PcdmCollection'
57
+ # config.collection_model = 'Hyrax::PcdmCollection' # collection without basic metadata
58
+ # config.collection_model = 'CollectionResource' # collection with basic metadata
58
59
  # config.admin_set_model = 'Hyrax::AdministrativeSet'
59
60
  end
60
61
 
@@ -0,0 +1,23 @@
1
+ # Simple yaml config-driven schema which is used to define model attributes,
2
+ # index key names, and form properties.
3
+ #
4
+ # Originally generated with no metadata via
5
+ # `rails generate hyrax:collection_resource CollectionResource`
6
+ #
7
+ # A few custom fields are added for testing purposes.
8
+
9
+ ---
10
+ attributes:
11
+ target_audience:
12
+ type: string
13
+ form:
14
+ primary: true
15
+ multiple: true
16
+ department:
17
+ type: string
18
+ form:
19
+ primary: true
20
+ course:
21
+ type: string
22
+ form:
23
+ primary: false
data/.dassie/db/seeds.rb CHANGED
@@ -68,6 +68,8 @@ if wipe_data
68
68
  end
69
69
 
70
70
  if seed_dassie
71
+ puts 'Seeding Dassie ...'
72
+
71
73
  Hyrax::RequiredDataSeeder.new.generate_seed_data
72
74
  Hyrax::TestDataSeeders::UserSeeder.generate_seeds
73
75
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated via
4
+ # `rails generate hyrax:collection_resource CollectionResource`
5
+ require 'rails_helper'
6
+ require 'valkyrie/specs/shared_specs'
7
+
8
+ RSpec.describe CollectionResourceForm do
9
+ let(:change_set) { described_class.new(resource) }
10
+ let(:resource) { CollectionResource.new }
11
+
12
+ it_behaves_like 'a Valkyrie::ChangeSet'
13
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated via
4
+ # `rails generate hyrax:collection_resource CollectionResource`
5
+ require 'rails_helper'
6
+ require 'hyrax/specs/shared_specs/indexers'
7
+
8
+ RSpec.describe CollectionResourceIndexer do
9
+ let(:indexer_class) { described_class }
10
+ let(:resource) { CollectionResource.new }
11
+
12
+ it_behaves_like 'a Hyrax::Resource indexer'
13
+ it_behaves_like 'a Basic metadata indexer'
14
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated via
4
+ # `rails generate hyrax:collection_resource CollectionResource`
5
+ require 'rails_helper'
6
+ require 'hyrax/specs/shared_specs/hydra_works'
7
+
8
+ RSpec.describe CollectionResource do
9
+ subject(:collection) { described_class.new }
10
+
11
+ it_behaves_like 'a Hyrax::PcdmCollection'
12
+ it_behaves_like 'a model with basic metadata'
13
+ end
data/.regen CHANGED
@@ -1 +1 @@
1
- 41
1
+ 46
data/.rubocop.yml CHANGED
@@ -5,7 +5,7 @@ inherit_gem:
5
5
  bixby: bixby_default.yml
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.4
8
+ TargetRubyVersion: 2.5
9
9
  DisplayCopNames: true
10
10
  Exclude:
11
11
  - 'db/**/*'
data/.rubocop_fixme.yml CHANGED
@@ -171,14 +171,31 @@ RSpec/RepeatedDescription:
171
171
  - 'spec/models/sipity/workflow_state_action_spec.rb'
172
172
  - 'spec/models/sipity/workflow_state_spec.rb'
173
173
 
174
- # Offense count: 1
174
+ # Offense count: 2
175
175
  # Configuration parameters: Include.
176
176
  # Include: app/models/**/*.rb
177
177
  Rails/HasManyOrHasOneDependent:
178
178
  Exclude:
179
179
  - 'app/models/admin_set.rb'
180
+ - 'app/models/hyrax/permission_template.rb'
180
181
 
181
182
  # Offense count: 1
182
- Style/MethodMissingSuper:
183
+ Rails/SkipsModelValidations:
184
+ Exclude:
185
+ - 'app/services/hyrax/works/migration_service.rb'
186
+
187
+ # Offense count: 12
188
+ Lint/MissingSuper:
183
189
  Exclude:
190
+ - 'app/actors/hyrax/actors/interpret_visibility_actor.rb'
191
+ - 'app/actors/hyrax/actors/ordered_members_actor.rb'
184
192
  - 'app/models/concerns/hyrax/file_set/characterization.rb'
193
+ - 'app/presenters/hyrax/file_usage.rb'
194
+ - 'app/presenters/hyrax/work_usage.rb'
195
+ - 'app/services/hyrax/batch_create_failure_service.rb'
196
+ - 'app/services/hyrax/batch_create_success_service.rb'
197
+ - 'app/services/hyrax/collection_types/create_service.rb'
198
+ - 'app/services/hyrax/solr_query_service.rb'
199
+ - 'lib/hyrax/form_fields.rb'
200
+ - 'lib/hyrax/health_checks/solr_check.rb'
201
+ - 'lib/hyrax/schema.rb'
data/CONTAINERS.md CHANGED
@@ -143,28 +143,32 @@ _This is for applications that mount Hyrax and is separate from the docker conta
143
143
 
144
144
  ### Maintaining
145
145
 
146
- We publish several Hyrax images to hub.docker.com under the
147
- [`samveralabs` group][dockerhub-samveralabs]. To build them, do:
146
+ We publish several Hyrax images to the [GitHub container registry][ghcr] under
147
+ the [Samvera organization][samvera-packages]. To build them:
148
148
 
149
149
  ```sh
150
- # build an image for an app using Postgresql (`gem 'pg'`)
151
- docker build --target hyrax --tag samveralabs/hyrax:(git rev-parse HEAD) .
152
- docker push samveralabs/hyrax:(git rev-parse HEAD)
150
+ export HYRAX_VERSION=v3.4.1 # or desired version
151
+ git checkout $HYRAX_VERSION
153
152
 
154
- # or; build a development image with sqlite
155
- docker build --target hyrax --tag samveralabs/hyrax:(git rev-parse HEAD)-sqlite --build-arg DATABASE_APK_PACKAGE="sqlite" .
156
- docker push samveralabs/hyrax:(git rev-parse HEAD)-sqlite
153
+ docker build --target hyrax-base --tag ghcr.io/samvera/hyrax/hyrax-base:$(git rev-parse HEAD) .
154
+
155
+ docker tag ghcr.io/samvera/hyrax/hyrax-base:$(git rev-parse HEAD) ghcr.io/samvera/hyrax/hyrax-base:$HYRAX_VERSION
156
+
157
+ docker push ghcr.io/samvera/hyrax/hyrax-base:$(git rev-parse HEAD)
158
+ docker push ghcr.io/samvera/hyrax/hyrax-base:$HYRAX_VERSION
157
159
  ```
158
160
 
161
+ Do the same for `hyrax-worker-base`.
162
+
159
163
  We also publish an image for the stable test application `dassie`:
160
164
 
161
165
  ```sh
162
- docker build --target hyrax-engine-dev --tag samveralabs/dassie:(git rev-parse HEAD) .
166
+ docker build --target hyrax-engine-dev --tag ghcr.io/samvera/hyrax/dassie:$(git rev-parse HEAD) .
163
167
 
164
- docker tag samveralabs/dassie:(git rev-parse HEAD) samveralabs/dassie:$HYRAX_VERSION
168
+ docker tag ghcr.io/samvera/hyrax/dassie:$(git rev-parse HEAD) ghcr.io/samvera/hyrax/dassie:$HYRAX_VERSION
165
169
 
166
- docker push samveralabs/dassie:(git rev-parse HEAD)
167
- docker push samveralabs/dassie:$HYRAX_VERSION
170
+ docker push ghcr.io/samvera/hyrax/dassie:$(git rev-parse HEAD)
171
+ docker push ghcr.io/samvera/hyrax/dassie:$HYRAX_VERSION
168
172
  ```
169
173
 
170
174
  ## Deploying to Production
@@ -180,4 +184,5 @@ helm dependency update chart/hyrax
180
184
  helm install -n hyrax --set image.tag=(git rev-parse HEAD) dassie chart/hyrax
181
185
  ```
182
186
 
183
- [dockerhub-samveralabs]: https://hub.docker.com/r/samveralabs
187
+ [ghcr]: https://docs.github.com/en/enterprise-cloud@latest/packages/working-with-a-github-packages-registry/working-with-the-container-registry
188
+ [samvera-packages]: https://github.com/orgs/samvera/packages
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- ARG RUBY_VERSION=2.7.4
2
- FROM ruby:$RUBY_VERSION-alpine3.14 as hyrax-base
1
+ ARG RUBY_VERSION=2.7.5
2
+ FROM ruby:$RUBY_VERSION-alpine3.15 as hyrax-base
3
3
 
4
4
  ARG DATABASE_APK_PACKAGE="postgresql-dev"
5
5
  ARG EXTRA_APK_PACKAGES="git"
@@ -70,7 +70,7 @@ module Hyrax
70
70
  # along side the FileSets on the show page
71
71
  def add(env, id)
72
72
  collection = Hyrax.config.collection_class.find(id)
73
- collection.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX
73
+ collection.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX)
74
74
 
75
75
  return unless env.current_ability.can?(:deposit, collection)
76
76
  env.curation_concern.member_of_collections << collection
@@ -12,10 +12,17 @@ module Hyrax
12
12
  # Update the visibility of the work to match the correct state of the embargo, then clear the embargo date, etc.
13
13
  # Saves the embargo and the work
14
14
  def destroy
15
- work.embargo_visibility! # If the embargo has lapsed, update the current visibility.
16
- work.deactivate_embargo!
17
- work.embargo.save!
18
- work.save!
15
+ case work
16
+ when Valkyrie::Resource
17
+ embargo_manager = Hyrax::EmbargoManager.new(resource: work)
18
+ embargo_manager.release && Hyrax::AccessControlList(work).save
19
+ embargo_manager.nullify
20
+ else
21
+ work.embargo_visibility! # If the embargo has lapsed, update the current visibility.
22
+ work.deactivate_embargo!
23
+ work.embargo.save!
24
+ work.save!
25
+ end
19
26
  end
20
27
  end
21
28
  end
@@ -12,10 +12,17 @@ module Hyrax
12
12
  # Update the visibility of the work to match the correct state of the lease, then clear the lease date, etc.
13
13
  # Saves the lease and the work
14
14
  def destroy
15
- work.lease_visibility! # If the lease has lapsed, update the current visibility.
16
- work.deactivate_lease!
17
- work.lease.save!
18
- work.save!
15
+ case work
16
+ when Valkyrie::Resource
17
+ lease_manager = Hyrax::LeaseManager.new(resource: work)
18
+ lease_manager.release && Hyrax::AccessControlList(work).save
19
+ lease_manager.nullify
20
+ else
21
+ work.lease_visibility! # If the lease has lapsed, update the current visibility.
22
+ work.deactivate_lease!
23
+ work.lease.save!
24
+ work.save!
25
+ end
19
26
  end
20
27
  end
21
28
  end
@@ -104,7 +104,7 @@ Hyrax = {
104
104
  // On the edit work page
105
105
  new PermissionsControl($("#share"), 'tmpl-work-grant');
106
106
  // On the edit fileset page
107
- new PermissionsControl($("#permission"), 'tmpl-file-set-grant');
107
+ new PermissionsControl($("#permission"), 'tmpl-file-set-grant', { with_visibility_component: true });
108
108
  // On the batch edit page
109
109
  new PermissionsControl($("#form_permissions"), 'tmpl-work-grant');
110
110
  // On the edit collection page
@@ -1,10 +1,12 @@
1
1
  import CollectionUtilities from 'hyrax/collections_utils';
2
+ import Editor from 'hyrax/editor';
2
3
 
3
4
  export default class CollectionsV2 {
4
5
  constructor() {
5
6
  this.collectionUtilities = new CollectionUtilities();
6
7
  this.setupAddSharingHandler();
7
8
  this.sharingAddButtonDisabler();
9
+ this.setupEditor();
8
10
  }
9
11
 
10
12
  /**
@@ -54,4 +56,15 @@ export default class CollectionsV2 {
54
56
  )
55
57
  );
56
58
  }
59
+
60
+ /**
61
+ * Set up editor to enable Geonames autocomplete for Location data
62
+ * @return {void}
63
+ */
64
+ setupEditor() {
65
+ var element = $("[data-behavior='collection-form']");
66
+ if (element.length > 0) {
67
+ new Editor(element).init();
68
+ }
69
+ }
57
70
  }
@@ -1,6 +1,7 @@
1
1
  import { Registry } from './registry'
2
2
  import { UserControls } from './user_controls'
3
3
  import { GroupControls } from './group_controls'
4
+ import VisibilityComponent from '../save_work/visibility_component'
4
5
 
5
6
  export default class PermissionsControl {
6
7
  /**
@@ -8,7 +9,8 @@ export default class PermissionsControl {
8
9
  * @param {jQuery} element the jquery selector for the permissions container
9
10
  * @param {String} template_id the identifier of the template for the added elements
10
11
  */
11
- constructor(element, template_id) {
12
+ constructor(element, template_id, options = {}) {
13
+ const { with_visibility_component } = options
12
14
  if (element.length === 0) {
13
15
  return
14
16
  }
@@ -17,6 +19,11 @@ export default class PermissionsControl {
17
19
  this.registry = new Registry(this.element, this.object_name(), template_id)
18
20
  this.user_controls = new UserControls(this.element, this.registry)
19
21
  this.group_controls = new GroupControls(this.element, this.registry)
22
+ if (with_visibility_component) {
23
+ this.visibility_component = new VisibilityComponent(this.element)
24
+ } else {
25
+ this.visibility_component = null
26
+ }
20
27
  }
21
28
 
22
29
  // retrieve object_name the name of the object to create
@@ -41,9 +41,7 @@ module Hyrax
41
41
  private
42
42
 
43
43
  def presenter
44
- @presenter ||= begin
45
- presenter_class.new(curation_concern, current_ability)
46
- end
44
+ @presenter ||= presenter_class.new(curation_concern, current_ability)
47
45
  end
48
46
 
49
47
  def curation_concern
@@ -15,8 +15,8 @@ module Hyrax
15
15
  # Removes a single embargo
16
16
  def destroy
17
17
  Hyrax::Actors::EmbargoActor.new(curation_concern).destroy
18
- flash[:notice] = curation_concern.embargo_history.last
19
- if curation_concern.work? && curation_concern.file_sets.present?
18
+ flash[:notice] = embargo_history(curation_concern)
19
+ if curation_concern.work? && work_has_file_set_members?(curation_concern)
20
20
  redirect_to confirm_permission_path
21
21
  else
22
22
  redirect_to edit_embargo_path
@@ -60,10 +60,19 @@ module Hyrax
60
60
  end
61
61
 
62
62
  def edit
63
+ @curation_concern = Hyrax::Forms::WorkEmbargoForm.new(curation_concern).prepopulate! if
64
+ Hyrax.config.use_valkyrie?
63
65
  add_breadcrumb t(:'hyrax.controls.home'), root_path
64
66
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
65
67
  add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path
66
68
  add_breadcrumb t(:'hyrax.embargoes.edit.embargo_update'), '#'
67
69
  end
70
+
71
+ private
72
+
73
+ def embargo_history(concern)
74
+ concern.try(:embargo_history) ||
75
+ concern.try(:embargo)&.embargo_history
76
+ end
68
77
  end
69
78
  end
@@ -15,8 +15,8 @@ module Hyrax
15
15
  # Removes a single lease
16
16
  def destroy
17
17
  Hyrax::Actors::LeaseActor.new(curation_concern).destroy
18
- flash[:notice] = curation_concern.lease_history.last
19
- if curation_concern.work? && curation_concern.file_sets.present?
18
+ flash[:notice] = lease_history(curation_concern)&.last
19
+ if curation_concern.work? && work_has_file_set_members?(curation_concern)
20
20
  redirect_to confirm_permission_path
21
21
  else
22
22
  redirect_to edit_lease_path
@@ -51,10 +51,19 @@ module Hyrax
51
51
  end
52
52
 
53
53
  def edit
54
+ @curation_concern = Hyrax::Forms::WorkLeaseForm.new(curation_concern).prepopulate! if
55
+ Hyrax.config.use_valkyrie?
54
56
  add_breadcrumb t(:'hyrax.controls.home'), root_path
55
57
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
56
58
  add_breadcrumb t(:'hyrax.leases.index.manage_leases'), hyrax.leases_path
57
59
  add_breadcrumb t(:'hyrax.leases.edit.lease_update'), '#'
58
60
  end
61
+
62
+ private
63
+
64
+ def lease_history(concern)
65
+ concern.try(:lease_history) ||
66
+ concern.try(:lease)&.lease_history
67
+ end
59
68
  end
60
69
  end
@@ -6,7 +6,8 @@ module Hyrax
6
6
  included do
7
7
  attr_accessor :curation_concern
8
8
  helper_method :curation_concern
9
- load_and_authorize_resource class: ActiveFedora::Base, instance_name: :curation_concern
9
+ base_class = Hyrax.config.use_valkyrie? ? Hyrax::Resource : ActiveFedora::Base
10
+ load_and_authorize_resource class: base_class, instance_name: :curation_concern, except: [:index]
10
11
  end
11
12
 
12
13
  # This is an override of Hyrax::ApplicationController
@@ -15,5 +16,16 @@ module Hyrax
15
16
  end
16
17
 
17
18
  def edit; end
19
+
20
+ private
21
+
22
+ def work_has_file_set_members?(work)
23
+ case work
24
+ when Valkyrie::Resource
25
+ Hyrax.custom_queries.find_child_file_set_ids(resource: work).any?
26
+ else
27
+ work.file_sets.present?
28
+ end
29
+ end
18
30
  end
19
31
  end