app/services/hyrax/embargo_service.rb in hyrax-5.0.0.rc1 vs app/services/hyrax/embargo_service.rb in hyrax-5.0.0.rc2

- old
+ new

@@ -1,25 +1,27 @@ # frozen_string_literal: true module Hyrax + ## + # Methods for Querying Repository to find Embargoed Objects class EmbargoService < RestrictionService class << self - # - # Methods for Querying Repository to find Embargoed Objects - # - # Returns all assets with embargo release date set to a date in the past - def assets_with_expired_embargoes + def assets_with_expired_enforced_embargoes builder = Hyrax::ExpiredEmbargoSearchBuilder.new(self) presenters(builder) end + alias assets_with_expired_embargoes assets_with_expired_enforced_embargoes - # Returns all assets with embargo release date set - # (assumes that when lease visibility is applied to assets - # whose leases have expired, the lease expiration date will be removed from its metadata) - def assets_under_embargo + ## + # Returns all assets with embargoes that are currently enforced, + # regardless of whether the embargoes are active or expired. + # + # @see Hyrax::EmbargoManager + def assets_with_enforced_embargoes builder = Hyrax::EmbargoSearchBuilder.new(self) - presenters(builder) + presenters(builder).select(&:enforced?) end + alias assets_under_embargo assets_with_enforced_embargoes # Returns all assets that have had embargoes deactivated in the past. def assets_with_deactivated_embargoes builder = Hyrax::DeactivatedEmbargoSearchBuilder.new(self) presenters(builder)