Sha256: bbe4413d87e89e3d3109c58b9ce9e3d0ec852638e2d6c561b3b0d487296fb77d

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 Bytes

Contents

module BlacklightUserGeneratedContent
  module SolrHelper
    module Scope
      def self.included(some_class)
        some_class.solr_search_params_logic += [ :restrict_to_user_generated_content_scope]
      end
  
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight_user_generated_content-0.0.8 lib/blacklight_user_generated_content/solr_helper/scope.rb