coalescing_panda 4.1.12 → 4.1.13

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
  SHA1:
3
- metadata.gz: e582faf4e257cd6f9b0360bf944d9ecc409d68bd
4
- data.tar.gz: fa0eb65cccf9239f4456de300538e42e45969510
3
+ metadata.gz: a57e9fac9340339b324a52145f20eb73ba28c663
4
+ data.tar.gz: 4bf093296076e9e62f387f5055abca2e2798a7b1
5
5
  SHA512:
6
- metadata.gz: e3a9b034241743508c58b7893d361bbdadae0b14e26a3c0c415b572d3a420368918bac2a318c9ce4e799d97b64e94dfb1a51b13d7d6e77da93ed061c3f98766f
7
- data.tar.gz: bbfbd4409297b27e2fbba9224304dc234f78bca7152c04daa143f91d5f8944f66f521f0cd0bed52f9ff3c7245fa697fb452a7166260b2c4ca886870c421bb5c5
6
+ metadata.gz: 9ca621611fdd63a2966a436295ead5cae020bc84491d2beef4df995b4c3891b00dfd2b9731dfc3ca4db4101cd50b6a314e728423a0e3bb2df7689b79c80ebbdf
7
+ data.tar.gz: 2ef1f4235da353d15c3e7917f64d5a7627df979099f4f39979167da8608d08d00f06bf2211b02872603307bf5e28d73a5353810529c0ca8ef7b6e0e662732158
@@ -7,13 +7,9 @@ module CoalescingPanda
7
7
  if lti_authorize!(*roles)
8
8
  user_id = params['user_id']
9
9
  launch_presentation_return_url = @lti_account.settings[:launch_presentation_return_url] || params['launch_presentation_return_url']
10
+ launch_presentation_return_url = [BearcatUri.new(request.env["HTTP_REFERER"]).prefix, launch_presentation_return_url].join unless launch_presentation_return_url.include?('http')
10
11
  uri = BearcatUri.new(launch_presentation_return_url)
11
- @lti_params = params.to_hash
12
- session['user_id'] = user_id
13
- session['uri'] = launch_presentation_return_url
14
- session['lis_person_sourcedid'] = params['lis_person_sourcedid']
15
- session['oauth_consumer_key'] = params['oauth_consumer_key']
16
- session['custom_canvas_account_id'] = params['custom_canvas_account_id']
12
+ set_session(launch_presentation_return_url)
17
13
 
18
14
  if token = CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id, uri.api_domain).pluck(:api_token).first
19
15
  @client = Bearcat::Client.new(token: token, prefix: uri.prefix)
@@ -25,6 +21,7 @@ module CoalescingPanda
25
21
  @canvas_url = client.auth_redirect_url(client_id, redirect_url)
26
22
 
27
23
  #delete the added params so the original oauth sig still works
24
+ @lti_params = params.to_hash
28
25
  @lti_params.delete('action')
29
26
  @lti_params.delete('controller')
30
27
  render 'coalescing_panda/oauth2/oauth2', layout: 'coalescing_panda/application'
@@ -32,6 +29,14 @@ module CoalescingPanda
32
29
  end
33
30
  end
34
31
 
32
+ def set_session(launch_presentation_return_url)
33
+ session['user_id'] = params['user_id']
34
+ session['uri'] = launch_presentation_return_url
35
+ session['lis_person_sourcedid'] = params['lis_person_sourcedid']
36
+ session['oauth_consumer_key'] = params['oauth_consumer_key']
37
+ session['custom_canvas_account_id'] = params['custom_canvas_account_id']
38
+ end
39
+
35
40
  def have_session?
36
41
  if params['tool_consumer_instance_guid'] && session['user_id'] != params['user_id']
37
42
  reset_session
@@ -61,9 +66,7 @@ module CoalescingPanda
61
66
  logger.info 'not authorized on roles' if !authorized
62
67
  authorized = authorized && @lti_account.validate_nonce(params['oauth_nonce'], DateTime.strptime(params['oauth_timestamp'], '%s'))
63
68
  logger.info 'not authorized on nonce' if !authorized
64
- if !authorized
65
- render :text => 'Invalid Credentials, please contact your Administrator.', :status => :unauthorized
66
- end
69
+ render :text => 'Invalid Credentials, please contact your Administrator.', :status => :unauthorized unless authorized
67
70
  authorized
68
71
  end
69
72
 
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '4.1.12'
2
+ VERSION = '4.1.13'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.12
4
+ version: 4.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-24 00:00:00.000000000 Z
13
+ date: 2015-06-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails