Sha256: 833901d01e5517cd5989fac07d4fee189e43ddf0d98c23d77331de7a79a4bebb

Contents?: true

Size: 667 Bytes

Versions: 36

Compression:

Stored size: 667 Bytes

Contents

module Hyrax
  module Dashboard
    class WorksSearchBuilder < Hyrax::WorksSearchBuilder
      include Hyrax::Dashboard::ManagedSearchFilters

      self.default_processor_chain += [:show_only_managed_works_for_non_admins]

      # Adds a filter to exclude works created by the current user if the
      # current user is not an admin.
      # @param [Hash] solr_parameters
      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
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.9.5 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.9.4 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.9.3 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.9.2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.9.1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.9.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.8.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.7.2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.7.1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.7.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.6.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.0.0.pre.rc1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.0.0.pre.beta3 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.5.1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.5.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.0.0.pre.beta2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.4.1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.0.0.pre.beta1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-2.4.0 app/search_builders/hyrax/dashboard/works_search_builder.rb