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) ⇒ void

This method returns an undefined value.

Re-index the resource for the updated ACL.

Called when ‘object.acl.updated’ event is published

Parameters:

  • event (Dry::Events::Event)


17
18
19
20
# File 'app/services/hyrax/listeners/acl_index_listener.rb', line 17

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