Class: Hyrax::Listeners::AclIndexListener

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/listeners/acl_index_listener.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#on_object_acl_updated(event) ⇒ Object

Re-index the resource for the updated ACL.

Parameters:

  • event (Dry::Event)

15
16
17
18
# File 'app/services/hyrax/listeners/acl_index_listener.rb', line 15

def on_object_acl_updated(event)
  return unless event[:result] == :success # do nothing on failure
  Hyrax.index_adapter.save(resource: event[:acl].resource)
end