Sha256: 0049cd9fba103adb36e5ba3a125f948c15c88e7eed775f1b70c1dec51ce16d54
Contents?: true
Size: 1.14 KB
Versions: 12
Compression:
Stored size: 1.14 KB
Contents
module Hyrax ### Allows :deposit as a valid type class AdminSetSearchBuilder < ::SearchBuilder # This skips the filter added by FilterSuppressed self.default_processor_chain -= [:only_active_works] # @param [#repository,#blacklight_config,#current_ability] context # @param [Symbol] access one of :edit, :read, or :deposit def initialize(context, access) @access = access super(context) end # This overrides the models in FilterByType def models [::AdminSet] end # Overrides Hydra::AccessControlsEnforcement def discovery_permissions if @access == :edit @discovery_permissions ||= ["edit"] else super end end # If :deposit access is requested, check to see which admin sets the user has # deposit or manage access to. # @return [Array<String>] a list of filters to apply to the solr query def gated_discovery_filters return super if @access != :deposit ["{!terms f=id}#{admin_set_ids_for_deposit.join(',')}"] end delegate :admin_set_ids_for_deposit, to: :current_ability private :admin_set_ids_for_deposit end end
Version data entries
12 entries across 12 versions & 1 rubygems