Sha256: a4db766a0312273ad1841bc4861babd79181dec976ba0fc829cee41f28d2d7ca

Contents?: true

Size: 1.27 KB

Versions: 40

Compression:

Stored size: 1.27 KB

Contents

require_dependency "panda_pal/application_controller"

module PandaPal
  class LtiV1P0Controller < ApplicationController
    if Rails.version < '5.0'
      skip_before_action :verify_authenticity_token
    else
      skip_before_action :verify_authenticity_token, raise: false
    end

    def launch
      current_session_data.merge!({
        lti_version: 'v1p0',
        lti_launch_placement: params[:launch_type],
        launch_params: params.to_unsafe_h,
      })

      redirect_with_session_to(:"#{LaunchUrlHelpers.launch_route(params[:launch_type])}_url", route_context: main_app)
    end

    def tool_config
      if PandaPal.lti_environments.empty?
        render plain: 'Domains must be set in lti_environments'
        return
      end
      platform = PandaPal.lti_options.delete(:platform) || 'canvas.instructure.com'
      request_url = "#{request.scheme}://#{request.host_with_port}"
      case platform
      when 'canvas.instructure.com'
        xml_config = LtiXml::CanvasPlatform.new(platform, request_url, main_app)
      when 'bridgeapp.com'
        xml_config = LtiXml::BridgePlatform.new(platform, request_url, main_app)
      else
        render plain: 'platform must be set under lti_options'
        return
      end
      render xml: xml_config.xml
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
panda_pal-5.12.7 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.12.6 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.12.5 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.12.4 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.12.3 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.12.2 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.12.1 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.12.0 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.11.0 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.10.1 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.10.0 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.8.beta1 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.7 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.6 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.5 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.4 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.3 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.1 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.9.0 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.8.5 app/controllers/panda_pal/lti_v1_p0_controller.rb