Class: Hyrax::Transactions::Steps::EnsurePermissionTemplate
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::EnsurePermissionTemplate
- Includes:
- Dry::Transaction::Operation
- Defined in:
- lib/hyrax/transactions/steps/ensure_permission_template.rb
Overview
A ‘dry-transaction` step that ensures the input `work` has a permission template.
Instance Method Summary collapse
-
#call(work) ⇒ Dry::Monads::Result
‘Failure` if there is no `PermissionTemplate` for the input; `Success(input)`, otherwise.
Instance Method Details
#call(work) ⇒ Dry::Monads::Result
Returns ‘Failure` if there is no `PermissionTemplate` for the input; `Success(input)`, otherwise.
18 19 20 21 22 23 |
# File 'lib/hyrax/transactions/steps/ensure_permission_template.rb', line 18 def call(work) return Failure(:no_permission_template) unless Hyrax::PermissionTemplate.find_by(source_id: work.admin_set&.id) Success(work) end |