Sha256: 01f926cf73c21d694917f4c866979af8dfb39af3e3a8463fab8d55ba0fc53b1e

Contents?: true

Size: 1.03 KB

Versions: 36

Compression:

Stored size: 1.03 KB

Contents

module Hyrax
  module SearchFilters
    extend ActiveSupport::Concern
    include Hyrax::FilterByType
    include FilterSuppressed

    # TODO: move this to Hydra::AccessControlsEnforcement
    # @param access [String] what access level to set. Either 'read' or 'edit'
    # @return [SearchBuilder]
    def with_access(access)
      @discovery_permissions = Array.wrap(access)
      self
    end

    # Override Hydra::AccessControlsEnforcement (or Hydra::PolicyAwareAccessControlsEnforcement)
    # Allows admin users to see everything (don't apply any gated_discovery_filters for those users)
    def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)
      return [] if ability.admin?
      super
    end

    private

      # TODO: could this be moved to Blacklight::AccessControls::Enforcement?
      def current_user_key
        current_user.user_key
      end

      # TODO: could this be moved to Blacklight::AccessControls::Enforcement?
      def current_user
        scope.current_user
      end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

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