Sha256: fb42808980d91c1ea1dd6769d828d9672316d09d91cc08c0be90c129ee857602

Contents?: true

Size: 920 Bytes

Versions: 24

Compression:

Stored size: 920 Bytes

Contents

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

    def current_user_key
      current_user.user_key
    end

    def current_user
      scope.current_user
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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