Class: Hyrax::Transactions::Steps::SaveAccessControl

Inherits:
Object
  • Object
show all
Defined in:
lib/hyrax/transactions/steps/save_access_control.rb

Overview

Saves the Hyrax::AccessControlList for any resource with a `#permission_manager`. If `#permission_manager` is undefined, succeeds.

Instance Method Summary collapse

Instance Method Details

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

Parameters:

  • obj (Valkyrie::Resource)

Returns:

  • (Dry::Monads::Result)

Since:

  • 2.4.0


19
20
21
22
23
24
25
# File 'lib/hyrax/transactions/steps/save_access_control.rb', line 19

def call(obj)
  return Success(obj) unless obj.respond_to?(:permission_manager)
  obj.permission_manager&.acl&.save ||
    (return Failure[:failed_to_save_acl, acl])

  Success(obj)
end