coalescing_panda 4.5.1 → 4.5.2

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: c396b104f28b5730c109ffc1032ae74e9019d9f8
4
- data.tar.gz: fcf0b907eb296e5920f628f1ae6eb24dac90c816
3
+ metadata.gz: 2e07111713b8d6eaeb774afa6044d0d59c661fd1
4
+ data.tar.gz: b76fb5b1525cf9a21622832fae03732fe0035a58
5
5
  SHA512:
6
- metadata.gz: ff80cf99e27500aafd0aac299c15aba10ba3ebc2dac043bdfcca386e13d39c11f790c8096d5a23114e31f642e72a719107985b3b7f0c850334bdccd2176313a9
7
- data.tar.gz: 71c7b779e364fb04fa163b5e1512db28f4a74033c306ae85b7236bf35bee723aee8cedfecaa56a7b997feb595a52550dbdeec2b55bd84100832753908c2b4262
6
+ metadata.gz: d23b4362a0614a6c443fb02f0432349fe1a6299f984059da9787a5f468e777a4935a80ea6ba64ac052e8f5d73af5e3154c36ac44ea4c005251586cfa7d686494
7
+ data.tar.gz: 82ee595278c2891729867990e7ed13c91f5ba8cfec2492babf9a6f9807573fc1f8229c99094870299fdd85c9e6cc33fb7fe7cfcf8130345467d73e7a81f57979
@@ -17,7 +17,7 @@ module CoalescingPanda
17
17
  lti_nav[:account][:text] = params[:account_navigation_label] if params[:account_navigation_label].present?
18
18
  platform = 'canvas.instructure.com'
19
19
  host = "#{request.scheme}://#{request.host_with_port}"
20
- tc = IMS::LTI::ToolConfig.new(:title => lti_options[:title], :launch_url => ("#{host}#{lti_options[:launch_route]}") || 'ABC')
20
+ tc = IMS::LTI::Services::ToolConfig.new(:title => lti_options[:title], :launch_url => ("#{host}#{lti_options[:launch_route]}") || 'ABC')
21
21
  tc.set_ext_param(platform, :domain, request.host)
22
22
  tc.set_ext_param(platform, :privacy_level, 'public')
23
23
  tc.set_custom_param(:custom_canvas_role, '$Canvas.membership.roles')
@@ -100,8 +100,8 @@ module CoalescingPanda
100
100
  def lti_authorize!(*roles)
101
101
  authorized = false
102
102
  if @lti_account = params['oauth_consumer_key'] && LtiAccount.find_by_key(params['oauth_consumer_key'])
103
- @tp = IMS::LTI::ToolProvider.new(@lti_account.key, @lti_account.secret, params)
104
- authorized = @tp.valid_request?(request)
103
+ authentiactor = IMS::LTI::Services::MessageAuthenticator.new(request.original_url, request.request_parameters, @lti_account.secret)
104
+ authorized = authentiactor.valid_signature?
105
105
  end
106
106
  logger.info 'not authorized on tp valid request' if !authorized
107
107
  authorized = authorized && (roles.count == 0 || (roles & lti_roles).count > 0)
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '4.5.1'
2
+ VERSION = '4.5.2'
3
3
  end
@@ -10,6 +10,7 @@ describe CoalescingPanda::Oauth2Controller, :type => :controller do
10
10
  ENV['OAUTH_PROTOCOL'] = 'http'
11
11
  Bearcat::Client.any_instance.stub(retrieve_token: { 'access_token' => 'token', 'refresh_token' => 'token', 'expires_in' => 3600 })
12
12
  session[:state] = 'test'
13
+ CoalescingPanda::OauthState.create!(state_key: session[:state], data: { key: account.key, user_id: user.id, api_domain: 'foo.com' })
13
14
  get :redirect, {user_id: user.id, api_domain: 'foo.com', code: 'bar', key: account.key, state: 'test'}
14
15
  auth = CoalescingPanda::CanvasApiAuth.find_by_user_id_and_api_domain(user.id, 'foo.com')
15
16
  auth.should_not == nil
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150811140030) do
14
+ ActiveRecord::Schema.define(version: 20160830183155) do
15
15
 
16
16
  create_table "coalescing_panda_assignment_groups", force: :cascade do |t|
17
17
  t.integer "coalescing_panda_course_id", null: false
@@ -30,11 +30,11 @@ ActiveRecord::Schema.define(version: 20150811140030) do
30
30
  add_index "coalescing_panda_assignment_groups", ["coalescing_panda_course_id", "canvas_assignment_group_id"], name: "index_assignment_group_course", unique: true
31
31
 
32
32
  create_table "coalescing_panda_assignments", force: :cascade do |t|
33
- t.integer "coalescing_panda_course_id", null: false
34
- t.string "name", limit: 255
33
+ t.integer "coalescing_panda_course_id", null: false
34
+ t.string "name"
35
35
  t.text "description"
36
- t.string "canvas_assignment_id", limit: 255, null: false
37
- t.string "workflow_state", limit: 255
36
+ t.string "canvas_assignment_id", null: false
37
+ t.string "workflow_state"
38
38
  t.float "points_possible"
39
39
  t.datetime "due_at"
40
40
  t.datetime "unlock_at"
@@ -52,35 +52,37 @@ ActiveRecord::Schema.define(version: 20150811140030) do
52
52
  add_index "coalescing_panda_assignments", ["coalescing_panda_course_id", "canvas_assignment_id"], name: "index_assignments_course", unique: true
53
53
 
54
54
  create_table "coalescing_panda_canvas_api_auths", force: :cascade do |t|
55
- t.string "user_id", limit: 255
56
- t.string "api_domain", limit: 255
57
- t.string "api_token", limit: 255
55
+ t.string "user_id"
56
+ t.string "api_domain"
57
+ t.string "api_token"
58
58
  t.datetime "created_at"
59
59
  t.datetime "updated_at"
60
+ t.string "refresh_token"
61
+ t.datetime "expires_at"
60
62
  end
61
63
 
62
64
  create_table "coalescing_panda_canvas_batches", force: :cascade do |t|
63
- t.float "percent_complete", default: 0.0
64
- t.string "status", limit: 255
65
+ t.float "percent_complete", default: 0.0
66
+ t.string "status"
65
67
  t.text "message"
66
68
  t.datetime "created_at"
67
69
  t.datetime "updated_at"
68
70
  t.integer "context_id"
69
- t.string "context_type", limit: 255
71
+ t.string "context_type"
70
72
  t.integer "coalescing_panda_lti_account_id"
71
73
  t.text "options"
72
74
  end
73
75
 
74
76
  create_table "coalescing_panda_courses", force: :cascade do |t|
75
- t.integer "coalescing_panda_lti_account_id", null: false
77
+ t.integer "coalescing_panda_lti_account_id", null: false
76
78
  t.integer "coalescing_panda_term_id"
77
- t.string "name", limit: 255
78
- t.string "canvas_course_id", limit: 255, null: false
79
- t.string "sis_id", limit: 255
79
+ t.string "name"
80
+ t.string "canvas_course_id", null: false
81
+ t.string "sis_id"
80
82
  t.datetime "start_at"
81
83
  t.datetime "conclude_at"
82
- t.string "workflow_state", limit: 255
83
- t.string "course_code", limit: 255
84
+ t.string "workflow_state"
85
+ t.string "course_code"
84
86
  t.datetime "created_at"
85
87
  t.datetime "updated_at"
86
88
  end
@@ -90,12 +92,12 @@ ActiveRecord::Schema.define(version: 20150811140030) do
90
92
  add_index "coalescing_panda_courses", ["sis_id"], name: "index_coalescing_panda_courses_on_sis_id"
91
93
 
92
94
  create_table "coalescing_panda_enrollments", force: :cascade do |t|
93
- t.integer "coalescing_panda_user_id", null: false
94
- t.integer "coalescing_panda_section_id", null: false
95
- t.string "workflow_state", limit: 255
96
- t.string "sis_id", limit: 255
97
- t.string "canvas_enrollment_id", limit: 255, null: false
98
- t.string "enrollment_type", limit: 255
95
+ t.integer "coalescing_panda_user_id", null: false
96
+ t.integer "coalescing_panda_section_id", null: false
97
+ t.string "workflow_state"
98
+ t.string "sis_id"
99
+ t.string "canvas_enrollment_id", null: false
100
+ t.string "enrollment_type"
99
101
  t.datetime "start_at"
100
102
  t.datetime "end_at"
101
103
  t.datetime "created_at"
@@ -119,8 +121,8 @@ ActiveRecord::Schema.define(version: 20150811140030) do
119
121
  create_table "coalescing_panda_group_memberships", force: :cascade do |t|
120
122
  t.integer "coalescing_panda_group_id"
121
123
  t.integer "coalescing_panda_user_id"
122
- t.string "canvas_group_membership_id", limit: 255
123
- t.string "workflow_state", limit: 255
124
+ t.string "canvas_group_membership_id"
125
+ t.string "workflow_state"
124
126
  t.datetime "created_at"
125
127
  t.datetime "updated_at"
126
128
  t.boolean "moderator"
@@ -130,11 +132,11 @@ ActiveRecord::Schema.define(version: 20150811140030) do
130
132
 
131
133
  create_table "coalescing_panda_groups", force: :cascade do |t|
132
134
  t.integer "context_id"
133
- t.string "context_type", limit: 255
134
- t.string "description", limit: 255
135
- t.string "group_category_id", limit: 255
136
- t.string "canvas_group_id", limit: 255
137
- t.string "name", limit: 255
135
+ t.string "context_type"
136
+ t.string "description"
137
+ t.string "group_category_id"
138
+ t.string "canvas_group_id"
139
+ t.string "name"
138
140
  t.integer "members_count"
139
141
  t.datetime "created_at"
140
142
  t.datetime "updated_at"
@@ -145,12 +147,12 @@ ActiveRecord::Schema.define(version: 20150811140030) do
145
147
  add_index "coalescing_panda_groups", ["context_id", "canvas_group_id"], name: "index_groups_context_and_group_id", unique: true
146
148
 
147
149
  create_table "coalescing_panda_lti_accounts", force: :cascade do |t|
148
- t.string "name", limit: 255
149
- t.string "key", limit: 255
150
- t.string "secret", limit: 255
151
- t.string "oauth2_client_id", limit: 255
152
- t.string "oauth2_client_key", limit: 255
153
- t.string "canvas_account_id", limit: 255
150
+ t.string "name"
151
+ t.string "key"
152
+ t.string "secret"
153
+ t.string "oauth2_client_id"
154
+ t.string "oauth2_client_key"
155
+ t.string "canvas_account_id"
154
156
  t.text "settings"
155
157
  t.datetime "created_at"
156
158
  t.datetime "updated_at"
@@ -158,16 +160,25 @@ ActiveRecord::Schema.define(version: 20150811140030) do
158
160
 
159
161
  create_table "coalescing_panda_lti_nonces", force: :cascade do |t|
160
162
  t.integer "coalescing_panda_lti_account_id"
161
- t.string "nonce", limit: 255
163
+ t.string "nonce"
162
164
  t.datetime "timestamp"
163
165
  end
164
166
 
167
+ create_table "coalescing_panda_oauth_states", force: :cascade do |t|
168
+ t.string "state_key"
169
+ t.text "data"
170
+ t.datetime "created_at"
171
+ t.datetime "updated_at"
172
+ end
173
+
174
+ add_index "coalescing_panda_oauth_states", ["state_key"], name: "index_coalescing_panda_oauth_states_on_state_key", unique: true
175
+
165
176
  create_table "coalescing_panda_sections", force: :cascade do |t|
166
- t.integer "coalescing_panda_course_id", null: false
167
- t.string "name", limit: 255
168
- t.string "canvas_section_id", limit: 255, null: false
169
- t.string "sis_id", limit: 255
170
- t.string "workflow_state", limit: 255
177
+ t.integer "coalescing_panda_course_id", null: false
178
+ t.string "name"
179
+ t.string "canvas_section_id", null: false
180
+ t.string "sis_id"
181
+ t.string "workflow_state"
171
182
  t.datetime "start_at"
172
183
  t.datetime "end_at"
173
184
  t.datetime "created_at"
@@ -178,21 +189,21 @@ ActiveRecord::Schema.define(version: 20150811140030) do
178
189
  add_index "coalescing_panda_sections", ["sis_id"], name: "index_coalescing_panda_sections_on_sis_id"
179
190
 
180
191
  create_table "coalescing_panda_sessions", force: :cascade do |t|
181
- t.string "token", limit: 255
192
+ t.string "token"
182
193
  t.text "data"
183
194
  t.datetime "created_at"
184
195
  t.datetime "updated_at"
185
196
  end
186
197
 
187
198
  create_table "coalescing_panda_submissions", force: :cascade do |t|
188
- t.integer "coalescing_panda_user_id", null: false
189
- t.integer "coalescing_panda_assignment_id", null: false
190
- t.string "url", limit: 255
191
- t.string "grade", limit: 255
192
- t.string "score", limit: 255
199
+ t.integer "coalescing_panda_user_id", null: false
200
+ t.integer "coalescing_panda_assignment_id", null: false
201
+ t.string "url"
202
+ t.string "grade"
203
+ t.string "score"
193
204
  t.datetime "submitted_at"
194
- t.string "workflow_state", limit: 255
195
- t.string "canvas_submission_id", limit: 255, null: false
205
+ t.string "workflow_state"
206
+ t.string "canvas_submission_id", null: false
196
207
  t.datetime "created_at"
197
208
  t.datetime "updated_at"
198
209
  end
@@ -201,14 +212,14 @@ ActiveRecord::Schema.define(version: 20150811140030) do
201
212
  add_index "coalescing_panda_submissions", ["coalescing_panda_user_id", "coalescing_panda_assignment_id", "canvas_submission_id"], name: "index_submissions_user_and_assignment", unique: true
202
213
 
203
214
  create_table "coalescing_panda_terms", force: :cascade do |t|
204
- t.integer "coalescing_panda_lti_account_id", null: false
205
- t.string "name", limit: 255
206
- t.string "code", limit: 255
207
- t.string "sis_id", limit: 255
208
- t.string "canvas_term_id", limit: 255, null: false
215
+ t.integer "coalescing_panda_lti_account_id", null: false
216
+ t.string "name"
217
+ t.string "code"
218
+ t.string "sis_id"
219
+ t.string "canvas_term_id", null: false
209
220
  t.datetime "start_at"
210
221
  t.datetime "end_at"
211
- t.string "workflow_state", limit: 255
222
+ t.string "workflow_state"
212
223
  t.datetime "created_at"
213
224
  t.datetime "updated_at"
214
225
  end
@@ -217,13 +228,13 @@ ActiveRecord::Schema.define(version: 20150811140030) do
217
228
  add_index "coalescing_panda_terms", ["sis_id"], name: "index_coalescing_panda_terms_on_sis_id"
218
229
 
219
230
  create_table "coalescing_panda_users", force: :cascade do |t|
220
- t.integer "coalescing_panda_lti_account_id", null: false
221
- t.string "name", limit: 255
222
- t.string "email", limit: 255
223
- t.string "roles", limit: 255
224
- t.string "workflow_state", limit: 255
225
- t.string "sis_id", limit: 255
226
- t.string "canvas_user_id", limit: 255, null: false
231
+ t.integer "coalescing_panda_lti_account_id", null: false
232
+ t.string "name"
233
+ t.string "email"
234
+ t.string "roles"
235
+ t.string "workflow_state"
236
+ t.string "sis_id"
237
+ t.string "canvas_user_id", null: false
227
238
  t.datetime "created_at"
228
239
  t.datetime "updated_at"
229
240
  t.string "login_id"
@@ -233,15 +244,15 @@ ActiveRecord::Schema.define(version: 20150811140030) do
233
244
  add_index "coalescing_panda_users", ["sis_id"], name: "index_coalescing_panda_users_on_sis_id"
234
245
 
235
246
  create_table "delayed_jobs", force: :cascade do |t|
236
- t.integer "priority", default: 0, null: false
237
- t.integer "attempts", default: 0, null: false
238
- t.text "handler", null: false
247
+ t.integer "priority", default: 0, null: false
248
+ t.integer "attempts", default: 0, null: false
249
+ t.text "handler", null: false
239
250
  t.text "last_error"
240
251
  t.datetime "run_at"
241
252
  t.datetime "locked_at"
242
253
  t.datetime "failed_at"
243
- t.string "locked_by", limit: 255
244
- t.string "queue", limit: 255
254
+ t.string "locked_by"
255
+ t.string "queue"
245
256
  t.datetime "created_at"
246
257
  t.datetime "updated_at"
247
258
  end
@@ -10,6 +10,7 @@ require 'delayed_job_active_record'
10
10
  require 'factory_girl_rails'
11
11
  require 'pry'
12
12
  require 'webmock/rspec'
13
+ require 'database_cleaner'
13
14
 
14
15
  WebMock.disable_net_connect!
15
16
 
@@ -63,6 +64,17 @@ RSpec.configure do |config|
63
64
  mocks.verify_partial_doubles = true
64
65
  end
65
66
 
67
+ config.before(:suite) do
68
+ DatabaseCleaner.strategy = :transaction
69
+ DatabaseCleaner.clean_with(:truncation)
70
+ end
71
+
72
+ config.around(:each) do |example|
73
+ DatabaseCleaner.cleaning do
74
+ example.run
75
+ end
76
+ end
77
+
66
78
  # The settings below are suggested to provide a good initial experience
67
79
  # with RSpec, but feel free to customize to your heart's content.
68
80
  =begin
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.5.1
4
+ version: 4.5.2
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: 2017-04-19 00:00:00.000000000 Z
13
+ date: 2017-04-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -60,14 +60,14 @@ dependencies:
60
60
  requirements:
61
61
  - - '>='
62
62
  - !ruby/object:Gem::Version
63
- version: '0'
63
+ version: 2.1.0
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '>='
69
69
  - !ruby/object:Gem::Version
70
- version: '0'
70
+ version: 2.1.0
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: haml-rails
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -334,6 +334,20 @@ dependencies:
334
334
  - - '>='
335
335
  - !ruby/object:Gem::Version
336
336
  version: '0'
337
+ - !ruby/object:Gem::Dependency
338
+ name: database_cleaner
339
+ requirement: !ruby/object:Gem::Requirement
340
+ requirements:
341
+ - - '>='
342
+ - !ruby/object:Gem::Version
343
+ version: '0'
344
+ type: :development
345
+ prerelease: false
346
+ version_requirements: !ruby/object:Gem::Requirement
347
+ requirements:
348
+ - - '>='
349
+ - !ruby/object:Gem::Version
350
+ version: '0'
337
351
  description:
338
352
  email:
339
353
  - nathanm@instructure.com