Skip to content

Embargos and Leases

Justin Coyne edited this page Jun 13, 2014 · 3 revisions

Definitions:

Lease
Access is restricted after an expiration date.
Embargo
Access is restricted until a release date.
Visibility
A group of users who may view or discover an object at a particular point in time.

Overview:

In Hydra leases and embargos that can go from an arbitrary visibility before the expiration/release to another visibility state.

Technical Problem:

It's hard to write a Solr query for object discovery that is aware of both lease and embargo with multiple possible before and after visibility states.

Solution:

In Hydra 7.1.0+ embargoes work like this:

In HydraRightsMetadata we encode only the intention of the lease or embargo.

  class MyWork < ActiveFedora::Base
    include Hydra::AccessControls::Embargoable
  end
  obj = MyWork.new
  obj.under_embargo? # => false
  obj.visibility_during_embargo = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
  obj.visibility_after_embargo = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
  obj.embargo_release_date = Date.today + 2
  obj.under_embargo? # => true

All access to an object is based on current group/user visibility. We have another method that applies the intention of the lease and embargo to the groups/users:

  obj.visibility # => "restricted"
  obj.embargo_visibility!
  obj.visibility # => "authenticated"

There is also a shorthand way of doing these steps:

  obj = MyWork.new
  obj.under_embargo? # => false
  obj.apply_embargo(Date.today + 2, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED,
                    Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)
  obj.under_embargo? # => true
  obj.visibility # => "authenticated"

There are methods to find digital objects that have expired leases or embargoes past their release date:

  with_expired_embargos = Hydra::EmbargoService.assets_with_expired_embargoes

On these objects with expired embargos, we can applies the intention of the recorded embargo by calling embargo_visibility! again:

  object_with_expired_embargo = with_expired_embargos.first
  object_with_expired_embargo.visibility #=> "authenticated"
  object_with_expired_embargo.embargo_visibility!
  object_with_expired_embargo.visibility #=> "open"

If you want to remove an embargo from an object you may call deactivate_embargo! This will record a human readable log message into the HydraRightsMetadata datastream:

  obj.deactivate_embargo!
  obj.embargo_history.last
  # => "An active embargo was deactivated on 2014-06-13.  Its release date was 2014-06-15T05:00:00+00:00.  Visibility during embargo was authenticated and intended visibility after embargo was open"
  obj.under_embargo? #=> false
Clone this wiki locally