coalescing_panda 4.5.1 → 4.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/coalescing_panda/lti_controller.rb +1 -1
- data/lib/coalescing_panda/controller_helpers.rb +2 -2
- data/lib/coalescing_panda/version.rb +1 -1
- data/spec/controllers/coalescing_panda/oauth2_controller_spec.rb +1 -0
- data/spec/dummy/db/schema.rb +79 -68
- data/spec/spec_helper.rb +12 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e07111713b8d6eaeb774afa6044d0d59c661fd1
|
4
|
+
data.tar.gz: b76fb5b1525cf9a21622832fae03732fe0035a58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
104
|
-
authorized =
|
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)
|
@@ -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
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -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:
|
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",
|
34
|
-
t.string "name"
|
33
|
+
t.integer "coalescing_panda_course_id", null: false
|
34
|
+
t.string "name"
|
35
35
|
t.text "description"
|
36
|
-
t.string "canvas_assignment_id",
|
37
|
-
t.string "workflow_state"
|
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"
|
56
|
-
t.string "api_domain"
|
57
|
-
t.string "api_token"
|
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",
|
64
|
-
t.string "status"
|
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"
|
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",
|
77
|
+
t.integer "coalescing_panda_lti_account_id", null: false
|
76
78
|
t.integer "coalescing_panda_term_id"
|
77
|
-
t.string "name"
|
78
|
-
t.string "canvas_course_id",
|
79
|
-
t.string "sis_id"
|
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"
|
83
|
-
t.string "course_code"
|
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",
|
94
|
-
t.integer "coalescing_panda_section_id",
|
95
|
-
t.string "workflow_state"
|
96
|
-
t.string "sis_id"
|
97
|
-
t.string "canvas_enrollment_id",
|
98
|
-
t.string "enrollment_type"
|
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"
|
123
|
-
t.string "workflow_state"
|
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"
|
134
|
-
t.string "description"
|
135
|
-
t.string "group_category_id"
|
136
|
-
t.string "canvas_group_id"
|
137
|
-
t.string "name"
|
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"
|
149
|
-
t.string "key"
|
150
|
-
t.string "secret"
|
151
|
-
t.string "oauth2_client_id"
|
152
|
-
t.string "oauth2_client_key"
|
153
|
-
t.string "canvas_account_id"
|
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"
|
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",
|
167
|
-
t.string "name"
|
168
|
-
t.string "canvas_section_id",
|
169
|
-
t.string "sis_id"
|
170
|
-
t.string "workflow_state"
|
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"
|
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",
|
189
|
-
t.integer "coalescing_panda_assignment_id",
|
190
|
-
t.string "url"
|
191
|
-
t.string "grade"
|
192
|
-
t.string "score"
|
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"
|
195
|
-
t.string "canvas_submission_id",
|
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",
|
205
|
-
t.string "name"
|
206
|
-
t.string "code"
|
207
|
-
t.string "sis_id"
|
208
|
-
t.string "canvas_term_id",
|
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"
|
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",
|
221
|
-
t.string "name"
|
222
|
-
t.string "email"
|
223
|
-
t.string "roles"
|
224
|
-
t.string "workflow_state"
|
225
|
-
t.string "sis_id"
|
226
|
-
t.string "canvas_user_id",
|
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",
|
237
|
-
t.integer "attempts",
|
238
|
-
t.text "handler",
|
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"
|
244
|
-
t.string "queue"
|
254
|
+
t.string "locked_by"
|
255
|
+
t.string "queue"
|
245
256
|
t.datetime "created_at"
|
246
257
|
t.datetime "updated_at"
|
247
258
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -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.
|
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-
|
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:
|
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:
|
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
|