Class: InheritPermissionsJob
- Inherits:
-
Hyrax::ApplicationJob
- Object
- ActiveJob::Base
- Hyrax::ApplicationJob
- InheritPermissionsJob
- Defined in:
- app/jobs/inherit_permissions_job.rb
Overview
A job to apply work permissions to all contained files set
Instance Method Summary collapse
-
#perform(work) ⇒ Object
Perform the copy from the work to the contained filesets.
Instance Method Details
#perform(work) ⇒ Object
Perform the copy from the work to the contained filesets
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/jobs/inherit_permissions_job.rb', line 7 def perform(work) work.file_sets.each do |file| attribute_map = work..map(&:to_hash) # copy and removed access to the new access with the delete flag file..map(&:to_hash).each do |perm| unless attribute_map.include?(perm) perm[:_destroy] = true attribute_map << perm end end # apply the new and deleted attributes file. = attribute_map file.save! end end |