hyrax 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +19 -8
  3. data/.dassie/config/role_map.yml +2 -0
  4. data/.dassie/db/seeds.rb +1 -1
  5. data/.env +1 -1
  6. data/CONTAINERS.md +20 -0
  7. data/app/actors/hyrax/actors/file_set_actor.rb +10 -5
  8. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +0 -4
  9. data/app/forms/hyrax/forms/resource_form.rb +11 -1
  10. data/app/helpers/hyrax/dashboard_helper_behavior.rb +20 -5
  11. data/app/helpers/hyrax/embargo_helper.rb +4 -0
  12. data/app/helpers/hyrax/lease_helper.rb +4 -0
  13. data/app/helpers/hyrax/url_helper.rb +4 -1
  14. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +2 -0
  15. data/app/indexers/hyrax/valkyrie_work_indexer.rb +1 -1
  16. data/app/jobs/ingest_local_file_job.rb +18 -2
  17. data/app/models/collection_branding_info.rb +25 -9
  18. data/app/models/concerns/hyrax/embargoable.rb +24 -0
  19. data/app/models/concerns/hyrax/work_behavior.rb +1 -1
  20. data/app/presenters/hyrax/admin_set_options_presenter.rb +13 -1
  21. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +119 -0
  22. data/app/presenters/hyrax/work_show_presenter.rb +5 -1
  23. data/app/search_builders/hyrax/collection_member_search_builder.rb +6 -1
  24. data/app/search_builders/hyrax/my/collections_search_builder.rb +1 -1
  25. data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +1 -1
  26. data/app/search_builders/hyrax/single_collection_search_builder.rb +1 -1
  27. data/app/services/hyrax/contextual_path.rb +1 -1
  28. data/app/services/hyrax/edit_permissions_service.rb +47 -21
  29. data/app/services/hyrax/find_objects_via_solr_service.rb +27 -0
  30. data/app/services/hyrax/multiple_membership_checker.rb +6 -2
  31. data/app/services/hyrax/solr_query_builder_service.rb +17 -3
  32. data/app/services/hyrax/visibility_intention.rb +20 -2
  33. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
  34. data/app/views/hyrax/base/_form_visibility_error.html.erb +2 -0
  35. data/app/views/hyrax/base/_guts4form.html.erb +1 -1
  36. data/app/views/hyrax/base/_show_actions.html.erb +1 -1
  37. data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
  38. data/app/views/hyrax/batch_uploads/_form.html.erb +1 -1
  39. data/bin/db-migrate-seed.sh +3 -1
  40. data/bin/hyrax-entrypoint.sh +0 -14
  41. data/bin/solrcloud-assign-configset.sh +5 -0
  42. data/bin/solrcloud-upload-configset.sh +14 -5
  43. data/chart/hyrax/Chart.yaml +8 -4
  44. data/chart/hyrax/README.md +5 -4
  45. data/chart/hyrax/templates/_helpers.tpl +14 -0
  46. data/chart/hyrax/templates/branding-pvc.yaml +2 -2
  47. data/chart/hyrax/templates/configmap-env.yaml +7 -1
  48. data/chart/hyrax/templates/deployment-worker.yaml +39 -5
  49. data/chart/hyrax/templates/deployment.yaml +42 -0
  50. data/chart/hyrax/templates/derivatives-pvc.yaml +2 -2
  51. data/chart/hyrax/templates/ingress.yaml +13 -4
  52. data/chart/hyrax/templates/secrets.yaml +8 -0
  53. data/chart/hyrax/templates/uploads-pvc.yaml +2 -2
  54. data/chart/hyrax/values.yaml +71 -1
  55. data/config/initializers/valkryrie_storage.rb +7 -0
  56. data/docker-compose.yml +38 -8
  57. data/documentation/developing-your-hyrax-based-app.md +3 -3
  58. data/documentation/legacyREADME.md +4 -4
  59. data/lib/hyrax/configuration.rb +12 -0
  60. data/lib/hyrax/engine.rb +1 -0
  61. data/lib/hyrax/resource_name.rb +1 -0
  62. data/lib/hyrax/specs/capybara.rb +2 -2
  63. data/lib/hyrax/valkyrie_simple_path_generator.rb +20 -0
  64. data/lib/hyrax/version.rb +1 -1
  65. data/lib/wings.rb +0 -21
  66. data/lib/wings/active_fedora_converter/default_work.rb +15 -0
  67. data/lib/wings/model_transformer.rb +17 -1
  68. data/lib/wings/setup.rb +1 -0
  69. data/template.rb +1 -1
  70. metadata +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '081daeb5064ca757527e98cfbbea41846b8a15440a26a2d152b1ad7a1c7f395b'
4
- data.tar.gz: 70e52823ff8ef7546510db08f28c22207488952f146be3bb63b9ecba440ebb81
3
+ metadata.gz: 83e192b584ccacb1817682f20c3f92863142dcd6bb0f5cf3ad94510c9bfd8b6e
4
+ data.tar.gz: 0f4e5459438aa41d335cad94e3c4fa9167d5dbc7eb52323cbb56a532e91c76a3
5
5
  SHA512:
6
- metadata.gz: a36054d54da990c0ea0ab03ce538a903ceed121026e1ac160b1dc2226a21fc12a8b8d422d99b71e545048af33318ab86ae90e8e3a906b6bcb1061983059ac4d4
7
- data.tar.gz: 5b8b6759915c77982125b0c33b6f8681dd7ea61c0cce63b0665567fd00e47be468d097e6653cdfd65df5db35ff1ac4f01c98cb39b12d774c741b8cd6ff086e1a
6
+ metadata.gz: bc71e039869a7b368cdeb864333683d3b9079fb2d4191d70c8bbdb1cd32c8686060814846590d5b418321c9f57b28ab8b35989a86b02282453761a2c90d26467
7
+ data.tar.gz: 6540b1bcb3b98e523cf5d1790ca160ccb39a1cc0ecec77e2747205727c699710cb67f063fafd3030f8433b8ce0ce85ecc3b075a8e744ad5a8519a8a61ecd4e34
data/.circleci/config.yml CHANGED
@@ -12,7 +12,7 @@ jobs:
12
12
  default: 1.17.3
13
13
  rails_version:
14
14
  type: string
15
- default: '5.2.2'
15
+ default: '5.2.6'
16
16
  executor:
17
17
  name: 'samvera/ruby'
18
18
  ruby_version: << parameters.ruby_version >>
@@ -22,6 +22,17 @@ jobs:
22
22
  NOKOGIRI_USE_SYSTEM_LIBRARIES: true
23
23
  steps:
24
24
  - samvera/cached_checkout
25
+
26
+ - run:
27
+ name: Check for a branch named 'master'
28
+ command: |
29
+ git fetch --all --quiet --prune --prune-tags
30
+ if [[ -n "$(git branch --all --list master */master)" ]]; then
31
+ echo "A branch named 'master' was found. Please remove it."
32
+ echo "$(git branch --all --list master */master)"
33
+ fi
34
+ [[ -z "$(git branch --all --list master */master)" ]]
35
+
25
36
  - samvera/bundle_for_gem:
26
37
  ruby_version: << parameters.ruby_version >>
27
38
  bundler_version: << parameters.bundler_version >>
@@ -63,7 +74,7 @@ jobs:
63
74
  default: 1.17.3
64
75
  rails_version:
65
76
  type: string
66
- default: '5.2.2'
77
+ default: '5.2.6'
67
78
  executor:
68
79
  name: 'samvera/ruby_fcrepo_solr_redis_postgres'
69
80
  ruby_version: << parameters.ruby_version >>
@@ -131,10 +142,10 @@ workflows:
131
142
  jobs:
132
143
  - bundle:
133
144
  ruby_version: "2.5.8"
134
- rails_version: "5.2.4.3"
145
+ rails_version: "5.2.6"
135
146
  - build:
136
147
  ruby_version: "2.5.8"
137
- rails_version: "5.2.4.3"
148
+ rails_version: "5.2.6"
138
149
  requires:
139
150
  - bundle
140
151
  - test:
@@ -146,10 +157,10 @@ workflows:
146
157
  jobs:
147
158
  - bundle:
148
159
  ruby_version: "2.6.6"
149
- rails_version: "5.2.4.3"
160
+ rails_version: "5.2.6"
150
161
  - build:
151
162
  ruby_version: "2.6.6"
152
- rails_version: "5.2.4.3"
163
+ rails_version: "5.2.6"
153
164
  requires:
154
165
  - bundle
155
166
  - test:
@@ -167,11 +178,11 @@ workflows:
167
178
  jobs:
168
179
  - bundle:
169
180
  ruby_version: "2.7.2"
170
- rails_version: "5.2.4.3"
181
+ rails_version: "5.2.6"
171
182
  bundler_version: "2.1.4"
172
183
  - build:
173
184
  ruby_version: "2.7.2"
174
- rails_version: "5.2.4.3"
185
+ rails_version: "5.2.6"
175
186
  bundler_version: "2.1.4"
176
187
  requires:
177
188
  - bundle
@@ -1,4 +1,6 @@
1
1
  development:
2
+ admin:
3
+ - admin@example.com
2
4
  archivist:
3
5
  - archivist1@example.com
4
6
 
data/.dassie/db/seeds.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
7
  # Character.create(name: 'Luke', movie: movies.first)
8
8
 
9
- Hyrax::Engine.load_seed
9
+ Hyrax::Engine.load_seed unless ActiveModel::Type::Boolean.new.cast(ENV["SKIP_HYRAX_ENGINE_SEED"])
10
10
 
11
11
  puts "\n== Loading users"
12
12
  User.where(email: 'admin@example.com').first_or_create do |f|
data/.env CHANGED
@@ -7,7 +7,7 @@ DB_PORT=5432
7
7
  DB_HOST=postgres
8
8
  FCREPO_PORT=8080
9
9
  FCREPO_HOST=fcrepo
10
- FCREPO_REST_PATH=fcrepo/rest
10
+ FCREPO_REST_PATH=rest
11
11
  FCREPO_TEST_BASE_PATH=/test
12
12
  HUB_URL=http://chrome:4444/wd/hub
13
13
  HYRAX_DERIVATIVES_PATH=/app/samvera/hyrax-webapp/derivatives/
data/CONTAINERS.md CHANGED
@@ -107,6 +107,26 @@ I (Jeremy) find myself wanting to debug the application. This requires a somewh
107
107
 
108
108
  This advice comes from [Debugging Rails App With Docker Compose: How to use Byebug in a dockerized rails app](https://medium.com/gogox-technology/debugging-rails-app-with-docker-compose-39a3767962f4).
109
109
 
110
+ ### Troubleshooting
111
+
112
+ #### Bad Address SOLR
113
+
114
+ With `docker-compose up` running, if you see the following, then there may be issues with file permissions:
115
+
116
+ ```
117
+ db_migrate_1 | waiting for solr:8983
118
+ db_migrate_1 | nc: bad address 'solr'
119
+ ```
120
+
121
+ Check the Docker application logs and look for permission errors:
122
+
123
+ ```
124
+ Executing /opt/docker-solr/scripts/precreate-core hyrax_test /opt/solr/server/configsets/hyraxconf
125
+ cp: cannot create directory '/var/solr/data/hyrax_test': Permission denied
126
+ ```
127
+
128
+ The solution that appears to work is to `docker-compose down --volumes`; This will tear down the docker instance, and remove the volumes. You can then run `docker-compose up` to get back to work. _**Note:** the `--volumes` switch will remove all custom data._
129
+
110
130
  <!-- NOTE: This title is referenced in the top-level documentation/developing-your-hyrax-based-app.md. Keep that in mind if you change it. -->
111
131
  ## Docker Image for Hyrax-based Applications
112
132
 
@@ -31,10 +31,9 @@ module Hyrax
31
31
  # hand. Do this because we don't have the underlying UploadedFile instance
32
32
  file_actor = build_file_actor(relation)
33
33
  file_actor.ingest_file(wrapper!(file: file, relation: relation))
34
- # Copy visibility and permissions from parent (work) to
35
- # FileSets even if they come in from BrowseEverything
36
- VisibilityCopyJob.perform_later(file_set.parent)
37
- InheritPermissionsJob.perform_later(file_set.parent)
34
+ parent = parent_for(file_set: file_set)
35
+ VisibilityCopyJob.perform_later(parent)
36
+ InheritPermissionsJob.perform_later(parent)
38
37
  else
39
38
  IngestJob.perform_later(wrapper!(file: file, relation: relation))
40
39
  end
@@ -138,6 +137,12 @@ module Hyrax
138
137
  @ability ||= ::Ability.new(user)
139
138
  end
140
139
 
140
+ # @param file_set [FileSet]
141
+ # @return [ActiveFedora::Base]
142
+ def parent_for(file_set:)
143
+ file_set.parent
144
+ end
145
+
141
146
  def build_file_actor(relation)
142
147
  fs = use_valkyrie ? file_set.valkyrie_resource : file_set
143
148
  file_actor_class.new(fs, relation, user, use_valkyrie: use_valkyrie)
@@ -179,7 +184,7 @@ module Hyrax
179
184
  # Although ActiveFedora clears the children nodes it leaves those fields in Solr populated.
180
185
  # rubocop:disable Metrics/CyclomaticComplexity
181
186
  def unlink_from_work
182
- work = file_set.parent
187
+ work = parent_for(file_set: file_set)
183
188
  return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))
184
189
  work.thumbnail = nil if work.thumbnail_id == file_set.id
185
190
  work.representative = nil if work.representative_id == file_set.id
@@ -30,10 +30,6 @@ module Hyrax
30
30
  false
31
31
  end
32
32
 
33
- def update_access(manage_changed:)
34
- permission_template_form.update_access(manage_changed: manage_changed)
35
- end
36
-
37
33
  def after_destroy_success
38
34
  if source.admin_set?
39
35
  redirect_to hyrax.edit_admin_admin_set_path(source_id,
@@ -91,7 +91,12 @@ module Hyrax
91
91
  property :date_uploaded, readable: false
92
92
  property :agreement_accepted, virtual: true, default: false, prepopulator: ->(_opts) { self.agreement_accepted = !model.new_record }
93
93
 
94
- collection :permissions, virtual: true, default: [], form: Permission, prepopulator: ->(_opts) { self.permissions = Hyrax::AccessControl.for(resource: model).permissions }
94
+ collection(:permissions,
95
+ virtual: true,
96
+ default: [],
97
+ form: Permission,
98
+ populator: :permission_populator,
99
+ prepopulator: ->(_opts) { self.permissions = Hyrax::AccessControl.for(resource: model).permissions })
95
100
 
96
101
  # virtual properties for embargo/lease;
97
102
  property :embargo_release_date, virtual: true, prepopulator: ->(_opts) { self.embargo_release_date = model.embargo&.embargo_release_date }
@@ -201,6 +206,11 @@ module Hyrax
201
206
 
202
207
  private
203
208
 
209
+ # https://trailblazer.to/2.1/docs/reform.html#reform-populators-populator-collections
210
+ def permission_populator(collection:, index:, **)
211
+ Permission.new(collection[index])
212
+ end
213
+
204
214
  def _form_field_definitions
205
215
  self.class.definitions
206
216
  end
@@ -7,25 +7,40 @@ module Hyrax
7
7
 
8
8
  # @param user [User]
9
9
  # @param where [Hash] applied as the where clause when querying the Hyrax::WorkRelation
10
- #
10
+ # @return [Integer] number of works matching the where that the user deposited
11
11
  # @see Hyrax::WorkRelation
12
12
  def number_of_works(user = current_user, where: { generic_type_sim: "Work" })
13
- where_clause = where.merge(DepositSearchBuilder.depositor_field => user.user_key)
14
- Hyrax::WorkRelation.new.where(where_clause).count
13
+ field_pairs = field_pairs(user)
14
+ field_pairs.merge!(where)
15
+ count(Hyrax::SolrQueryBuilderService.construct_query(field_pairs))
15
16
  rescue RSolr::Error::ConnectionRefused
16
17
  'n/a'
17
18
  end
18
19
 
20
+ # @param user [User]
21
+ # @return [Integer] number of FileSets the user deposited
19
22
  def number_of_files(user = current_user)
20
- ::FileSet.where(DepositSearchBuilder.depositor_field => user.user_key).count
23
+ count(Hyrax::SolrQueryBuilderService.construct_query_for_model(::FileSet, field_pairs(user)))
21
24
  rescue RSolr::Error::ConnectionRefused
22
25
  'n/a'
23
26
  end
24
27
 
28
+ # @param user [User]
29
+ # @return [Integer] number of Collections the user created
25
30
  def number_of_collections(user = current_user)
26
- ::Collection.where(DepositSearchBuilder.depositor_field => user.user_key).count
31
+ count(Hyrax::SolrQueryBuilderService.construct_query_for_model(::Collection, field_pairs(user)))
27
32
  rescue RSolr::Error::ConnectionRefused
28
33
  'n/a'
29
34
  end
35
+
36
+ private
37
+
38
+ def field_pairs(user)
39
+ { DepositSearchBuilder.depositor_field => user.user_key }
40
+ end
41
+
42
+ def count(query)
43
+ Hyrax::SolrService.count(query)
44
+ end
30
45
  end
31
46
  end
@@ -25,6 +25,10 @@ module Hyrax
25
25
  # holder until we switch to Valkyrie::ChangeSet instead of Form
26
26
  # objects
27
27
  def embargo_enforced?(resource)
28
+ # This is a guard; from the UI rendering perspective, there's no
29
+ # active embargo enforcement until the object is saved.
30
+ return false unless resource.persisted?
31
+
28
32
  case resource
29
33
  when Hydra::AccessControls::Embargoable
30
34
  !resource.embargo_release_date.nil?
@@ -25,6 +25,10 @@ module Hyrax
25
25
  # holder until we switch to Valkyrie::ChangeSet instead of Form
26
26
  # objects
27
27
  def lease_enforced?(resource)
28
+ # This is a guard; from the UI rendering perspective, there's no
29
+ # active lease enforcement until the object is saved.
30
+ return false unless resource.persisted?
31
+
28
32
  case resource
29
33
  when Hydra::AccessControls::Embargoable
30
34
  !resource.lease_expiration_date.nil?
@@ -4,7 +4,10 @@ module Hyrax
4
4
  # generated models get registered as curation concerns and need a
5
5
  # track_model_path to render Blacklight-related views
6
6
  (['FileSet', 'Collection'] + Hyrax.config.registered_curation_concern_types).each do |concern|
7
- define_method("track_#{concern.constantize.model_name.singular_route_key}_path") { |*args| main_app.track_solr_document_path(*args) }
7
+ model = concern.safe_constantize
8
+ model_name = model.respond_to?(:model_name) && model.model_name
9
+ next unless model_name
10
+ define_method("track_#{model_name.singular_route_key}_path") { |*args| main_app.track_solr_document_path(*args) }
8
11
  end
9
12
  end
10
13
  end
@@ -14,6 +14,8 @@ module Hyrax
14
14
 
15
15
  def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
16
16
  super.tap do |solr_doc| # rubocop:disable Metrics/BlockLength
17
+ solr_doc['generic_type_si'] = 'FileSet'
18
+
17
19
  # Metadata from the FileSet
18
20
  solr_doc['file_ids_ssim'] = resource.file_ids&.map(&:to_s)
19
21
  solr_doc['original_file_id_ssi'] = resource.original_file_id.to_s
@@ -11,7 +11,7 @@ module Hyrax
11
11
 
12
12
  def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
13
13
  super.tap do |solr_doc|
14
- solr_doc['generic_type_sim'] = ['Work']
14
+ solr_doc['generic_type_si'] = 'Work'
15
15
  solr_doc['suppressed_bsi'] = suppressed?(resource)
16
16
  solr_doc['admin_set_id_ssim'] = [resource.admin_set_id.to_s]
17
17
  solr_doc['member_of_collection_ids_ssim'] = resource.member_of_collection_ids.map(&:to_s)
@@ -2,13 +2,29 @@
2
2
  class IngestLocalFileJob < Hyrax::ApplicationJob
3
3
  queue_as Hyrax.config.ingest_queue_name
4
4
 
5
- # @param [FileSet] file_set
5
+ # @param [FileSet, Hyrax::FileSet] file_set
6
6
  # @param [String] path
7
7
  # @param [User] user
8
8
  def perform(file_set, path, user)
9
+ case file_set
10
+ when ActiveFedora::Base
11
+ __perform(file_set, path, user, use_valkyrie: false)
12
+ else
13
+ __perform(file_set, path, user, use_valkyrie: true)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ # @note Based on the present implementation (see SHA a8597884e) of
20
+ # the Hyrax::Actors::FileSetActor, we wouldn't need to pass the
21
+ # `use_valkyrie` parameter. However, I want to include this logic
22
+ # to demonstrate that "Yes, the IngestLocalFileJob has been tested
23
+ # for Valkyrie usage"
24
+ def __perform(file_set, path, user, use_valkyrie:)
9
25
  file_set.label ||= File.basename(path)
10
26
 
11
- actor = Hyrax::Actors::FileSetActor.new(file_set, user)
27
+ actor = Hyrax::Actors::FileSetActor.new(file_set, user, use_valkyrie: use_valkyrie)
12
28
 
13
29
  if actor.create_content(File.open(path))
14
30
  Hyrax.config.callback.run(:after_import_local_file_success, file_set, user, path, warn: false)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  class CollectionBrandingInfo < ApplicationRecord
3
- # i = ColectionImageInfo.new()
4
-
5
3
  def initialize(collection_id:,
6
4
  filename:,
7
5
  role:,
@@ -13,20 +11,32 @@ class CollectionBrandingInfo < ApplicationRecord
13
11
  self.role = role
14
12
  self.alt_text = alt_txt
15
13
  self.target_url = target_url
16
-
17
- self.local_path = find_local_filename(collection_id, role, filename)
14
+ self.local_path = File.join(role, filename)
18
15
  end
19
16
 
20
17
  def save(file_location, copy_file = true)
21
- local_dir = find_local_dir_name(collection_id, role)
22
- FileUtils.mkdir_p local_dir
23
- FileUtils.cp file_location, local_path unless file_location == local_path || !copy_file
18
+ filename = File.split(local_path).last
19
+ role_and_filename = File.join(role, filename)
20
+
21
+ storage.upload(resource: Hyrax::PcdmCollection.new(id: collection_id),
22
+ file: File.open(file_location),
23
+ original_filename: role_and_filename)
24
+ self.local_path = find_local_filename(collection_id, role, filename)
25
+
24
26
  FileUtils.remove_file(file_location) if File.exist?(file_location) && copy_file
25
27
  super()
26
28
  end
27
29
 
28
- def delete(location_path)
29
- FileUtils.remove_file(location_path) if File.exist?(location_path)
30
+ def delete(location_path = nil)
31
+ id = if location_path
32
+ Deprecation.warn('Passing an explict location path is ' \
33
+ 'deprecated. Call without arguments instead.')
34
+ location_path
35
+ else
36
+ local_path
37
+ end
38
+
39
+ storage.delete(id: id)
30
40
  end
31
41
 
32
42
  def find_local_filename(collection_id, role, filename)
@@ -37,4 +47,10 @@ class CollectionBrandingInfo < ApplicationRecord
37
47
  def find_local_dir_name(collection_id, role)
38
48
  File.join(Hyrax.config.branding_path, collection_id.to_s, role.to_s)
39
49
  end
50
+
51
+ private
52
+
53
+ def storage
54
+ Hyrax.config.branding_storage_adapter
55
+ end
40
56
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ module Hyrax
3
+ module Embargoable
4
+ extend ActiveSupport::Concern
5
+ include Hydra::AccessControls::Embargoable
6
+
7
+ included do
8
+ validates :lease_expiration_date, 'hydra/future_date': true, on: :create
9
+ validates :embargo_release_date, 'hydra/future_date': true, on: :create
10
+ end
11
+
12
+ ##
13
+ # Override aggressive Hydra::AccessControls validation
14
+ def enforce_future_date_for_embargo?
15
+ false
16
+ end
17
+
18
+ ##
19
+ # Override aggressive Hydra::AccessControls validation
20
+ def enforce_future_date_for_lease?
21
+ false
22
+ end
23
+ end
24
+ end
@@ -14,7 +14,7 @@ module Hyrax
14
14
  include Naming
15
15
  include CoreMetadata
16
16
  include InAdminSet
17
- include Hydra::AccessControls::Embargoable
17
+ include Hyrax::Embargoable
18
18
  include GlobalID::Identification
19
19
  include NestedWorks
20
20
  include Suppressible