qalam_lti_provider_engine 2.0.9 → 2.1.0
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: ffc7781e66b1cae37477f81e36d212e3e52a115aa49e908a8954dda144d05ede
|
4
|
+
data.tar.gz: ee3ad8f02faa0314cea6192a5d264935d5b0ecb8d10b9622125acc4c635fd608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d180b3146931ff792403020def0d9b562dedd791fd3ec5f869199736d11501390675b9003c4701b1f0354ce2477808ce23c8e565749df339b79858efcd57b86c
|
7
|
+
data.tar.gz: d5cd47670bef6e30fb0f4764e7c4c509aa21083edc8afd44aaffce076f2caad9d90dd0b2c67d0b96bd2816b2702b75a9fab5f0e4fc3b8e42b8a1998fc3dd8bd3
|
@@ -4,23 +4,20 @@ require 'colorize'
|
|
4
4
|
module LtiProvider
|
5
5
|
class LtiController < LtiProvider::LtiApplicationController
|
6
6
|
skip_before_action :require_lti_launch
|
7
|
-
|
7
|
+
skip_before_action :verify_authenticity_token, only: :launch, if: :digital_library?
|
8
8
|
|
9
9
|
def launch
|
10
10
|
tool_key = params['oauth_consumer_key']
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
if canvas_url_domain && ToolLtiKey.table_exists?
|
12
|
+
tool_lti_key = ToolLtiKey.where(key: tool_key).where('lower(canvas_url) LIKE :q', q: "%#{canvas_url_domain.downcase}%" ).first
|
13
|
+
tool_secret = tool_lti_key&.secret or LtiProvider::Config.secret
|
14
|
+
else
|
15
|
+
tool_secret = LtiProvider::Config.secret
|
16
|
+
end
|
17
17
|
|
18
18
|
provider = IMS::LTI::ToolProvider.new(tool_key, tool_secret, params)
|
19
19
|
launch = Launch.initialize_from_request(provider, request)
|
20
20
|
|
21
|
-
# puts launch.inspect.red
|
22
|
-
# puts request.origin.inspect.green
|
23
|
-
# puts request.base_url.inspect.yellow
|
24
21
|
if !launch.valid_provider?
|
25
22
|
msg = "#{launch.lti_errormsg} Please be sure you are launching this tool from the link provided in Qalam."
|
26
23
|
return show_error msg
|
@@ -34,7 +31,7 @@ module LtiProvider
|
|
34
31
|
end
|
35
32
|
### END ###
|
36
33
|
else
|
37
|
-
# if params[:
|
34
|
+
# if params[:qalam_url] && params[:launch_tool] == 'digital_library'
|
38
35
|
# redirect_to main_app.root_path and return
|
39
36
|
# else
|
40
37
|
return show_error "Unable to launch #{LtiProvider::XmlConfig.tool_title}. Please check your External Tools configuration and try again."
|
@@ -109,5 +106,9 @@ module LtiProvider
|
|
109
106
|
return domain
|
110
107
|
end
|
111
108
|
end
|
109
|
+
|
110
|
+
def digital_library?
|
111
|
+
session[:qalam_url] ? true : false
|
112
|
+
end
|
112
113
|
end
|
113
114
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'colorize'
|
2
3
|
|
3
4
|
module LtiProvider
|
4
5
|
module LtiConfig
|
@@ -13,12 +14,12 @@ module LtiProvider
|
|
13
14
|
def self.setup!
|
14
15
|
config = LtiProvider::Config
|
15
16
|
if File.exists?(config_file)
|
16
|
-
Rails.logger.info "Initializing LTI key and secret using configuration in #{config_file}"
|
17
|
+
Rails.logger.info "Initializing LTI key and secret using configuration in #{config_file}".green
|
17
18
|
load_config.each do |k,v|
|
18
19
|
config.send("#{k}=", v)
|
19
20
|
end
|
20
21
|
elsif ENV['LTI_KEY'].present? && ENV['LTI_SECRET'].present?
|
21
|
-
Rails.logger.info "Initializing LTI key and secret using environment vars LTI_KEY and LTI_SECRET"
|
22
|
+
Rails.logger.info "Initializing LTI key and secret using environment vars LTI_KEY and LTI_SECRET".green
|
22
23
|
config.key = ENV['LTI_KEY']
|
23
24
|
config.secret = ENV['LTI_SECRET']
|
24
25
|
config.require_canvas = !!ENV['LTI_REQUIRE_CANVAS']
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'colorize'
|
3
|
+
|
1
4
|
module LtiProvider
|
2
5
|
module LtiXmlConfig
|
3
6
|
def self.load_config
|
@@ -11,7 +14,7 @@ module LtiProvider
|
|
11
14
|
def self.setup!
|
12
15
|
config = LtiProvider::XmlConfig
|
13
16
|
if File.exists?(config_file)
|
14
|
-
Rails.logger.info "Initializing LTI XML config using configuration in #{config_file}"
|
17
|
+
Rails.logger.info "Initializing LTI XML config using configuration in #{config_file}".green
|
15
18
|
load_config.each do |k,v|
|
16
19
|
config.send("#{k}=", v)
|
17
20
|
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.1.0
|
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-08-
|
14
|
+
date: 2021-08-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -47,6 +47,20 @@ dependencies:
|
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: colorize
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
50
64
|
- !ruby/object:Gem::Dependency
|
51
65
|
name: sqlite3
|
52
66
|
requirement: !ruby/object:Gem::Requirement
|