Class: Hyrax::PropagateChangeDepositorJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- ApplicationJob
- Hyrax::PropagateChangeDepositorJob
- Defined in:
- app/jobs/hyrax/propagate_change_depositor_job.rb
Overview
updates depositor on file sets and resets permissions if flagged. Used by ChangeDepositorService to background changes to lots of file sets
Instance Method Summary collapse
Instance Method Details
#apply_depositor_metadata(resource, depositor) ⇒ Object
26 27 28 29 30 |
# File 'app/jobs/hyrax/propagate_change_depositor_job.rb', line 26 def (resource, depositor) depositor_id = depositor.respond_to?(:user_key) ? depositor.user_key : depositor resource.depositor = depositor_id if resource.respond_to? :depositor= Hyrax::AccessControlList.new(resource: resource).grant(:edit).to(::User.find_by_user_key(depositor_id)).save end |
#perform(work_id, user, reset) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/jobs/hyrax/propagate_change_depositor_job.rb', line 14 def perform(work_id, user, reset) work = Hyrax.query_service.find_by(id: work_id) Hyrax.custom_queries.find_child_file_sets(resource: work).each do |f| if reset f..acl. = [] f..acl.save end (f, user) Hyrax.persister.save(resource: f) end end |