openstax_accounts 9.0.3 → 9.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e72c48eba4d6dc3bc31f1cb7ad25496a3d2f53e8ad52e5b349183e5bf996a9b7
4
- data.tar.gz: 52623f98c2f678ead905489f7deddfc8dfd20f47fb030a04e906caaee56e04e1
3
+ metadata.gz: c0afe5b4c7d13abc030803addf862691d260ea3036361a2043d8f85bf88fa7fb
4
+ data.tar.gz: 24502a41f6cb02271869bdff9869ed3f8efedbe1b393227193746ae6c5d8fc0c
5
5
  SHA512:
6
- metadata.gz: 32f5094752249a7514a5cbaaf496e329c250fa7af61e369476aef43277bc7e00216877d3e2331b01abbda6580f8e767a72bbdf2ddec2d612a8ebf2bfc0d2d855
7
- data.tar.gz: 8c264b7bd7259c7a88a3e746ed4cfd68bb56a605e1a1d6c5a514fa64e34986fa50f8941ad11370227b6b23bc84e0511bcf3d8bcf9f284fecb90f9affe1ad24db
6
+ metadata.gz: 31573e6b6cef57ee9fb3e8cef36b20ffed6a0e122cf667857daedc1c4049753f7a7bdfcee67f8400711708c9aed795f474dddc194fb1876aa71d654a75ee42e0
7
+ data.tar.gz: ecd575021a0091b2f6f75d93416b09be0335e499498448b10383091ea4aa8eec1d110718b41a50486c54e6b8649fac45e9d06feed7fb0e3916c51461e677c5c0
@@ -10,8 +10,7 @@ module OpenStax
10
10
  if configuration.enable_stubbing?
11
11
  redirect_to dev_accounts_path
12
12
  else
13
- forwardable_params =
14
- params.permit(*configuration.forwardable_login_param_keys.map(&:to_s)).to_h
13
+ forwardable_params = params.permit(*configuration.forwardable_login_params).to_h
15
14
  redirect_to openstax_login_path(forwardable_params)
16
15
  end
17
16
  end
@@ -34,6 +34,7 @@ module OpenStax
34
34
  account.faculty_status ||= :no_faculty_info
35
35
  account.role ||= :unknown_role
36
36
  account.school_type ||= :unknown_school_type
37
+ account.school_location ||= :unknown_school_location
37
38
  end
38
39
 
39
40
  outputs.account.save if outputs.account.changed?
@@ -12,6 +12,7 @@ module OpenStax::Accounts
12
12
  :self_reported_role,
13
13
  :faculty_status,
14
14
  :school_type,
15
+ :school_location,
15
16
  :salesforce_contact_id,
16
17
  :support_identifier,
17
18
  :is_test,
@@ -26,6 +27,7 @@ module OpenStax::Accounts
26
27
  :confirmed_faculty,
27
28
  :rejected_faculty
28
29
  ]
30
+
29
31
  enum role: [
30
32
  :unknown_role,
31
33
  :student,
@@ -37,15 +39,23 @@ module OpenStax::Accounts
37
39
  :adjunct,
38
40
  :homeschool
39
41
  ]
42
+
40
43
  enum school_type: [
41
44
  :unknown_school_type,
42
45
  :other_school_type,
43
46
  :college,
44
47
  :high_school,
45
- :k12_school
48
+ :k12_school,
49
+ :home_school
50
+ ]
51
+
52
+ enum school_location: [
53
+ :unknown_school_location,
54
+ :domestic_school,
55
+ :foreign_school
46
56
  ]
47
57
 
48
- validates :faculty_status, :role, :school_type, presence: true
58
+ validates :faculty_status, :role, :school_type, :school_location, presence: true
49
59
 
50
60
  validates :uuid, presence: true, uniqueness: true
51
61
  validates :support_identifier, uniqueness: { allow_nil: true }
@@ -9,8 +9,9 @@ module OpenStax
9
9
  # and so must allow read/write on all properties
10
10
  # Do not use it in create/update APIs!
11
11
 
12
- # Otherwise, this representer can be used directly or subclassed
13
- # for an object that delegates openstax_uid, username, first_name, last_name, full_name, # title, faculty_status, role, school_type and salesforce_contact_id to an account
12
+ # This representer can be used directly or subclassed for an object that delegates
13
+ # openstax_uid, username, first_name, last_name, full_name, title, faculty_status,
14
+ # role, school_type, school_location and salesforce_contact_id to an account
14
15
 
15
16
  include Roar::JSON
16
17
 
@@ -85,6 +86,14 @@ module OpenStax
85
86
  }"
86
87
  }
87
88
 
89
+ property :school_location,
90
+ type: String,
91
+ schema_info: {
92
+ description: "One of #{
93
+ OpenStax::Accounts::Account.school_locations.keys.map(&:to_s).inspect
94
+ }"
95
+ }
96
+
88
97
  property :uuid,
89
98
  type: String,
90
99
  schema_info: {
@@ -32,6 +32,8 @@ module OpenStax
32
32
  role: inputs[:role] || :unknown_role,
33
33
  uuid: SecureRandom.uuid,
34
34
  support_identifier: "cs_#{SecureRandom.hex(4)}",
35
+ school_type: inputs[:school_type] || :unknown_school_type,
36
+ school_location: inputs[:school_location] || :unknown_school_location,
35
37
  is_test: true
36
38
  )
37
39
 
@@ -7,7 +7,7 @@ module OpenStax
7
7
 
8
8
  def exec(email: nil, username: nil, password: nil, first_name: nil, last_name: nil,
9
9
  full_name: nil, title: nil, salesforce_contact_id: nil, faculty_status: nil,
10
- role: nil, school_type: nil, is_test: nil)
10
+ role: nil, school_type: nil, school_location: nil, is_kip: nil, is_test: nil)
11
11
  raise(
12
12
  ArgumentError,
13
13
  'You must specify either an email address or a username (and an optional password)'
@@ -23,7 +23,8 @@ module OpenStax
23
23
  email: email, username: username, password: password,
24
24
  first_name: first_name, last_name: last_name, full_name: full_name,
25
25
  salesforce_contact_id: salesforce_contact_id, faculty_status: faculty_status,
26
- role: role, school_type: school_type, is_test: is_test
26
+ role: role, school_type: school_type, school_location: school_location,
27
+ is_kip: is_kip, is_test: is_test
27
28
  )
28
29
  fatal_error(code: :invalid_inputs) unless (200..202).include?(response.status)
29
30
 
@@ -45,7 +46,9 @@ module OpenStax
45
46
  account.faculty_status = faculty_status || :no_faculty_info
46
47
  account.role = role || :unknown_role
47
48
  account.school_type = school_type || :unknown_school_type
49
+ account.school_location = school_location || :unknown_school_location
48
50
  account.support_identifier = support_identifier
51
+ account.is_kip = is_kip
49
52
  account.is_test = is_test
50
53
  end
51
54
 
@@ -0,0 +1,5 @@
1
+ class AddSchoolLocationToOpenStaxAccountsAccounts < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :openstax_accounts_accounts, :school_location, :integer, default: 0, null: false
4
+ end
5
+ end
@@ -60,9 +60,9 @@ module OpenStax
60
60
  # to the default Accounts logout URL.
61
61
  attr_writer :logout_redirect_url
62
62
 
63
- # forwardable_login_param_keys
63
+ # forwardable_login_params
64
64
  # Which params are forwarded on the accounts login path
65
- attr_accessor :forwardable_login_param_keys
65
+ attr_accessor :forwardable_login_params
66
66
 
67
67
  # max_user_updates_per_request
68
68
  # When the user profile sync operation is called, this parameter will limit
@@ -119,10 +119,10 @@ module OpenStax
119
119
  @max_search_items = 10
120
120
  @logout_redirect_url = nil
121
121
  @return_to_url_approver = nil
122
- @forwardable_login_param_keys = [
122
+ @forwardable_login_params = [
123
123
  :signup_at,
124
124
  :go,
125
- :sp # "signed payload"; "sp" for short to keep nested parameter names short
125
+ sp: {} # "signed payload"; "sp" to keep nested parameter names short.
126
126
  ]
127
127
  @max_user_updates_per_request = 250
128
128
  @sso_cookie_name = 'ox'
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Accounts
3
- VERSION = '9.0.3'
3
+ VERSION = '9.3.0'
4
4
  end
5
5
  end
@@ -6,6 +6,7 @@ FactoryBot.define do
6
6
  faculty_status { OpenStax::Accounts::Account.faculty_statuses[:no_faculty_info] }
7
7
  role { OpenStax::Accounts::Account.roles[:unknown_role] }
8
8
  school_type { OpenStax::Accounts::Account.school_types[:unknown_school_type] }
9
+ school_location { OpenStax::Accounts::Account.school_locations[:unknown_school_location] }
9
10
  uuid { SecureRandom.uuid }
10
11
  support_identifier { "cs_#{SecureRandom.hex(4)}" }
11
12
  is_test { true }
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_accounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.3
4
+ version: 9.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: omniauth
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -342,6 +342,7 @@ files:
342
342
  - db/migrate/14_drop_openstax_uid_and_username_uniqueness.rb
343
343
  - db/migrate/15_drop_accounts_groups.rb
344
344
  - db/migrate/16_add_is_kip_to_openstax_accounts_accounts.rb
345
+ - db/migrate/17_add_school_location_to_openstax_accounts_accounts.rb
345
346
  - db/migrate/1_create_openstax_accounts_groups.rb
346
347
  - db/migrate/2_create_openstax_accounts_group_members.rb
347
348
  - db/migrate/3_create_openstax_accounts_group_owners.rb