Class: Hyrax::My::CollectionsSearchBuilder
- Inherits:
-
SearchBuilder
- Object
- SearchBuilder
- Hyrax::My::CollectionsSearchBuilder
- 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 Method Summary collapse
-
#models ⇒ Array<Class>
This overrides the models in FilterByType.
-
#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.
Methods included from FilterByType
Methods included from SearchBuilderBehavior
Instance Method Details
#models ⇒ Array<Class>
This overrides the models in FilterByType
22 23 24 |
# File 'app/search_builders/hyrax/my/collections_search_builder.rb', line 22 def models [::AdminSet, ::Collection] 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
11 12 13 14 15 16 17 18 |
# File 'app/search_builders/hyrax/my/collections_search_builder.rb', line 11 def show_only_collections_deposited_by_current_user(solr_parameters) clauses = [ ActiveFedora::SolrQueryBuilder.construct_query_for_rel(depositor: current_user_key), ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::AdminSet.to_s, creator: current_user_key) ] solr_parameters[:fq] ||= [] solr_parameters[:fq] += ["(#{clauses.join(' OR ')})"] end |