Sha256: b646499dc3c5c4d5e34a993ce4131a07eca9f9bf1e22a89885c048bf2bc9fada

Contents?: true

Size: 838 Bytes

Versions: 20

Compression:

Stored size: 838 Bytes

Contents

class CockpitController < ApplicationController
  before_action :find_resource, :only => [:host_ssh_params]

  def host_ssh_params
    render :json => SSHExecutionProvider.ssh_params(@host)
  end

  def redirect
    return invalid_request unless params[:redirect_uri]
    redir_url = URI.parse(params[:redirect_uri])

    cockpit_url = SSHExecutionProvider.cockpit_url_for_host('')
    redir_url.query = if redir_url.hostname == URI.join(Setting[:foreman_url], cockpit_url).hostname
                        "access_token=#{request.session_options[:id]}"
                      else
                        "error_description=Sorry"
                      end
    redirect_to(redir_url.to_s)
  end

  private

  def resource_name
    "host"
  end

  def controller_permission
    :hosts
  end

  def action_permission
    :cockpit
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
foreman_remote_execution-2.0.10 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.9 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.8 app/controllers/cockpit_controller.rb
foreman_remote_execution-3.0.3 app/controllers/cockpit_controller.rb
foreman_remote_execution-3.0.2 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.7 app/controllers/cockpit_controller.rb
foreman_remote_execution-3.0.1 app/controllers/cockpit_controller.rb
foreman_remote_execution-3.0.0 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.6 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.5 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.4 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.3 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.2 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.1 app/controllers/cockpit_controller.rb
foreman_remote_execution-2.0.0 app/controllers/cockpit_controller.rb
foreman_remote_execution-1.8.4 app/controllers/cockpit_controller.rb
foreman_remote_execution-1.8.3 app/controllers/cockpit_controller.rb
foreman_remote_execution-1.8.2 app/controllers/cockpit_controller.rb
foreman_remote_execution-1.8.1 app/controllers/cockpit_controller.rb
foreman_remote_execution-1.8.0 app/controllers/cockpit_controller.rb