Module: Hyrax::Collections::ManagedCollectionsService

Defined in:
app/services/hyrax/collections/managed_collections_service.rb

Class Method Summary collapse

Class Method Details

.managed_collections_count(scope:) ⇒ Array<SolrDocument>

Count of collections the current user can manage.

Parameters:

  • scope (Object)

    Typically a controller object that responds to ‘repository`, `can?`, `blacklight_config`, `current_ability`

Returns:



11
12
13
14
15
16
17
# File 'app/services/hyrax/collections/managed_collections_service.rb', line 11

def self.managed_collections_count(scope:)
  response, _docs = search_service(scope).search_results do |builder|
    builder.rows(0)
  end

  response.response['numFound']
end

.search_service(scope) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'app/services/hyrax/collections/managed_collections_service.rb', line 19

def self.search_service(scope)
  Hyrax::SearchService.new(
    config: scope.blacklight_config,
    user_params: {},
    current_ability: scope.current_ability,
    scope: scope,
    search_builder_class: Hyrax::Dashboard::CollectionsSearchBuilder
  )
end