Class: Hyrax::Listeners::ActiveFedoraACLIndexListener

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/listeners/active_fedora_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
21
22
23
24
25
26
# File 'app/services/hyrax/listeners/active_fedora_acl_index_listener.rb', line 17

def on_object_acl_updated(event)
  return if Hyrax.config.disable_wings
  return unless event[:result] == :success # do nothing on failure

  if Hyrax..is_a?(Wings::Valkyrie::MetadataAdapter)
    Wings::ActiveFedoraConverter.convert(resource: event[:acl].resource).update_index
  else
    Hyrax.logger.info('Skipping ActiveFedora object reindex because the Wings adapter is not in use.')
  end
end