Sha256: d25aa0f80c645189bc5f3e765bda61b53e296f742547e48a5ffd024bbd6a5455
Contents?: true
Size: 729 Bytes
Versions: 29
Compression:
Stored size: 729 Bytes
Contents
# frozen_string_literal: true module Hyrax module Transactions module Steps ## # A `dry-transaction` step that ensures the input `work` has a permission # template. # # @since 2.4.0 class EnsurePermissionTemplate include Dry::Transaction::Operation ## # @param [Hyrax::WorkBehavior] work # # @return [Dry::Monads::Result] `Failure` if there is no # `PermissionTemplate` for the input; `Success(input)`, otherwise. def call(work) return Failure(:no_permission_template) unless Hyrax::PermissionTemplate.find_by(source_id: work.admin_set&.id) Success(work) end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems