Sha256: 598a634fad7a1dbe782495661fedb201be0f5eda9e3392f28bbd782a007cfb92
Contents?: true
Size: 821 Bytes
Versions: 16
Compression:
Stored size: 821 Bytes
Contents
# frozen_string_literal: true require 'dry/monads' module Hyrax module Transactions module Steps ## # Deletes the Hyrax::AccessControlList for any resource with a `#permission_manager`. # If `#permission_manager` is undefined, succeeds. # # @see https://dry-rb.org/gems/dry-monads/1.0/result/ class DeleteAccessControl include Dry::Monads[:result] ## # @param [Valkyrie::Resource] obj # # @return [Dry::Monads::Result] def call(obj) return Success(obj) unless obj.respond_to?(:permission_manager) acl = obj.permission_manager&.acl return Success(obj) if acl.nil? acl.destroy || (return Failure[:failed_to_delete_acl, acl]) Success(obj) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems