Module: BlacklightUserGeneratedContent::SolrHelper::Scope
- Included in:
- UserGeneratedContentController
- Defined in:
- lib/blacklight_user_generated_content/solr_helper/scope.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(some_class) ⇒ Object
4 5 6 |
# File 'lib/blacklight_user_generated_content/solr_helper/scope.rb', line 4 def self.included(some_class) some_class.solr_search_params_logic += [ :restrict_to_user_generated_content_scope] end |
Instance Method Details
#restrict_to_user_generated_content_scope(solr_parameters, user_parameters) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/blacklight_user_generated_content/solr_helper/scope.rb', line 8 def restrict_to_user_generated_content_scope solr_parameters, user_parameters solr_parameters[:fq] ||= [] if current_user if current_user.has_role? :admin and user_parameters[:all] solr_parameters[:fq] << "comments_ids_i:[* TO *]" else solr_parameters[:fq] << "comments_user_ids_i:#{current_user.id} OR tags_user_ids_i:#{current_user.id}" end else solr_parameters[:fq] << "comments_public_b:true" end end |