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