qalam_lti_provider_engine 2.0.1 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/lti_provider/lti_controller.rb +10 -38
- data/app/models/lti_provider/launch.rb +9 -2
- data/app/views/lti_provider/lti/cookie_test.html.erb +1 -1
- data/config/lti_xml.yml.example +21 -2
- data/db/migrate/20130319050003_create_lti_provider_launches.rb +5 -1
- data/lib/lti_provider/lti_application.rb +22 -0
- data/lib/lti_provider/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6ccfc573b45088fcf5f6f7a2baab432a14cd2dca48f112002571d38332d8a0c
|
4
|
+
data.tar.gz: e6bf0833f875d030751470feed9cb6b2c6370f62ce121ff7fe86cd8e2626a8aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2e90003e78e5b64fe4ebd49c63de0e5fe115cde52a449e3bb3811065ca4c80f10fc121b094164befe58cf11dec3730214c831b1378b6578eaa32d766de5dbbb
|
7
|
+
data.tar.gz: ad8ccaf97941edabfabf5756c099c8d7cc57122ee5830adedf31377dd19fd7a0297c20bdaa644b596318afadb917ad4b7faf6af8652fe63eb69c44ba84943757
|
@@ -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
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<p>
|
2
2
|
It appears your browser is blocking cookies. You can try
|
3
|
-
<%= link_to "launching the tool in a new window", consume_launch_url(nonce: params[:nonce]
|
3
|
+
<%= link_to "launching the tool in a new window", consume_launch_url(nonce: params[:nonce]), target: '_blank' %>.
|
4
4
|
</p>
|
data/config/lti_xml.yml.example
CHANGED
@@ -7,10 +7,29 @@ default: &default
|
|
7
7
|
privacy_level: 'public'
|
8
8
|
|
9
9
|
# url defaults to lti_launch_url, but can be overridden in each of these
|
10
|
-
|
10
|
+
account_navigation:
|
11
11
|
text: 'Dummy'
|
12
12
|
visibility: 'admins'
|
13
|
-
|
13
|
+
url: 'ssd'
|
14
|
+
enabled: true
|
15
|
+
default: 'enabled'
|
16
|
+
windowTarget: '_self'
|
17
|
+
custom_fields:
|
18
|
+
key1: 'value1'
|
19
|
+
labels:
|
20
|
+
en: 'Attendance'
|
21
|
+
ar: 'الحضور'
|
22
|
+
# course_navigation and user_navigation are also available with similar options
|
23
|
+
|
24
|
+
editor_button:
|
25
|
+
enabled: true
|
26
|
+
icon_url: ''
|
27
|
+
selection_width: ''
|
28
|
+
selection_height: ''
|
29
|
+
labels:
|
30
|
+
en: ''
|
31
|
+
ar: ''
|
32
|
+
|
14
33
|
|
15
34
|
development:
|
16
35
|
<<: *default
|
@@ -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
|
@@ -53,6 +53,28 @@ module LtiProvider
|
|
53
53
|
session[:user_roles]
|
54
54
|
end
|
55
55
|
|
56
|
+
### QALAM ###
|
57
|
+
def launch_tool
|
58
|
+
session[:launch_tool]
|
59
|
+
end
|
60
|
+
|
61
|
+
def student_launch?
|
62
|
+
user_roles.split(',').include? 'urn:lti:role:ims/lis/Learner'
|
63
|
+
end
|
64
|
+
|
65
|
+
def teacher_launch?
|
66
|
+
user_roles.split(',').include? 'urn:lti:role:ims/lis/Instructor'
|
67
|
+
end
|
68
|
+
|
69
|
+
def account_admin_launch?
|
70
|
+
user_roles.split(',').include? 'urn:lti:instrole:ims/lis/Administrator'
|
71
|
+
end
|
72
|
+
|
73
|
+
def root_admin_launch?
|
74
|
+
user_roles.split(',').include? 'urn:lti:sysrole:ims/lis/SysAdmin'
|
75
|
+
end
|
76
|
+
### END ###
|
77
|
+
|
56
78
|
def not_acceptable
|
57
79
|
render plain: "Unable to process request", status: 406
|
58
80
|
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.5
|
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-
|
14
|
+
date: 2021-08-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '4.2'
|
23
23
|
- - "<"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: '
|
25
|
+
version: '6.1'
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -32,21 +32,21 @@ dependencies:
|
|
32
32
|
version: '4.2'
|
33
33
|
- - "<"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '6.1'
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
37
|
+
name: qalam_ims_lti
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '0'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '0'
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: sqlite3
|
52
52
|
requirement: !ruby/object:Gem::Requirement
|