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


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

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

Instance Method Details

#discovery_permissionsObject

Overrides Hydra::AccessControlsEnforcement


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

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


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

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


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

def models
  [::AdminSet]
end