qalam_lti_provider_engine 1.1.6 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 966db98bfcaa29cbf05e8b3b38f270f50cc4ea27480a2245dd08804f09f502a8
4
- data.tar.gz: 2d7be0649b8c6cf2b2e34bf41224de7e31896255e58969adf109c78f9f108add
3
+ metadata.gz: 66602aec8f52d289ad48bfa0a262cedab1009769b1f6b481b53bcc7dcc4db5e4
4
+ data.tar.gz: b56291e0057f0379eb690f1eeb9ced57c6d10dbc409c5e0ebd1f3e03e6992c66
5
5
  SHA512:
6
- metadata.gz: c52b467a447ca10b21669f601caf1e31bdbd9e2e00f6cd5f2f094d8424da8c706c93ca17d476797200cf46b3cd8da7cab66cfad9a0dd312a311e1d0147da213e
7
- data.tar.gz: 5a2eb1b5611808ecc4a896c2e6e11a0e491ae3831fc6c74e0eb09bfd3aaa789c002c974be00d5f716beecc63f5cb00c143fdfd4041e6828081a6b458c0999cbe
6
+ metadata.gz: bf8c57dcec00e990c922726172ca55eb62089cecde2d9a3c32963e31a250be6378a715fd8b210bf8b629f1ce70db837770a8a569216dd28d955b1b8cf9f34893
7
+ data.tar.gz: e83b485d85dbb3f28186a7a6c806a4b36a5a37d389b2cb9e8fa430eea7a5cc37de44ca9c6c0f0c3ccb54565b3f1354bcc0ccd0876be8af6776ecab01e581bb1b
@@ -10,11 +10,20 @@ module LtiProvider
10
10
  launch = Launch.initialize_from_request(provider, request)
11
11
 
12
12
  if !launch.valid_provider?
13
- msg = "#{launch.lti_errormsg} Please be sure you are launching this tool from the link provided in Canvas."
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
15
15
  elsif launch.save
16
16
  session[:cookie_test] = true
17
- redirect_to cookie_test_path(nonce: launch.nonce, launch: params[:launch], timetable_date: params[:timetable_date], section_room: params[:section_room])
17
+
18
+ ### QALAM ###
19
+ if params[:timetable_date] && params[:section_room]
20
+ redirect_to cookie_test_path(nonce: launch.nonce, launch: params[:launch], timetable_date: params[:timetable_date], section_room: params[:section_room])
21
+ elsif params[:launch]
22
+ redirect_to cookie_test_path(nonce: launch.nonce, launch: params[:launch])
23
+ else
24
+ redirect_to cookie_test_path(nonce: launch.nonce)
25
+ end
26
+ ### END ###
18
27
  else
19
28
  return show_error "Unable to launch #{LtiProvider::XmlConfig.tool_title}. Please check your External Tools configuration and try again."
20
29
  end
@@ -23,7 +32,11 @@ module LtiProvider
23
32
  def cookie_test
24
33
  if session[:cookie_test]
25
34
  # success!!! we've got a session!
26
- consume_launch
35
+ if params[:launch] or (params[:timetable_date] && params[:section_room])
36
+ qalam_consume_launch
37
+ else
38
+ consume_launch
39
+ end
27
40
  else
28
41
  render
29
42
  end
@@ -32,6 +45,24 @@ module LtiProvider
32
45
  def consume_launch
33
46
  launch = Launch.where("created_at > ?", 5.minutes.ago).find_by_nonce(params[:nonce])
34
47
 
48
+ if launch
49
+ [: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|
51
+ session[attribute] = launch.public_send(attribute)
52
+ end
53
+
54
+ launch.destroy
55
+
56
+ redirect_to main_app.root_path
57
+ else
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
+
35
66
  puts params.inspect.yellow
36
67
 
37
68
  if launch
@@ -55,6 +86,7 @@ module LtiProvider
55
86
  return show_error "The tool was not launched successfully. Please try again."
56
87
  end
57
88
  end
89
+ ### END ###
58
90
 
59
91
  def configure
60
92
  respond_to do |format|
@@ -69,5 +101,4 @@ module LtiProvider
69
101
  render plain: message
70
102
  end
71
103
  end
72
- end
73
-
104
+ end
@@ -79,8 +79,7 @@ module LtiProvider
79
79
  "Consumer key not provided."
80
80
  elsif provider.consumer_secret.blank?
81
81
  "Consumer secret not configured on provider."
82
- ### QALAM ###
83
- elsif !provider.valid_request?(request) && false
82
+ elsif !provider.valid_request?(request)
84
83
  "The OAuth signature was invalid."
85
84
  elsif oauth_timestamp_too_old?(provider.request_oauth_timestamp)
86
85
  "Your request is too old."
@@ -18,7 +18,7 @@ module LtiProvider
18
18
  end
19
19
 
20
20
  def prompt_for_launch
21
- render plain: 'Please launch this tool from Canvas and then try again.'
21
+ render plain: 'Please launch this tool from Qalam and then try again.'
22
22
  end
23
23
 
24
24
  def canvas_url
@@ -1,3 +1,3 @@
1
1
  module LtiProvider
2
- VERSION = "1.1.6"
2
+ VERSION = "2.0.1"
3
3
  end
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: 1.1.6
4
+ version: 2.0.1
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-05-22 00:00:00.000000000 Z
14
+ date: 2021-07-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
312
  - !ruby/object:Gem::Version
313
313
  version: '0'
314
314
  requirements: []
315
- rubygems_version: 3.2.15
315
+ rubygems_version: 3.2.21
316
316
  signing_key:
317
317
  specification_version: 4
318
318
  summary: LtiProvider is a mountable engine for handling the LTI launch and exposing