Class: Hyrax::Transactions::Steps::SaveAccessControl
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::SaveAccessControl
- 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, permissions_params: []) ⇒ Dry::Monads::Result
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hyrax/transactions/steps/save_access_control.rb', line 19 def call(obj, permissions_params: []) return Success(obj) unless obj.respond_to?(:permission_manager) acl = obj.&.acl # Translate step args into Hyrax::Permission objects before saving Array().each do |param| = (obj, param) acl << if end acl&.save || (return Failure[:failed_to_save_acl, acl]) Success(obj) end |