Class: Hyrax::AdminSetSearchBuilder

Inherits:
SearchBuilder
  • Object
show all
Defined in:
app/search_builders/hyrax/admin_set_search_builder.rb

Overview

Allows :deposit as a valid type

Direct Known Subclasses

SingleAdminSetSearchBuilder

Instance Method Summary collapse

Constructor Details

#initialize(context, access) ⇒ AdminSetSearchBuilder

Returns a new instance of AdminSetSearchBuilder.

Parameters:

  • context (#repository, #blacklight_config, #current_ability)
  • access (Symbol)

    one of :edit, :read, or :deposit



10
11
12
13
# File 'app/search_builders/hyrax/admin_set_search_builder.rb', line 10

def initialize(context, access)
  @access = access
  super(context)
end

Instance Method Details

#discovery_permissionsObject

Overrides Hydra::AccessControlsEnforcement



21
22
23
24
25
26
27
# File 'app/search_builders/hyrax/admin_set_search_builder.rb', line 21

def discovery_permissions
  if @access == :edit
    @discovery_permissions ||= ["edit"]
  else
    super
  end
end

#gated_discovery_filtersArray<String>

If :deposit access is requested, check to see which admin sets the user has deposit or manage access to.

Returns:

  • (Array<String>)

    a list of filters to apply to the solr query



32
33
34
35
# File 'app/search_builders/hyrax/admin_set_search_builder.rb', line 32

def gated_discovery_filters
  return super if @access != :deposit
  ["{!terms f=id}#{admin_set_ids_for_deposit.join(',')}"]
end

#modelsObject

This overrides the models in FilterByType



16
17
18
# File 'app/search_builders/hyrax/admin_set_search_builder.rb', line 16

def models
  [::AdminSet, Hyrax::AdministrativeSet]
end