Sha256: 723ad29a43c0dda50e038a788f91c655bf39b83f33663f91163aee2a021333d2

Contents?: true

Size: 904 Bytes

Versions: 18

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

namespace :hyrax do
  namespace :embargo do
    desc 'Deactivate embargoes for which the lift date has past'
    task deactivate_expired: :environment do
      ids = Hyrax::EmbargoService.assets_with_expired_embargoes.map(&:id)

      Hyrax.query_service.find_many_by_ids(ids: ids).each do |resource|
        Hyrax::EmbargoManager.release_embargo_for(resource: resource) &&
          Hyrax::AccessControlList(resource).save
      end
    end
  end

  namespace :lease do
    desc 'Deactivate leases for which the expiration date has past'
    task deactivate_expired: :environment do
      ids = Hyrax::LeaseService.assets_with_expired_leases.map(&:id)

      Hyrax.query_service.find_many_by_ids(ids: ids).each do |resource|
        Hyrax::LeaseManager.release_lease_for(resource: resource) &&
          Hyrax::AccessControlList(resource).save
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hyrax-5.0.0.rc1 lib/tasks/embargo_lease.rake
hyrax-3.6.0 lib/tasks/embargo_lease.rake
hyrax-4.0.0 lib/tasks/embargo_lease.rake
hyrax-4.0.0.rc3 lib/tasks/embargo_lease.rake
hyrax-4.0.0.rc2 lib/tasks/embargo_lease.rake
hyrax-4.0.0.rc1 lib/tasks/embargo_lease.rake
hyrax-3.5.0 lib/tasks/embargo_lease.rake
hyrax-4.0.0.beta2 lib/tasks/embargo_lease.rake
hyrax-3.4.2 lib/tasks/embargo_lease.rake
hyrax-4.0.0.beta1 lib/tasks/embargo_lease.rake
hyrax-3.4.1 lib/tasks/embargo_lease.rake
hyrax-3.4.0 lib/tasks/embargo_lease.rake
hyrax-3.3.0 lib/tasks/embargo_lease.rake
hyrax-3.2.0 lib/tasks/embargo_lease.rake
hyrax-3.1.0 lib/tasks/embargo_lease.rake
hyrax-3.0.2 lib/tasks/embargo_lease.rake
hyrax-3.0.1 lib/tasks/embargo_lease.rake
hyrax-3.0.0 lib/tasks/embargo_lease.rake