panda_pal 5.3.5 → 5.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/controllers/panda_pal/lti_v1_p0_controller.rb +2 -0
- data/app/controllers/panda_pal/lti_v1_p3_controller.rb +2 -2
- data/app/lib/lti_xml/base_platform.rb +1 -1
- data/app/lib/panda_pal/launch_url_helpers.rb +9 -3
- data/app/models/panda_pal/organization_concerns/settings_validation.rb +14 -0
- data/lib/panda_pal.rb +1 -0
- data/lib/panda_pal/helpers/controller_helper.rb +2 -1
- data/lib/panda_pal/helpers/route_helper.rb +1 -0
- data/lib/panda_pal/version.rb +1 -1
- data/panda_pal.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e3454f04c4cbf7a07dc7a041118bb3b60db681c531ebf228115de69f1114d50
|
4
|
+
data.tar.gz: bc600d9940213278b6a0b9e908df51c24012a75ac120746758719faa91e8abbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 507728d1f3dbe751125f4bd7fbda5a2245c20eee20ea8d446f12d5b701007ab1fbee5cfe81d741d400966db2f526d484e4f8ffde1c82f5db43a1e685f96362cc
|
7
|
+
data.tar.gz: c97afd8ec0a896f46a5b63a6eb8d9b9f13d31d995d448d29800f88f23c6fd4897877e7958e54d5d47e23dab04277c1eba7c73b852dc61704d197f3ec47ed27aa
|
data/README.md
CHANGED
@@ -21,6 +21,14 @@ PandaPal::stage_navigation(:account_navigation, {
|
|
21
21
|
|
22
22
|
Configuration data for an installation can be set by creating a `PandaPal::Organization` record. Due to the nature of the data segregation, once created, the name of the organization should not be changed (and will raise a validation error).
|
23
23
|
|
24
|
+
### LTI 1.3 Configuration
|
25
|
+
LTI 1.3 has some additional configuration steps required to setup an LTI:
|
26
|
+
|
27
|
+
1. If you're running Canvas locally, make sure the `config/redis.yml` and `config/dynamic_settings.yml` files exist in Canvas.
|
28
|
+
2. In prod, you'll need to generate a RSA Private Key for the LTI to use. You can set the `LTI_PRIVATE_KEY` ENV variable, or manually set `PandaPal.lti_private_key = OpenSSL::PKey::RSA.new(key)`.
|
29
|
+
3. Make sure you have Redis installed and linked correctly
|
30
|
+
4. Your PandaPal::Organization's `key` should be `CLIENT_ID/DEPLOYMENT_ID` (which can be found in Canvas). If a Deployment ID is not given, the key should just be `CLIENT_ID`.
|
31
|
+
|
24
32
|
### Launch URL property
|
25
33
|
LTI Spec: `The launch_url contains the URL to which the LTI Launch is to be sent. The secure_launch_url is the URL to use if secure http is required. One of either the launch_url or the secure_launch_url must be specified.`
|
26
34
|
|
@@ -2,6 +2,7 @@ require_dependency "panda_pal/application_controller"
|
|
2
2
|
|
3
3
|
module PandaPal
|
4
4
|
class LtiV1P3Controller < ApplicationController
|
5
|
+
skip_before_action :verify_authenticity_token
|
5
6
|
before_action :validate_launch!, only: [:resource_link_request]
|
6
7
|
around_action :switch_tenant, only: [:resource_link_request]
|
7
8
|
|
@@ -54,8 +55,7 @@ module PandaPal
|
|
54
55
|
parsed_request_url = URI.parse(request_url)
|
55
56
|
|
56
57
|
mapped_placements = PandaPal.lti_paths.map do |k, opts|
|
57
|
-
opts = opts
|
58
|
-
opts.delete(:route_helper_key)
|
58
|
+
opts = LaunchUrlHelpers.normalize_lti_launch_desc(opts)
|
59
59
|
opts.merge!({
|
60
60
|
placement: k,
|
61
61
|
target_link_uri: LaunchUrlHelpers.absolute_launch_url(k.to_sym, host: parsed_request_url, launch_handler: v1p3_resource_link_request_path),
|
@@ -85,7 +85,7 @@ module LtiXml
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def ext_params(options, k)
|
88
|
-
options.
|
88
|
+
options = PandaPal::LaunchUrlHelpers.normalize_lti_launch_desc(options)
|
89
89
|
options[:url] = PandaPal::LaunchUrlHelpers.absolute_launch_url(k.to_sym, host: parsed_request_url, launch_handler: nil)
|
90
90
|
options
|
91
91
|
end
|
@@ -2,11 +2,10 @@ module PandaPal
|
|
2
2
|
module LaunchUrlHelpers
|
3
3
|
def self.absolute_launch_url(launch_type, host:, launch_handler: nil)
|
4
4
|
opts = PandaPal.lti_paths[launch_type]
|
5
|
-
|
6
|
-
|
7
|
-
is_direct = opts[:route_helper_key].present? || !launch_handler.present?
|
5
|
+
is_direct = opts[:no_redirect] || !launch_handler.present?
|
8
6
|
|
9
7
|
if is_direct
|
8
|
+
final_url = launch_url(opts, launch_type: launch_type)
|
10
9
|
return final_url if URI.parse(final_url).absolute?
|
11
10
|
return [host.to_s, final_url].join
|
12
11
|
else
|
@@ -17,6 +16,13 @@ module PandaPal
|
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
19
|
+
def self.normalize_lti_launch_desc(opts)
|
20
|
+
opts = opts.dup
|
21
|
+
opts.delete(:route_helper_key)
|
22
|
+
opts.delete(:no_redirect)
|
23
|
+
opts
|
24
|
+
end
|
25
|
+
|
20
26
|
def self.launch_url(opts, launch_type: nil)
|
21
27
|
url = launch_route(opts, launch_type: launch_type)
|
22
28
|
url = resolve_url_symbol(url) if url.is_a?(Symbol)
|
@@ -99,6 +99,20 @@ module PandaPal
|
|
99
99
|
errors.concat(val_errors)
|
100
100
|
end
|
101
101
|
|
102
|
+
if settings.is_a?(Array)
|
103
|
+
if spec[:length].is_a?(Range)
|
104
|
+
errors << "#{human_path} should contain #{spec[:length]} items" unless spec[:length].include?(settings.count)
|
105
|
+
elsif spec[:length].is_a?(Numeric)
|
106
|
+
errors << "#{human_path} should contain exactly #{spec[:length]} items" unless spec[:length] == settings.count
|
107
|
+
end
|
108
|
+
|
109
|
+
if spec[:item] != nil
|
110
|
+
settings.each_with_index do |value, i|
|
111
|
+
validate_settings_level(settings[i], spec[:item], path: [*path, i], errors: errors)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
102
116
|
if settings.is_a?(Hash)
|
103
117
|
if spec[:properties] != nil
|
104
118
|
spec[:properties].each do |key, pspec|
|
data/lib/panda_pal.rb
CHANGED
@@ -81,6 +81,7 @@ module PandaPal
|
|
81
81
|
|
82
82
|
def self.validate_lti_navigation(errors = [])
|
83
83
|
@@lti_navigation.each do |k, v|
|
84
|
+
next if v[:route_helper_key]
|
84
85
|
errors << "lti navigation '#{k}' does not have a Route!" unless (LaunchUrlHelpers.launch_url(k) rescue nil)
|
85
86
|
end
|
86
87
|
errors
|
@@ -127,7 +127,8 @@ module PandaPal::Helpers
|
|
127
127
|
|
128
128
|
def organization_key
|
129
129
|
org_key ||= params[:oauth_consumer_key]
|
130
|
-
org_key ||= "#{params[:client_id]}/#{params[:deployment_id]}" if params[:client_id].present?
|
130
|
+
org_key ||= "#{params[:client_id]}/#{params[:deployment_id]}" if params[:client_id].present? && params[:deployment_id].present?
|
131
|
+
org_key ||= params[:client_id] if params[:client_id].present?
|
131
132
|
org_key ||= session[:organization_key]
|
132
133
|
org_key
|
133
134
|
end
|
@@ -9,6 +9,7 @@ module PandaPal::Helpers::RouteHelper
|
|
9
9
|
path = "#{base_path}/#{nav.to_s}"
|
10
10
|
|
11
11
|
lti_options = options.delete(:lti_options) || {}
|
12
|
+
lti_options[:no_redirect] = options.delete(:no_redirect)
|
12
13
|
lti_options[:route_helper_key] = path.split('/').reject(&:empty?).join('_')
|
13
14
|
post(path, options.dup, &block)
|
14
15
|
get(path, options.dup, &block)
|
data/lib/panda_pal/version.rb
CHANGED
data/panda_pal.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency 'attr_encrypted', '~> 3.0.0'
|
24
24
|
s.add_dependency 'secure_headers', '~> 6.1'
|
25
25
|
s.add_dependency 'json-jwt'
|
26
|
+
s.add_dependency 'httparty'
|
26
27
|
|
27
28
|
s.add_development_dependency 'sidekiq'
|
28
29
|
s.add_development_dependency 'sidekiq-scheduler'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panda_pal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.3.
|
4
|
+
version: 5.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure ProServe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -128,6 +128,20 @@ dependencies:
|
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: httparty
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :runtime
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
131
145
|
- !ruby/object:Gem::Dependency
|
132
146
|
name: sidekiq
|
133
147
|
requirement: !ruby/object:Gem::Requirement
|