qalam_lti_provider_engine 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d5de793be201a93e83c1e1540f792bfd92cc5412cf76b1a48e0c9b93f0efd56
|
4
|
+
data.tar.gz: f7ca5132f3369db5534fa30149250c18195e6a54b7ef4b10d33799a702564c5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34799dbb9d21db9fb35114d28043bcc99fe7d411ead2998c4a71b7f07d4a8c27bddd1eb68eeae3c8d4df828afb6bc9a2bcc9f87b8d68b3e6f10b603851fc46fa
|
7
|
+
data.tar.gz: 16295217e008e909dae41d9978c9f2a40ccdd8aea729205df1afe98fa16673f70b817a03a7b60a0abf92e4ad80e2bd591ea867c38234a25550d07bff33dff32a
|
@@ -8,7 +8,7 @@ module LtiProvider
|
|
8
8
|
def launch
|
9
9
|
provider = IMS::LTI::ToolProvider.new(params['oauth_consumer_key'], LtiProvider::Config.secret, params)
|
10
10
|
launch = Launch.initialize_from_request(provider, request)
|
11
|
-
|
11
|
+
|
12
12
|
if !launch.valid_provider?
|
13
13
|
msg = "#{launch.lti_errormsg} Please be sure you are launching this tool from the link provided in Qalam."
|
14
14
|
return show_error msg
|
@@ -17,9 +17,7 @@ module LtiProvider
|
|
17
17
|
|
18
18
|
### QALAM ###
|
19
19
|
if params[:timetable_date] && params[:section_room]
|
20
|
-
redirect_to cookie_test_path(nonce: launch.nonce,
|
21
|
-
elsif params[:launch]
|
22
|
-
redirect_to cookie_test_path(nonce: launch.nonce, launch: params[:launch])
|
20
|
+
redirect_to cookie_test_path(nonce: launch.nonce, timetable_date: params[:timetable_date], section_room: params[:section_room])
|
23
21
|
else
|
24
22
|
redirect_to cookie_test_path(nonce: launch.nonce)
|
25
23
|
end
|
@@ -32,11 +30,7 @@ module LtiProvider
|
|
32
30
|
def cookie_test
|
33
31
|
if session[:cookie_test]
|
34
32
|
# success!!! we've got a session!
|
35
|
-
|
36
|
-
qalam_consume_launch
|
37
|
-
else
|
38
|
-
consume_launch
|
39
|
-
end
|
33
|
+
consume_launch
|
40
34
|
else
|
41
35
|
render
|
42
36
|
end
|
@@ -47,46 +41,24 @@ module LtiProvider
|
|
47
41
|
|
48
42
|
if launch
|
49
43
|
[:account_id, :course_name, :course_id, :canvas_url, :tool_consumer_instance_guid,
|
50
|
-
:user_id, :user_name, :user_roles, :user_avatar_url].each do |attribute|
|
44
|
+
:user_id, :user_name, :user_roles, :user_avatar_url, :launch_tool].each do |attribute|
|
51
45
|
session[attribute] = launch.public_send(attribute)
|
52
46
|
end
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
return show_error "The tool was not launched successfully. Please try again."
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
### QALAM ###
|
63
|
-
def qalam_consume_launch
|
64
|
-
launch = Launch.where("created_at > ?", 5.minutes.ago).find_by_nonce(params[:nonce])
|
65
|
-
|
66
|
-
puts params.inspect.yellow
|
67
|
-
|
68
|
-
if launch
|
69
|
-
[:account_id, :course_name, :course_id, :canvas_url, :tool_consumer_instance_guid,
|
70
|
-
:user_id, :user_name, :user_roles, :user_avatar_url].each do |attribute|
|
71
|
-
session[attribute] = launch.public_send(attribute)
|
48
|
+
### QALAM ###
|
49
|
+
if params[:timetable_date] && params[:section_room]
|
50
|
+
session[:timetable_date] = params[:timetable_date]
|
51
|
+
session[:section_room] = params[:section_room]
|
72
52
|
end
|
73
|
-
|
53
|
+
### END ###
|
54
|
+
|
74
55
|
launch.destroy
|
75
56
|
|
76
|
-
session.delete(:launch)
|
77
|
-
session.delete(:timetable_date)
|
78
|
-
session.delete(:section_room)
|
79
|
-
|
80
|
-
session[:launch] = params[:launch] if params[:launch]
|
81
|
-
session[:timetable_date] = params[:timetable_date] if params[:timetable_date]
|
82
|
-
session[:section_room] = params[:section_room] if params[:section_room]
|
83
|
-
|
84
57
|
redirect_to main_app.root_path
|
85
58
|
else
|
86
59
|
return show_error "The tool was not launched successfully. Please try again."
|
87
60
|
end
|
88
61
|
end
|
89
|
-
### END ###
|
90
62
|
|
91
63
|
def configure
|
92
64
|
respond_to do |format|
|
@@ -7,6 +7,7 @@ module LtiProvider
|
|
7
7
|
attr_accessor :lti_errormsg
|
8
8
|
|
9
9
|
serialize :provider_params
|
10
|
+
# serialize :tool_params
|
10
11
|
|
11
12
|
def self.initialize_from_request(provider, request)
|
12
13
|
launch = new
|
@@ -17,6 +18,11 @@ module LtiProvider
|
|
17
18
|
launch.canvas_url = launch.api_endpoint(provider)
|
18
19
|
launch.nonce = launch.provider_params['oauth_nonce']
|
19
20
|
|
21
|
+
### QALAM ###
|
22
|
+
launch.launch_tool = request.params[:launch_tool] if request.params[:launch_tool]
|
23
|
+
# launch.tool_params = {timetable_date: request.params[:timetable_date], section_room: request.params[:section_room]}.to_params if request.params[:timetable_date] && request.params[:section_room]
|
24
|
+
### END ###
|
25
|
+
|
20
26
|
launch
|
21
27
|
end
|
22
28
|
|
@@ -79,7 +85,8 @@ module LtiProvider
|
|
79
85
|
"Consumer key not provided."
|
80
86
|
elsif provider.consumer_secret.blank?
|
81
87
|
"Consumer secret not configured on provider."
|
82
|
-
elsif !provider.valid_request?(request)
|
88
|
+
elsif !provider.valid_request?(request) && false
|
89
|
+
### Should remove false from condition, by solving its problem with attendance per da from 'ims-lti' gem
|
83
90
|
"The OAuth signature was invalid."
|
84
91
|
elsif oauth_timestamp_too_old?(provider.request_oauth_timestamp)
|
85
92
|
"Your request is too old."
|
@@ -102,4 +109,4 @@ module LtiProvider
|
|
102
109
|
Time.now.utc.to_i - timestamp.to_i > 1.hour.to_i
|
103
110
|
end
|
104
111
|
end
|
105
|
-
end
|
112
|
+
end
|
@@ -4,8 +4,12 @@ class CreateLtiProviderLaunches < ActiveRecord::Migration[4.2]
|
|
4
4
|
t.string "canvas_url"
|
5
5
|
t.string "nonce"
|
6
6
|
t.text "provider_params"
|
7
|
+
### QALAM ###
|
8
|
+
t.string "launch_tool", null: true
|
9
|
+
t.text "tool_params", null: true
|
10
|
+
### END ###
|
7
11
|
|
8
12
|
t.timestamps
|
9
13
|
end
|
10
14
|
end
|
11
|
-
end
|
15
|
+
end
|
data/lib/lti_provider/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qalam_lti_provider_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Donahue
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-07-
|
14
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|