Class: VisibilityCopyJob

Inherits:
Hyrax::ApplicationJob show all
Defined in:
app/jobs/visibility_copy_job.rb

Overview

Responsible for copying the following attributes from the work to each file in the file_sets

  • visibility

  • lease

  • embargo

Instance Method Summary collapse

Instance Method Details

#perform(work) ⇒ Object

Parameters:

  • work (#file_sets, #visibility, #lease, #embargo)
    • a Work model



9
10
11
12
13
14
15
16
# File 'app/jobs/visibility_copy_job.rb', line 9

def perform(work)
  work.file_sets.each do |file|
    file.visibility = work.visibility # visibility must come first, because it can clear an embargo/lease
    copy_visibility_modifier(work: work, file: file, modifier: :lease)
    copy_visibility_modifier(work: work, file: file, modifier: :embargo)
    file.save!
  end
end