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

Re-index the resource for the updated ACL.

Parameters:

  • event (Dry::Event)

15
16
17
18
19
20
21
22
23
# File 'app/services/hyrax/listeners/active_fedora_acl_index_listener.rb', line 15

def on_object_acl_updated(event)
  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