Sha256: 4e7e11534b10b7534d5a121ac8183ec75c55df4fa2cd1cc9afa8ef93bff76be5

Contents?: true

Size: 640 Bytes

Versions: 9

Compression:

Stored size: 640 Bytes

Contents

class VisibilityCopyJob < ActiveFedoraIdBasedJob
  queue_as :permissions

  def perform(id)
    @id = id
    work = object
    work.file_sets.each do |file|
      file.visibility = work.visibility # visibility must come first, because it can clear an embargo/lease
      if work.lease
        file.build_lease unless file.lease
        file.lease.attributes = work.lease.attributes.except('id')
        file.lease.save
      end
      if work.embargo
        file.build_embargo unless file.embargo
        file.embargo.attributes = work.embargo.attributes.except('id')
        file.embargo.save
      end
      file.save!
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
curation_concerns-0.10.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.9.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.8.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.7.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.6.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.5.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.4.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.3.0 app/jobs/visibility_copy_job.rb
curation_concerns-0.2.0 app/jobs/visibility_copy_job.rb