-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
limit embargo/lease date validation to create
introduce a wrapper for `Hydra::AccessControls::Embargoable` with less agressive validation behavior.
- Loading branch information
tamsin johnson
committed
May 7, 2021
1 parent
6adbe21
commit fb35690
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
module Hyrax | ||
module Embargoable | ||
included { include Hydra::AccessControls::Embargoable } | ||
|
||
validates :lease_expiration_date, 'hydra/future_date': true, on: :create | ||
validates :embargo_release_date, 'hydra/future_date': true, on: :create | ||
|
||
## | ||
# Override aggressive Hydra::AccessControls validation | ||
def enforce_future_date_for_embargo? | ||
false | ||
end | ||
|
||
## | ||
# Override aggressive Hydra::AccessControls validation | ||
def enforce_future_date_for_lease? | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters