Class: Hyrax::Lease

Inherits:
Valkyrie::Resource
  • Object
show all
Defined in:
app/models/hyrax/lease.rb

Overview

Note:

Embargo and Lease can, in principle, be collapsed into a single model with a #visibility_during, #visibility_after, #end_date, and #history. We haven’t made this transition in order to simplify legacy support for Hydra::AccessControls.

The Valkyrie model for leases.

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Fix releasing leases on the day they are expired - this solves a 1 second bug around how midnights are calculated, which causes day of leases to incorrectly set the permissions to private

Returns:

  • (Boolean)


19
20
21
# File 'app/models/hyrax/lease.rb', line 19

def active?
  (lease_expiration_date.present? && Time.zone.today.end_of_day < lease_expiration_date)
end