Sha256: 42103242480fd1785708870842c56e303857879d4057ce358c4c61c899499aa6

Contents?: true

Size: 697 Bytes

Versions: 26

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true
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

26 entries across 26 versions & 1 rubygems

Version Path
hyrax-5.0.2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-5.0.1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-5.0.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-5.0.0.rc3 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-5.0.0.rc2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-5.0.0.rc1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.6.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-4.0.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-4.0.0.rc3 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-4.0.0.rc2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-4.0.0.rc1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.5.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-4.0.0.beta2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.4.2 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-4.0.0.beta1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.4.1 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.4.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.3.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.2.0 app/search_builders/hyrax/dashboard/works_search_builder.rb
hyrax-3.1.0 app/search_builders/hyrax/dashboard/works_search_builder.rb