Sha256: f366a7f65d34c7d11b228c906b3621a13456eab39989987b1148bd4b02fde4a5

Contents?: true

Size: 891 Bytes

Versions: 24

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module Works
    module ManagedWorksService
      # @api public
      #
      # Count of works 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_works_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: scope.params,
          scope: scope,
          current_ability: scope.current_ability,
          search_builder_class: Hyrax::Dashboard::WorksSearchBuilder
        )
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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