From e900a06c2955ae23d4f50b411d922300388881b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ranko=20Radoni=C4=87?= Date: Tue, 5 Apr 2016 17:45:27 +0200 Subject: [PATCH 1/7] rename migration class to match file name on recent versions of rails, migrations fail if the class name differs from the file name --- lti2_tp/db/migrate/20151111000001_reload_tp_db.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb b/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb index ea22c95..a7abba7 100644 --- a/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb +++ b/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb @@ -1,4 +1,4 @@ -class CreateLti2TpResources < ActiveRecord::Migration +class ReloadTpDb < ActiveRecord::Migration def up create_table "lti2_tp_registrations", force: true do |t| t.integer "tenant_id" From f28aa434ce038fead488a7f2ad5ffac644bd22e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ranko=20Radoni=C4=87?= Date: Tue, 5 Apr 2016 17:55:50 +0200 Subject: [PATCH 2/7] drop lti_registration_wips when rolling back --- lti2_tp/db/migrate/20151111000001_reload_tp_db.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb b/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb index a7abba7..c8ab378 100644 --- a/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb +++ b/lti2_tp/db/migrate/20151111000001_reload_tp_db.rb @@ -62,5 +62,6 @@ def down drop_table :lti2_tp_registrations drop_table :lti2_tp_registries drop_table :lti2_tp_tools + drop_table :lti_registration_wips end end From 2744b11bcc0b2655f8b775230c222ef5539fc9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ranko=20Radoni=C4=87?= Date: Wed, 13 Apr 2016 11:11:44 +0200 Subject: [PATCH 3/7] remove mysql as dependency --- lti2_tp/Gemfile.lock | 94 ----------------------------------------- lti2_tp/lti2_tp.gemspec | 3 -- 2 files changed, 97 deletions(-) delete mode 100644 lti2_tp/Gemfile.lock diff --git a/lti2_tp/Gemfile.lock b/lti2_tp/Gemfile.lock deleted file mode 100644 index 184fc5b..0000000 --- a/lti2_tp/Gemfile.lock +++ /dev/null @@ -1,94 +0,0 @@ -PATH - remote: . - specs: - lti2_tp (0.0.2) - mysql2 (~> 0.3.13) - rails (~> 4.1.1) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.1.5) - actionpack (= 4.1.5) - actionview (= 4.1.5) - mail (~> 2.5.4) - actionpack (4.1.5) - actionview (= 4.1.5) - activesupport (= 4.1.5) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.5) - activesupport (= 4.1.5) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.5) - activesupport (= 4.1.5) - builder (~> 3.1) - activerecord (4.1.5) - activemodel (= 4.1.5) - activesupport (= 4.1.5) - arel (~> 5.0.0) - activesupport (4.1.5) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - arel (5.0.1.20140414130214) - builder (3.2.2) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.11) - json (1.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (5.4.1) - multi_json (1.10.1) - mysql2 (0.3.16) - polyglot (0.3.5) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rails (4.1.5) - actionmailer (= 4.1.5) - actionpack (= 4.1.5) - actionview (= 4.1.5) - activemodel (= 4.1.5) - activerecord (= 4.1.5) - activesupport (= 4.1.5) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.5) - sprockets-rails (~> 2.0) - railties (4.1.5) - actionpack (= 4.1.5) - activesupport (= 4.1.5) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.3.2) - sprockets (2.12.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.1.4) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - sqlite3 (1.3.8) - thor (0.19.1) - thread_safe (0.3.4) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (1.2.2) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - lti2_tp! - sqlite3 diff --git a/lti2_tp/lti2_tp.gemspec b/lti2_tp/lti2_tp.gemspec index da6bcb2..e9cc09a 100644 --- a/lti2_tp/lti2_tp.gemspec +++ b/lti2_tp/lti2_tp.gemspec @@ -5,7 +5,6 @@ require 'lti2_tp/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = 'lti2_tp' s.version = Lti2Tp::VERSION s.authors = ['John Tibbetts'] @@ -20,8 +19,6 @@ Gem::Specification.new do |s| s.required_ruby_version = '~> 2.0.0' s.add_dependency 'rails' - s.add_dependency 'mysql2', '~> 0.3.13' s.add_development_dependency 'sqlite3' - end From b6f773cb6d900fec19572a99290b90ded423d2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ranko=20Radoni=C4=87?= Date: Wed, 13 Apr 2016 11:13:19 +0200 Subject: [PATCH 4/7] remove mysql dependency from tc --- lti2_tc/Gemfile.lock | 94 ----------------------------------------- lti2_tc/lti2_tc.gemspec | 3 -- 2 files changed, 97 deletions(-) delete mode 100644 lti2_tc/Gemfile.lock diff --git a/lti2_tc/Gemfile.lock b/lti2_tc/Gemfile.lock deleted file mode 100644 index e42d6d9..0000000 --- a/lti2_tc/Gemfile.lock +++ /dev/null @@ -1,94 +0,0 @@ -PATH - remote: . - specs: - lti2_tc (0.0.2) - mysql2 (~> 0.3.13) - rails (~> 4.1.1) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.1.5) - actionpack (= 4.1.5) - actionview (= 4.1.5) - mail (~> 2.5.4) - actionpack (4.1.5) - actionview (= 4.1.5) - activesupport (= 4.1.5) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.5) - activesupport (= 4.1.5) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.5) - activesupport (= 4.1.5) - builder (~> 3.1) - activerecord (4.1.5) - activemodel (= 4.1.5) - activesupport (= 4.1.5) - arel (~> 5.0.0) - activesupport (4.1.5) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - arel (5.0.1.20140414130214) - builder (3.2.2) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.11) - json (1.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (5.4.1) - multi_json (1.10.1) - mysql2 (0.3.16) - polyglot (0.3.5) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rails (4.1.5) - actionmailer (= 4.1.5) - actionpack (= 4.1.5) - actionview (= 4.1.5) - activemodel (= 4.1.5) - activerecord (= 4.1.5) - activesupport (= 4.1.5) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.5) - sprockets-rails (~> 2.0) - railties (4.1.5) - actionpack (= 4.1.5) - activesupport (= 4.1.5) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.3.2) - sprockets (2.12.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.1.4) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - sqlite3 (1.3.8) - thor (0.19.1) - thread_safe (0.3.4) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (1.2.2) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - lti2_tc! - sqlite3 diff --git a/lti2_tc/lti2_tc.gemspec b/lti2_tc/lti2_tc.gemspec index 29cb9ee..1b54fee 100644 --- a/lti2_tc/lti2_tc.gemspec +++ b/lti2_tc/lti2_tc.gemspec @@ -5,7 +5,6 @@ require 'lti2_tc/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = 'lti2_tc' s.version = Lti2Tc::VERSION s.authors = ['John Tibbetts'] @@ -20,8 +19,6 @@ Gem::Specification.new do |s| s.required_ruby_version = '~> 2.0.0' s.add_dependency 'rails' - s.add_dependency 'mysql2', '~> 0.3.13' s.add_development_dependency 'sqlite3' - end From 21532a0bd4311cdd4e08b47712aedb129ac9480b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ranko=20Radoni=C4=87?= Date: Wed, 13 Apr 2016 12:55:18 +0200 Subject: [PATCH 5/7] include MessageSupport module the call to invoke_unsigned_service was failing without it --- lti2_tp/app/models/lti2_tp/registration.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lti2_tp/app/models/lti2_tp/registration.rb b/lti2_tp/app/models/lti2_tp/registration.rb index 543c681..993acfa 100644 --- a/lti2_tp/app/models/lti2_tp/registration.rb +++ b/lti2_tp/app/models/lti2_tp/registration.rb @@ -1,5 +1,6 @@ module Lti2Tp class Registration < ActiveRecord::Base + include Lti2Commons::MessageSupport ACKNOWLEDGE_URL = 'VND-IMS-CONFIRM-URL' HTTP_ACKNOWLEDGE_URL = 'HTTP_VND_IMS_CONFIRM_URL' From c5ce6f732599a9fa4de916bcc176d30dc8c0b181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ranko=20Radoni=C4=87?= Date: Wed, 13 Apr 2016 13:13:47 +0200 Subject: [PATCH 6/7] fix hardcoded wirelog path the hardcoded path was causing an error during logging because the directory doesn't exist. store the wirelog in the log/ directory of the current rails app instead. --- lti2_tp/config/initializers/lti2_tp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lti2_tp/config/initializers/lti2_tp.rb b/lti2_tp/config/initializers/lti2_tp.rb index 1e58478..4d065ed 100644 --- a/lti2_tp/config/initializers/lti2_tp.rb +++ b/lti2_tp/config/initializers/lti2_tp.rb @@ -8,4 +8,4 @@ Rails.application.config.tool_provider_registry = Lti2Tp::ToolProviderRegistry.new end -Rails.application.config.wire_log = WireLog.new "ToolProvider", File.expand_path("../tc_sample_app/public/wirelog.html") \ No newline at end of file +Rails.application.config.wire_log = WireLog.new "ToolProvider", File.expand_path("log/wirelog.html") From d48384d54be3ba6ab0b94b3f53e66df53065afaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ranko=20Radoni=C4=87?= Date: Thu, 21 Apr 2016 15:13:04 +0200 Subject: [PATCH 7/7] add nil check --- lti2_tp/app/controllers/lti2_tp/registrations_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lti2_tp/app/controllers/lti2_tp/registrations_controller.rb b/lti2_tp/app/controllers/lti2_tp/registrations_controller.rb index 069ec10..3530190 100644 --- a/lti2_tp/app/controllers/lti2_tp/registrations_controller.rb +++ b/lti2_tp/app/controllers/lti2_tp/registrations_controller.rb @@ -99,8 +99,9 @@ def index registration = Lti2Tp::Registration.find( params[:id] ) final_hash = params.select { |k,v| [ :status, :tool_guid, :lti_errormsg, :lti_errorlog ].include? k.to_sym } final_qs = final_hash.to_query + tool_proxy_guid = params[:tool_proxy_guid] if params.has_key? :tool_proxy_guid - guid_addend = (tool_proxy_guid.empty?) ? '' : "&tool_proxy_guid=#{tool_proxy_guid}" + guid_addend = (tool_proxy_guid.nil? || tool_proxy_guid.empty?) ? '' : "&tool_proxy_guid=#{tool_proxy_guid}" final_url = "#{get_adjusted_baseurl(registration.launch_presentation_return_url)}#{final_qs}#{guid_addend}" redirect_to final_url