Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work edit forms list works as under embargo/lease after expiration #4299

Closed
no-reply opened this issue May 6, 2020 · 2 comments
Closed

Work edit forms list works as under embargo/lease after expiration #4299

no-reply opened this issue May 6, 2020 · 2 comments

Comments

@no-reply
Copy link
Contributor

no-reply commented May 6, 2020

Descriptive summary

When building Work forms, Hyrax displays the Embargo or Lease permissions edit partials instead of the usual edit partials whenever an embargo/lease with a release date is present. This means users can never edit visibility for an expired/released embargo.

Rationale

This issue prevents users from editing visibility for works previously under embargo.

Expected behavior

Works should allow normal permission editing after the embargo expires.

Actual behavior

The edit work page keeps the work "under embargo" forever:

embargo-edit

Steps to reproduce the behavior

  1. Find a work with an embargo or lease in the past
  2. Attempt to edit work visibility
@no-reply
Copy link
Contributor Author

no-reply commented May 6, 2020

It turns out that it's possible to deactivate the embargo, and then you get the form back.

The misleading thing here is that the view code relies on some very specific Hydra::AccessControls behavior that results in the embargo release date being removed from the embargo object when it's deactivated: https://github.com/samvera/hydra-head/blob/4ffa873d713a418e03d81688d18948595951ae1d/hydra-access-controls/app/models/hydra/access_controls/embargo.rb#L22

The view should really not rely on this, and probably Embargo#active? is misleading since it returns false when the release date is in the past, even if the embargo is active as seen above!

@no-reply
Copy link
Contributor Author

no-reply commented May 6, 2020

# here is an embargo with a release date in the future. it's "active" and at some
# point in the future we'll need to "deactivate" it.
embargo
# => #<Hydra::AccessControls::Embargo id: nil, visibility_during_embargo: "restricted", visibility_after_embargo: "open", embargo_release_date: "2020-05-07 00:00:00", embargo_history: []>

# this embargo is active, because it has a release date, and that date is in
# the future.
embargo.active?
# => true

# if we set the date to the past, it's no longer "active"
embargo.embargo_release_date = Date.today - 1
# => Tue, 05 May 2020
embargo.active?
# => false

# but the embargo is still in force! it will remain in force until it's "deactivated"
# (even though it's already `#active? => false`!).
# how do i know the embargo is in force(?) and needs to be deactivated?
# the way we actually check this all over the code base is to check for
# the presence of a embargo release date. if there's *any* date.
# `#active?` won't tell you this.
embargo.deactivate!
# => ["An expired embargo was deactivated on 2020-05-06.  Its release date was 2020-05-05.  Visibility during embargo was restricted and intended visibility after embargo was open"]

can we do better?

let's at least name these different things? active? vs. current?/enforced?/???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant