Class: Hyrax::Dashboard::WorksSearchBuilder

Inherits:
WorksSearchBuilder show all
Includes:
ManagedSearchFilters
Defined in:
app/search_builders/hyrax/dashboard/works_search_builder.rb

Instance Method Summary collapse

Methods included from ManagedSearchFilters

#apply_group_permissions, #discovery_permissions

Methods inherited from WorksSearchBuilder

#only_works?

Methods included from FilterByType

#filter_models

Methods included from SearchFilters

#gated_discovery_filters, #with_access

Methods included from FilterSuppressed

#only_active_works

Instance Method Details

#show_only_managed_works_for_non_admins(solr_parameters) ⇒ Object

Adds a filter to exclude works created by the current user if the current user is not an admin.

Parameters:

  • solr_parameters (Hash)


11
12
13
14
15
# File 'app/search_builders/hyrax/dashboard/works_search_builder.rb', line 11

def show_only_managed_works_for_non_admins(solr_parameters)
  return if current_ability.admin?
  solr_parameters[:fq] ||= []
  solr_parameters[:fq] << '-' + ActiveFedora::SolrQueryBuilder.construct_query_for_rel(depositor: current_user_key)
end