Class: Hyrax::Transactions::Steps::ApplyPermissionTemplate Deprecated

Inherits:
Object
  • Object
show all
Includes:
Dry::Transaction::Operation
Defined in:
lib/hyrax/transactions/steps/apply_permission_template.rb

Overview

Deprecated.

This is part of the legacy AF set of transaction steps for works. Transactions are not being used with AF works. This will be removed in 4.0.

A `dry-transcation` step that applies a permission template for a given work's AdminSet.

Since:

  • 2.4.0

Instance Method Summary collapse

Instance Method Details

#call(work) ⇒ Dry::Monads::Result

Parameters:

Returns:

  • (Dry::Monads::Result)

Since:

  • 2.4.0


19
20
21
22
23
24
25
26
27
28
# File 'lib/hyrax/transactions/steps/apply_permission_template.rb', line 19

def call(work)
  return Failure(:missing_permission) unless
    (template = work&.admin_set&.permission_template)

  Hyrax::PermissionTemplateApplicator.apply(template).to(model: work)

  Success(work)
rescue ActiveRecord::RecordNotFound => err
  Failure(err)
end