Sha256: 949b26ca5b3dadf3b5611c21ba05af1ea6a1a01a640bab24d496406b9a7b1953
Contents?: true
Size: 1.41 KB
Versions: 8
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module Hyrax module LeaseHelper def assets_with_expired_leases @assets_with_expired_leases ||= LeaseService.assets_with_expired_leases end def assets_under_lease @assets_under_lease ||= LeaseService.assets_under_lease end def assets_with_deactivated_leases @assets_with_deactivated_leases ||= LeaseService.assets_with_deactivated_leases end ## # @since 3.0.0 # # @param [Valkyrie::Resource, ActiveFedora::Base] resource # # @return [Boolean] whether the resource has an lease that is currently # enforced (regardless of whether it has expired) # # @note Hyrax::Forms::Failedsubmissionformwrapper is a place # holder until we switch to Valkyrie::ChangeSet instead of Form # objects def lease_enforced?(resource) # This is a guard; from the UI rendering perspective, there's no # active lease enforcement until the object is saved. return false unless resource.persisted? case resource when Hydra::AccessControls::Embargoable !resource.lease_expiration_date.nil? when HydraEditor::Form, Hyrax::Forms::FailedSubmissionFormWrapper lease_enforced?(resource.model) when Valkyrie::ChangeSet Hyrax::LeaseManager.new(resource: resource.model).enforced? else Hyrax::LeaseManager.new(resource: resource).enforced? end end end end
Version data entries
8 entries across 8 versions & 1 rubygems