Sha256: d12b14488827f64b6a9fb53377c134c231f17c6761034f30179693a37bf04b62

Contents?: true

Size: 1.19 KB

Versions: 86

Compression:

Stored size: 1.19 KB

Contents

module Katello
  module Concerns
    module RegistrationCommandsControllerExtensions
      extend ActiveSupport::Concern

      def plugin_data
        aks = ActivationKey.authorized(:view_activation_keys)
                           .where(organization_id: registration_params[:organization_id])
                           .order(:name)
                           .map { |ak| { name: ak.name, lce: ak.environment&.name } }

        lces = KTEnvironment.readable
                            .where(organization_id: registration_params[:organization_id])
                            .order(:name)

        data = { activationKeys: aks, lifecycleEnvironments: lces }

        if registration_params[:hostgroup_id].present?
          host_group = ::Hostgroup.authorized(:view_hostgroups).find(registration_params[:hostgroup_id])
          data[:hostGroupActivationKeys] = host_group.params['kt_activation_keys']
          data[:hostGroupEnvironment] = host_group.lifecycle_environment&.name
        end

        super.merge(data)
      end

      def registration_args
        args = super
        args['activation_keys'] = args['activation_keys'].join(',') if args['activation_keys']
        args
      end
    end
  end
end

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
katello-4.14.3 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.14.2 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.14.1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.14.0 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.14.0.rc3 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.14.0.rc2 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.14.0.rc1.1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.14.0.rc1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.13.1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.13.0 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.12.1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.13.0.rc1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.12.0 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.12.0.rc3 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.12.0.rc2 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.12.0.rc1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.11.1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.11.0 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.11.0.rc2 app/controllers/katello/concerns/registration_commands_controller_extensions.rb
katello-4.11.0.rc1 app/controllers/katello/concerns/registration_commands_controller_extensions.rb