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

Version Path
hyrax-3.3.0 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.2.0 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.9.6 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.1.0 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.9.5 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.0.2 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.0.1 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.0.0 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.0.0.pre.rc4 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.9.4 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.0.0.pre.rc3 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.9.3 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.9.2 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.9.1 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.9.0 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-3.0.0.pre.rc2 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.8.0 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.7.2 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.7.1 lib/hyrax/transactions/steps/ensure_permission_template.rb
hyrax-2.7.0 lib/hyrax/transactions/steps/ensure_permission_template.rb