Module: Hyrax::FilterSuppressedWithRoles

Extended by:
ActiveSupport::Concern
Includes:
FilterSuppressed
Included in:
WorkSearchBuilder
Defined in:
app/search_builders/hyrax/filter_suppressed_with_roles.rb

Overview

Overrides FilterSuppressed filter to hide documents marked as suppressed when the current user is permitted to take no workflow actions for the work’s current state

Assumes presence of ‘blacklight_params` and a SolrDocument corresponding to that `:id` value

Instance Method Summary collapse

Instance Method Details

#only_active_works(solr_parameters) ⇒ Object

Note:

This is another case in which the Sipity workflows and the SOLR permissions are not adequately synchronized. Sipity COULD be used to include that information, however that is not presently scoped work.

Skip the filter if the current user is:

  • permitted to take workflow actions on the work

  • the depositor

corresponding to the SolrDocument with id = ‘blacklight_params`



24
25
26
27
28
29
# File 'app/search_builders/hyrax/filter_suppressed_with_roles.rb', line 24

def only_active_works(solr_parameters)
  current_work = ::SolrDocument.find(blacklight_params[:id])
  return if user_has_active_workflow_role?(current_work: current_work)
  return if depositor?(current_work: current_work)
  super
end