Class: Hyrax::Transactions::Steps::ApplyPermissionTemplate
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::ApplyPermissionTemplate
- Includes:
- Dry::Transaction::Operation
- Defined in:
- lib/hyrax/transactions/steps/apply_permission_template.rb
Overview
A ‘dry-transcation` step that applies a permission template.
Instance Method Summary collapse
Instance Method Details
#call(work) ⇒ Dry::Monads::Result
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hyrax/transactions/steps/apply_permission_template.rb', line 16 def call(work) return Failure(:missing_permission) unless (template = work&.admin_set&.) Hyrax::PermissionTemplateApplicator.apply(template).to(model: work) Success(work) rescue ActiveRecord::RecordNotFound => err Failure(err) end |