Sha256: f31ccca8694024ab7c6ca80abe99bc845de739b6a4d487b1e22e1d7e3e4c551e

Contents?: true

Size: 527 Bytes

Versions: 22

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true
class LeaseExpiryJob < Hyrax::ApplicationJob
  def perform
    records_with_expired_leases.each do |resource|
      Hyrax::LeaseManager.release_lease_for(resource: resource) &&
        Hyrax::AccessControlList(resource).save
    end
  end

  ##
  # @return [Enumerator<String>] ids for all the objects that have expired active leases
  def records_with_expired_leases
    ids = Hyrax::LeaseService.assets_with_expired_leases.map(&:id)

    Hyrax.query_service.find_many_by_ids(ids: ids)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/jobs/lease_expiry_job.rb
hyrax-5.0.0 app/jobs/lease_expiry_job.rb
hyrax-5.0.0.rc3 app/jobs/lease_expiry_job.rb
hyrax-5.0.0.rc2 app/jobs/lease_expiry_job.rb
hyrax-5.0.0.rc1 app/jobs/lease_expiry_job.rb
hyrax-3.6.0 app/jobs/lease_expiry_job.rb
hyrax-4.0.0 app/jobs/lease_expiry_job.rb
hyrax-4.0.0.rc3 app/jobs/lease_expiry_job.rb
hyrax-4.0.0.rc2 app/jobs/lease_expiry_job.rb
hyrax-4.0.0.rc1 app/jobs/lease_expiry_job.rb
hyrax-3.5.0 app/jobs/lease_expiry_job.rb
hyrax-4.0.0.beta2 app/jobs/lease_expiry_job.rb
hyrax-3.4.2 app/jobs/lease_expiry_job.rb
hyrax-4.0.0.beta1 app/jobs/lease_expiry_job.rb
hyrax-3.4.1 app/jobs/lease_expiry_job.rb
hyrax-3.4.0 app/jobs/lease_expiry_job.rb
hyrax-3.3.0 app/jobs/lease_expiry_job.rb
hyrax-3.2.0 app/jobs/lease_expiry_job.rb
hyrax-3.1.0 app/jobs/lease_expiry_job.rb
hyrax-3.0.2 app/jobs/lease_expiry_job.rb