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

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)

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

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