Sha256: d2754d8c4c0fbe1438db6868c2d6a732f67ca2329c7d223417cd006150ad528c

Contents?: true

Size: 912 Bytes

Versions: 24

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module Collections
    module ManagedCollectionsService
      # @api public
      #
      # Count of collections the current user can manage.
      #
      # @param scope [Object] Typically a controller object that responds to `repository`, `can?`, `blacklight_config`, `current_ability`
      # @return [Array<SolrDocument>]
      def self.managed_collections_count(scope:)
        response, _docs = search_service(scope).search_results do |builder|
          builder.rows(0)
        end

        response.response['numFound']
      end

      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
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/services/hyrax/collections/managed_collections_service.rb
hyrax-5.0.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-5.0.0.rc3 app/services/hyrax/collections/managed_collections_service.rb
hyrax-5.0.0.rc2 app/services/hyrax/collections/managed_collections_service.rb
hyrax-5.0.0.rc1 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.6.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-4.0.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-4.0.0.rc3 app/services/hyrax/collections/managed_collections_service.rb
hyrax-4.0.0.rc2 app/services/hyrax/collections/managed_collections_service.rb
hyrax-4.0.0.rc1 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.5.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-4.0.0.beta2 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.4.2 app/services/hyrax/collections/managed_collections_service.rb
hyrax-4.0.0.beta1 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.4.1 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.4.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.3.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.2.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.1.0 app/services/hyrax/collections/managed_collections_service.rb
hyrax-3.0.2 app/services/hyrax/collections/managed_collections_service.rb