Class: Hyrax::Transactions::Steps::ApplyCollectionPermissionTemplate
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::ApplyCollectionPermissionTemplate
- Includes:
- Dry::Transaction::Operation
- Defined in:
- lib/hyrax/transactions/steps/apply_collection_permission_template.rb
Overview
A ‘dry-transcation` step that applies permission templates for a set of collections on a given work.
Instance Method Summary collapse
Instance Method Details
#call(work, collections: []) ⇒ Dry::Monads::Result
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/hyrax/transactions/steps/apply_collection_permission_template.rb', line 19 def call(work, collections: []) collections.each do |collection| template = Hyrax::PermissionTemplate.find_by!(source_id: collection.id) Hyrax::PermissionTemplateApplicator.apply(template).to(model: work) end Success(work) rescue ActiveRecord::RecordNotFound => err Failure(err) end |