Skip to content

Commit 3f6752c

Browse files
authored
Updated accounts-rails to handle path-prefixed OpenStax Accounts (#2407)
1 parent 81b5263 commit 3f6752c

File tree

6 files changed

+85
-77
lines changed

6 files changed

+85
-77
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ gem 'whenever'
6868
gem 'omniauth-oauth2', '~> 1.3.1'
6969

7070
# OpenStax Accounts integration
71-
gem 'openstax_accounts', '~> 9.5.1'
71+
gem 'openstax_accounts'
7272

7373
gem 'action_interceptor'
7474

7575
# Datetime parsing
7676
gem 'chronic'
7777

7878
# API versioning and documentation
79-
gem 'openstax_api'
79+
gem 'openstax_api', '< 9.4.0'
8080

8181
# Used to fetch and parse OpenStax book content
8282
gem 'openstax_content'

Gemfile.lock

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,50 @@ GEM
3636
action_interceptor (1.2.0)
3737
addressable
3838
rails (>= 3.1)
39-
actioncable (5.2.4.5)
40-
actionpack (= 5.2.4.5)
39+
actioncable (5.2.6)
40+
actionpack (= 5.2.6)
4141
nio4r (~> 2.0)
4242
websocket-driver (>= 0.6.1)
43-
actionmailer (5.2.4.5)
44-
actionpack (= 5.2.4.5)
45-
actionview (= 5.2.4.5)
46-
activejob (= 5.2.4.5)
43+
actionmailer (5.2.6)
44+
actionpack (= 5.2.6)
45+
actionview (= 5.2.6)
46+
activejob (= 5.2.6)
4747
mail (~> 2.5, >= 2.5.4)
4848
rails-dom-testing (~> 2.0)
49-
actionpack (5.2.4.5)
50-
actionview (= 5.2.4.5)
51-
activesupport (= 5.2.4.5)
49+
actionpack (5.2.6)
50+
actionview (= 5.2.6)
51+
activesupport (= 5.2.6)
5252
rack (~> 2.0, >= 2.0.8)
5353
rack-test (>= 0.6.3)
5454
rails-dom-testing (~> 2.0)
5555
rails-html-sanitizer (~> 1.0, >= 1.0.2)
56-
actionview (5.2.4.5)
57-
activesupport (= 5.2.4.5)
56+
actionview (5.2.6)
57+
activesupport (= 5.2.6)
5858
builder (~> 3.1)
5959
erubi (~> 1.4)
6060
rails-dom-testing (~> 2.0)
6161
rails-html-sanitizer (~> 1.0, >= 1.0.3)
62-
active_attr (0.15.2)
62+
active_attr (0.15.3)
6363
actionpack (>= 3.0.2, < 7.0)
6464
activemodel (>= 3.0.2, < 7.0)
6565
activesupport (>= 3.0.2, < 7.0)
6666
active_record_query_trace (1.6.2)
67-
activejob (5.2.4.5)
68-
activesupport (= 5.2.4.5)
67+
activejob (5.2.6)
68+
activesupport (= 5.2.6)
6969
globalid (>= 0.3.6)
70-
activemodel (5.2.4.5)
71-
activesupport (= 5.2.4.5)
72-
activerecord (5.2.4.5)
73-
activemodel (= 5.2.4.5)
74-
activesupport (= 5.2.4.5)
70+
activemodel (5.2.6)
71+
activesupport (= 5.2.6)
72+
activerecord (5.2.6)
73+
activemodel (= 5.2.6)
74+
activesupport (= 5.2.6)
7575
arel (>= 9.0)
7676
activerecord-import (1.0.1)
7777
activerecord (>= 3.2)
78-
activestorage (5.2.4.5)
79-
actionpack (= 5.2.4.5)
80-
activerecord (= 5.2.4.5)
81-
marcel (~> 0.3.1)
82-
activesupport (5.2.4.5)
78+
activestorage (5.2.6)
79+
actionpack (= 5.2.6)
80+
activerecord (= 5.2.6)
81+
marcel (~> 1.0.0)
82+
activesupport (5.2.6)
8383
concurrent-ruby (~> 1.0, >= 1.0.2)
8484
i18n (>= 0.7, < 2)
8585
minitest (~> 5.1)
@@ -96,17 +96,17 @@ GEM
9696
autoprefixer-rails (9.5.0)
9797
execjs
9898
awesome_print (1.8.0)
99-
aws-eventstream (1.1.1)
100-
aws-partitions (1.473.0)
101-
aws-sdk-autoscaling (1.53.0)
102-
aws-sdk-core (~> 3, >= 3.109.0)
99+
aws-eventstream (1.2.0)
100+
aws-partitions (1.530.0)
101+
aws-sdk-autoscaling (1.72.0)
102+
aws-sdk-core (~> 3, >= 3.122.0)
103103
aws-sigv4 (~> 1.1)
104104
aws-sdk-cloudwatch (1.46.0)
105105
aws-sdk-core (~> 3, >= 3.109.0)
106106
aws-sigv4 (~> 1.1)
107-
aws-sdk-core (3.115.0)
107+
aws-sdk-core (3.122.1)
108108
aws-eventstream (~> 1, >= 1.0.2)
109-
aws-partitions (~> 1, >= 1.239.0)
109+
aws-partitions (~> 1, >= 1.525.0)
110110
aws-sigv4 (~> 1.1)
111111
jmespath (~> 1.0)
112112
aws-sdk-kms (1.44.0)
@@ -122,7 +122,7 @@ GEM
122122
aws-sdk-ssm (1.95.0)
123123
aws-sdk-core (~> 3, >= 3.109.0)
124124
aws-sigv4 (~> 1.1)
125-
aws-sigv4 (1.2.3)
125+
aws-sigv4 (1.4.0)
126126
aws-eventstream (~> 1, >= 1.0.2)
127127
axiom-types (0.1.1)
128128
descendants_tracker (~> 0.0.4)
@@ -210,7 +210,7 @@ GEM
210210
compass (~> 1.0.0)
211211
sass-rails (< 5.1)
212212
sprockets (< 4.0)
213-
concurrent-ruby (1.1.8)
213+
concurrent-ruby (1.1.9)
214214
crack (0.4.3)
215215
safe_yaml (~> 1.0.0)
216216
crass (1.0.6)
@@ -238,7 +238,7 @@ GEM
238238
diff-lcs (1.3)
239239
diffy (3.4.0)
240240
docile (1.4.0)
241-
doorkeeper (5.4.0)
241+
doorkeeper (5.5.4)
242242
railties (>= 5)
243243
dotenv (2.7.1)
244244
dotenv-rails (2.7.1)
@@ -320,8 +320,8 @@ GEM
320320
formatador (0.2.5)
321321
get_process_mem (0.2.7)
322322
ffi (~> 1.0)
323-
globalid (0.4.2)
324-
activesupport (>= 4.2.0)
323+
globalid (0.5.2)
324+
activesupport (>= 5.0)
325325
guard (2.15.0)
326326
formatador (>= 0.2.4)
327327
listen (>= 2.7, < 4.0)
@@ -347,7 +347,7 @@ GEM
347347
mime-types (~> 3.0)
348348
multi_xml (>= 0.5.2)
349349
httpclient (2.8.3)
350-
i18n (1.8.9)
350+
i18n (1.8.11)
351351
concurrent-ruby (~> 1.0)
352352
ice_nine (0.11.2)
353353
ims-lti (2.2.3)
@@ -400,28 +400,28 @@ GEM
400400
activesupport (>= 4)
401401
railties (>= 4)
402402
request_store (~> 1.0)
403-
loofah (2.9.0)
403+
loofah (2.12.0)
404404
crass (~> 1.0.2)
405405
nokogiri (>= 1.5.9)
406406
lumberjack (1.0.13)
407407
mail (2.7.1)
408408
mini_mime (>= 0.1.1)
409-
marcel (0.3.3)
410-
mimemagic (~> 0.3.2)
409+
marcel (1.0.2)
411410
maruku (0.7.3)
412411
method_source (0.8.2)
413412
mime-types (3.3.1)
414413
mime-types-data (~> 3.2015)
415414
mime-types-data (3.2020.1104)
416-
mimemagic (0.3.8)
415+
mimemagic (0.4.3)
417416
nokogiri (~> 1)
418-
mini_mime (1.0.2)
417+
rake
418+
mini_mime (1.1.2)
419419
mini_portile2 (2.6.1)
420420
mini_racer (0.3.1)
421421
libv8 (~> 8.4.255)
422422
minitest (5.14.4)
423423
msgpack (1.3.3)
424-
multi_json (1.14.1)
424+
multi_json (1.15.0)
425425
multi_xml (0.6.0)
426426
multipart-post (2.1.1)
427427
nenv (0.3.0)
@@ -438,38 +438,39 @@ GEM
438438
nenv (~> 0.1)
439439
shellany (~> 0.0)
440440
oauth (0.5.5)
441-
oauth2 (1.4.2)
441+
oauth2 (1.4.7)
442442
faraday (>= 0.8, < 2.0)
443443
jwt (>= 1.0, < 3.0)
444444
multi_json (~> 1.3)
445445
multi_xml (~> 0.5)
446446
rack (>= 1.2, < 3)
447447
oj (3.7.12)
448448
oj_mimic_json (1.0.1)
449-
omniauth (1.9.0)
450-
hashie (>= 3.4.6, < 3.7.0)
449+
omniauth (1.9.1)
450+
hashie (>= 3.4.6)
451451
rack (>= 1.6.2, < 3)
452452
omniauth-oauth2 (1.3.1)
453453
oauth2 (~> 1.0)
454454
omniauth (~> 1.2)
455-
openstax_accounts (9.5.1)
455+
openstax_accounts (9.8.0)
456456
action_interceptor
457457
keyword_search
458458
lev
459459
oauth2
460-
omniauth
460+
omniauth (< 2.0)
461461
omniauth-oauth2
462462
openstax_api
463463
openstax_utilities
464464
pg
465-
rails (> 5.0)
465+
rails (>= 5.0, < 7.0)
466466
representable
467-
roar
467+
roar (>= 1.0)
468468
openstax_active_force (1.1.0)
469469
active_attr
470470
rails (>= 5.0, < 7.0)
471471
restforce
472-
openstax_api (9.3.0)
472+
openstax_api (9.3.1)
473+
addressable
473474
doorkeeper
474475
exception_notification
475476
lev
@@ -536,18 +537,18 @@ GEM
536537
rack-test (1.1.0)
537538
rack (>= 1.0, < 3)
538539
railroady (1.5.3)
539-
rails (5.2.4.5)
540-
actioncable (= 5.2.4.5)
541-
actionmailer (= 5.2.4.5)
542-
actionpack (= 5.2.4.5)
543-
actionview (= 5.2.4.5)
544-
activejob (= 5.2.4.5)
545-
activemodel (= 5.2.4.5)
546-
activerecord (= 5.2.4.5)
547-
activestorage (= 5.2.4.5)
548-
activesupport (= 5.2.4.5)
540+
rails (5.2.6)
541+
actioncable (= 5.2.6)
542+
actionmailer (= 5.2.6)
543+
actionpack (= 5.2.6)
544+
actionview (= 5.2.6)
545+
activejob (= 5.2.6)
546+
activemodel (= 5.2.6)
547+
activerecord (= 5.2.6)
548+
activestorage (= 5.2.6)
549+
activesupport (= 5.2.6)
549550
bundler (>= 1.3.0)
550-
railties (= 5.2.4.5)
551+
railties (= 5.2.6)
551552
sprockets-rails (>= 2.0.0)
552553
rails-controller-testing (1.0.4)
553554
actionpack (>= 5.0.1.x)
@@ -561,7 +562,7 @@ GEM
561562
activesupport (>= 3.2)
562563
choice (~> 0.2.0)
563564
ruby-graphviz (~> 1.2)
564-
rails-html-sanitizer (1.3.0)
565+
rails-html-sanitizer (1.4.2)
565566
loofah (~> 2.3)
566567
rails-settings-cached (2.0.3)
567568
rails (>= 4.2.0)
@@ -571,14 +572,14 @@ GEM
571572
dry-validation (>= 0.12.0)
572573
i18n
573574
rails (>= 3.0)
574-
railties (5.2.4.5)
575-
actionpack (= 5.2.4.5)
576-
activesupport (= 5.2.4.5)
575+
railties (5.2.6)
576+
actionpack (= 5.2.6)
577+
activesupport (= 5.2.6)
577578
method_source
578579
rake (>= 0.8.7)
579580
thor (>= 0.19.0, < 2.0)
580581
rainbow (3.0.0)
581-
rake (13.0.3)
582+
rake (13.0.6)
582583
rb-fsevent (0.10.4)
583584
rb-inotify (0.10.1)
584585
ffi (~> 1.0)
@@ -706,9 +707,9 @@ GEM
706707
sprockets (3.7.2)
707708
concurrent-ruby (~> 1.0)
708709
rack (> 1, < 3)
709-
sprockets-rails (3.2.2)
710-
actionpack (>= 4.0)
711-
activesupport (>= 4.0)
710+
sprockets-rails (3.4.0)
711+
actionpack (>= 5.2)
712+
activesupport (>= 5.2)
712713
sprockets (>= 3.0.0)
713714
ssrf_filter (1.0.7)
714715
test_xml (0.1.8)
@@ -757,7 +758,7 @@ GEM
757758
rack-proxy (>= 0.6.1)
758759
railties (>= 5.2)
759760
semantic_range (>= 2.3.0)
760-
websocket-driver (0.7.3)
761+
websocket-driver (0.7.5)
761762
websocket-extensions (>= 0.1.0)
762763
websocket-extensions (0.1.5)
763764
whenever (0.10.0)
@@ -839,8 +840,8 @@ DEPENDENCIES
839840
oj
840841
oj_mimic_json
841842
omniauth-oauth2 (~> 1.3.1)
842-
openstax_accounts (~> 9.5.1)
843-
openstax_api
843+
openstax_accounts
844+
openstax_api (< 9.4.0)
844845
openstax_content
845846
openstax_healthcheck
846847
openstax_rescue_from

app/representers/api/v1/user_representer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class UserRepresenter < ::Roar::Decorator
7676
property :profile_url,
7777
getter: ->(*) do
7878
Addressable::URI.join(
79-
OpenStax::Accounts.configuration.openstax_accounts_url, '/profile'
79+
OpenStax::Accounts.configuration.openstax_accounts_url, 'profile'
8080
).to_s
8181
end
8282

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This migration comes from openstax_accounts (originally 19)
2+
class AddIsAdministratorToOpenStaxAccountsAccounts < ActiveRecord::Migration[5.2]
3+
def change
4+
add_column :openstax_accounts_accounts, :is_administrator, :boolean
5+
end
6+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2021_11_03_150618) do
13+
ActiveRecord::Schema.define(version: 2021_11_15_122108) do
1414

1515
create_sequence "teacher_exercise_number", start: 1000000
1616

@@ -606,6 +606,7 @@
606606
t.boolean "is_kip"
607607
t.integer "school_location", default: 0, null: false
608608
t.boolean "grant_tutor_access"
609+
t.boolean "is_administrator"
609610
t.index ["access_token"], name: "index_openstax_accounts_accounts_on_access_token", unique: true
610611
t.index ["faculty_status"], name: "index_openstax_accounts_accounts_on_faculty_status"
611612
t.index ["first_name"], name: "index_openstax_accounts_accounts_on_first_name"

spec/representers/api/v1/user_representer_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
expect(representation['viewed_tour_stats']).to eq []
1919
expect(representation['available_terms']).to eq []
2020
expect(representation['profile_url']).to eq Addressable::URI.join(
21-
OpenStax::Accounts.configuration.openstax_accounts_url, '/profile'
21+
OpenStax::Accounts.configuration.openstax_accounts_url, 'profile'
2222
).to_s
2323
end
2424

0 commit comments

Comments
 (0)