Class: LeaseExpiryJob
- Inherits:
-
Hyrax::ApplicationJob
- Object
- ApplicationJob
- Hyrax::ApplicationJob
- LeaseExpiryJob
- Defined in:
- app/jobs/lease_expiry_job.rb
Instance Method Summary collapse
- #perform ⇒ Object
-
#records_with_expired_leases ⇒ Enumerator<String>
Ids for all the objects that have expired active leases.
Instance Method Details
#perform ⇒ Object
3 4 5 6 7 8 |
# File 'app/jobs/lease_expiry_job.rb', line 3 def perform records_with_expired_leases.each do |resource| Hyrax::LeaseManager.release_lease_for(resource: resource) && Hyrax::AccessControlList(resource).save end end |
#records_with_expired_leases ⇒ Enumerator<String>
Returns ids for all the objects that have expired active leases.
12 13 14 15 16 |
# File 'app/jobs/lease_expiry_job.rb', line 12 def records_with_expired_leases ids = Hyrax::LeaseService.assets_with_expired_leases.map(&:id) Hyrax.query_service.find_many_by_ids(ids: ids) end |