Sha256: cfc4580d842684f64652b0f8efe143c3b0faa021ca7933cf3bc9c9a27a8e7e16

Contents?: true

Size: 935 Bytes

Versions: 36

Compression:

Stored size: 935 Bytes

Contents

module Katello
  class RepositoryTypeManager
    @repository_types = {}
    class << self
      private :new
      attr_reader :repository_types

      # Plugin constructor
      def register(id, &block)
        unless find(id).present?
          repository_type = ::Katello::RepositoryType.new(id)
          repository_type.instance_eval(&block) if block_given?
          repository_types[id.to_s] = repository_type
        end
      end

      def creatable_repository_types
        repository_types.select do |repo_type, _|
          creatable_by_user?(repo_type)
        end
      end

      def creatable_by_user?(repository_type)
        return false unless (type = find(repository_type))
        type.allow_creation_by_user
      end

      def find(repository_type)
        repository_types[repository_type.to_s]
      end

      def enabled?(repository_type)
        find(repository_type).present?
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
katello-3.4.5 app/services/katello/repository_type_manager.rb
katello-3.4.4 app/services/katello/repository_type_manager.rb
katello-3.4.2 app/services/katello/repository_type_manager.rb
katello-3.4.1 app/services/katello/repository_type_manager.rb
katello-3.4.0.2 app/services/katello/repository_type_manager.rb
katello-3.4.0.1 app/services/katello/repository_type_manager.rb
katello-3.3.2 app/services/katello/repository_type_manager.rb
katello-3.4.0 app/services/katello/repository_type_manager.rb
katello-3.4.0.rc2 app/services/katello/repository_type_manager.rb
katello-3.4.0.rc1 app/services/katello/repository_type_manager.rb
katello-3.3.1.1 app/services/katello/repository_type_manager.rb
katello-3.3.1 app/services/katello/repository_type_manager.rb
katello-3.3.0.1 app/services/katello/repository_type_manager.rb
katello-3.3.0 app/services/katello/repository_type_manager.rb
katello-3.3.0.rc2 app/services/katello/repository_type_manager.rb
katello-3.3.0.rc1.1 app/services/katello/repository_type_manager.rb
katello-3.3.0.rc1 app/services/katello/repository_type_manager.rb
katello-3.2.1.1 app/services/katello/repository_type_manager.rb
katello-3.2.1 app/services/katello/repository_type_manager.rb
katello-3.2.0 app/services/katello/repository_type_manager.rb