Sha256: 45f643bb27cae918f317dc39848840eee4db46853f7168dbddba362ed99e2cb9

Contents?: true

Size: 601 Bytes

Versions: 8

Compression:

Stored size: 601 Bytes

Contents

# frozen_string_literal: true

module Hyrax
  module Listeners
    ##
    # Reindexes resources when their ACLs are updated.
    #
    # Hyrax's `Ability` behavior depends on the index being up-to-date as
    # concerns-their read/write users/groups, and visibility.
    class AclIndexListener
      ##
      # Re-index the resource for the updated ACL.
      #
      # @param event [Dry::Event]
      def on_object_acl_updated(event)
        return unless event[:result] == :success # do nothing on failure
        Hyrax.index_adapter.save(resource: event[:acl].resource)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyrax-3.2.0 app/services/hyrax/listeners/acl_index_listener.rb
hyrax-3.1.0 app/services/hyrax/listeners/acl_index_listener.rb
hyrax-3.0.2 app/services/hyrax/listeners/acl_index_listener.rb
hyrax-3.0.1 app/services/hyrax/listeners/acl_index_listener.rb
hyrax-3.0.0 app/services/hyrax/listeners/acl_index_listener.rb
hyrax-3.0.0.pre.rc4 app/services/hyrax/listeners/acl_index_listener.rb
hyrax-3.0.0.pre.rc3 app/services/hyrax/listeners/acl_index_listener.rb
hyrax-3.0.0.pre.rc2 app/services/hyrax/listeners/acl_index_listener.rb