Class: Hyrax::My::CollectionsSearchBuilder

Inherits:
CollectionSearchBuilder show all
Includes:
FilterByType, SearchBuilderBehavior
Defined in:
app/search_builders/hyrax/my/collections_search_builder.rb

Overview

Added to allow for the My controller to show only things I have edit access to

Instance Attribute Summary

Attributes inherited from CollectionSearchBuilder

#access

Instance Method Summary collapse

Methods included from FilterByType

#filter_models

Methods included from SearchBuilderBehavior

#discovery_permissions

Methods inherited from CollectionSearchBuilder

#add_sorting_to_solr, #discovery_permissions, #gated_discovery_filters, #sort_field, #with_access

Instance Method Details

#modelsArray<Class>

This overrides the models in FilterByType

Returns:

  • (Array<Class>)

    a list of classes to include



20
21
22
# File 'app/search_builders/hyrax/my/collections_search_builder.rb', line 20

def models
  Hyrax::ModelRegistry.admin_set_classes + Hyrax::ModelRegistry.collection_classes
end

#show_only_collections_deposited_by_current_user(solr_parameters) ⇒ Object

adds a filter to the solr_parameters that filters the collections and admin sets the current user has deposited

Parameters:

  • solr_parameters (Hash)


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

def show_only_collections_deposited_by_current_user(solr_parameters)
  clauses = [query_for_my_collections]
  solr_parameters[:fq] ||= []
  solr_parameters[:fq] += ["(#{clauses.join(' OR ')})"]
end