openstax_accounts 9.0.5 → 9.1.0
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 +4 -4
- data/app/controllers/openstax/accounts/sessions_controller.rb +1 -2
- data/app/handlers/openstax/accounts/sessions_callback.rb +0 -1
- data/app/models/openstax/accounts/account.rb +4 -26
- data/app/representers/openstax/accounts/api/v1/account_representer.rb +6 -19
- data/app/routines/openstax/accounts/dev/create_account.rb +0 -2
- data/app/routines/openstax/accounts/find_or_create_account.rb +2 -5
- data/app/routines/openstax/accounts/sync_accounts.rb +1 -0
- data/lib/openstax/accounts/configuration.rb +4 -4
- data/lib/openstax/accounts/version.rb +1 -1
- data/spec/factories/openstax_accounts_account.rb +0 -1
- metadata +6 -8
- data/db/migrate/16_add_is_kip_to_openstax_accounts_accounts.rb +0 -5
- data/db/migrate/17_add_school_location_to_openstax_accounts_accounts.rb +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94c7f3a9d37b020069be2c39b96a1f7beacb918d50e87aa84d70fe24d437025c
|
|
4
|
+
data.tar.gz: 9a857efcee527418bd4287d6b8a61c369fa424541358de01b3dc41f1ae8e3aa7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 831790e591d38994596ff471d0828b773a8fd770253bf7040ed4c1106b2979e944b9a5ce5777cc89271c552cdb8fb50b7cfb239e316b1251713fe81f960e9237
|
|
7
|
+
data.tar.gz: fa14a2404033df1bc6131f6a1b91c134c98bda24d16af737f3442b52ea9b3de1c1933f463ac7c46060cef64fac02e73628990d936f35a7a0bdf1b93a99d6290c
|
|
@@ -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,7 +34,6 @@ 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
|
|
38
37
|
end
|
|
39
38
|
|
|
40
39
|
outputs.account.save if outputs.account.changed?
|
|
@@ -12,22 +12,14 @@ module OpenStax::Accounts
|
|
|
12
12
|
:self_reported_role,
|
|
13
13
|
:faculty_status,
|
|
14
14
|
:school_type,
|
|
15
|
-
:school_location,
|
|
16
15
|
:salesforce_contact_id,
|
|
17
16
|
:support_identifier,
|
|
18
|
-
:is_test
|
|
19
|
-
:is_kip
|
|
17
|
+
:is_test
|
|
20
18
|
]
|
|
21
19
|
|
|
22
20
|
attr_accessor :syncing
|
|
23
21
|
|
|
24
|
-
enum faculty_status: [
|
|
25
|
-
:no_faculty_info,
|
|
26
|
-
:pending_faculty,
|
|
27
|
-
:confirmed_faculty,
|
|
28
|
-
:rejected_faculty
|
|
29
|
-
]
|
|
30
|
-
|
|
22
|
+
enum faculty_status: [:no_faculty_info, :pending_faculty, :confirmed_faculty, :rejected_faculty]
|
|
31
23
|
enum role: [
|
|
32
24
|
:unknown_role,
|
|
33
25
|
:student,
|
|
@@ -39,23 +31,9 @@ module OpenStax::Accounts
|
|
|
39
31
|
:adjunct,
|
|
40
32
|
:homeschool
|
|
41
33
|
]
|
|
34
|
+
enum school_type: [:unknown_school_type, :other_school_type, :college]
|
|
42
35
|
|
|
43
|
-
|
|
44
|
-
:unknown_school_type,
|
|
45
|
-
:other_school_type,
|
|
46
|
-
:college,
|
|
47
|
-
:high_school,
|
|
48
|
-
:k12_school,
|
|
49
|
-
:home_school
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
enum school_location: [
|
|
53
|
-
:unknown_school_location,
|
|
54
|
-
:domestic_school,
|
|
55
|
-
:foreign_school
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
validates :faculty_status, :role, :school_type, :school_location, presence: true
|
|
36
|
+
validates :faculty_status, :role, :school_type, presence: true
|
|
59
37
|
|
|
60
38
|
validates :uuid, presence: true, uniqueness: true
|
|
61
39
|
validates :support_identifier, uniqueness: { allow_nil: true }
|
|
@@ -5,13 +5,13 @@ module OpenStax
|
|
|
5
5
|
module Api
|
|
6
6
|
module V1
|
|
7
7
|
class AccountRepresenter < Roar::Decorator
|
|
8
|
+
|
|
8
9
|
# This representer is used to communicate with Accounts
|
|
9
10
|
# and so must allow read/write on all properties
|
|
10
11
|
# Do not use it in create/update APIs!
|
|
11
12
|
|
|
12
|
-
#
|
|
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
|
|
13
|
+
# Otherwise, this representer can be used directly or subclassed
|
|
14
|
+
# 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
|
|
15
15
|
|
|
16
16
|
include Roar::JSON
|
|
17
17
|
|
|
@@ -86,37 +86,24 @@ module OpenStax
|
|
|
86
86
|
}"
|
|
87
87
|
}
|
|
88
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
|
-
|
|
97
89
|
property :uuid,
|
|
98
90
|
type: String,
|
|
99
91
|
schema_info: {
|
|
100
|
-
description:
|
|
92
|
+
description: "The UUID as set by Accounts"
|
|
101
93
|
}
|
|
102
94
|
|
|
103
95
|
property :support_identifier,
|
|
104
96
|
type: String,
|
|
105
97
|
schema_info: {
|
|
106
|
-
description:
|
|
98
|
+
description: "The support_identifier as set by Accounts"
|
|
107
99
|
}
|
|
108
100
|
|
|
109
101
|
property :is_test,
|
|
110
102
|
type: :boolean,
|
|
111
103
|
schema_info: {
|
|
112
|
-
description:
|
|
104
|
+
description: "Whether or not this is a test account"
|
|
113
105
|
}
|
|
114
106
|
|
|
115
|
-
property :is_kip,
|
|
116
|
-
type: :boolean,
|
|
117
|
-
schema_info: {
|
|
118
|
-
description: 'Whether or not this is a Key Institutional Partner account'
|
|
119
|
-
}
|
|
120
107
|
end
|
|
121
108
|
end
|
|
122
109
|
end
|
|
@@ -32,8 +32,6 @@ 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,
|
|
37
35
|
is_test: true
|
|
38
36
|
)
|
|
39
37
|
|
|
@@ -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,
|
|
10
|
+
role: nil, school_type: 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,8 +23,7 @@ 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,
|
|
27
|
-
is_kip: is_kip, is_test: is_test
|
|
26
|
+
role: role, school_type: school_type, is_test: is_test
|
|
28
27
|
)
|
|
29
28
|
fatal_error(code: :invalid_inputs) unless (200..202).include?(response.status)
|
|
30
29
|
|
|
@@ -46,9 +45,7 @@ module OpenStax
|
|
|
46
45
|
account.faculty_status = faculty_status || :no_faculty_info
|
|
47
46
|
account.role = role || :unknown_role
|
|
48
47
|
account.school_type = school_type || :unknown_school_type
|
|
49
|
-
account.school_location = school_location || :unknown_school_location
|
|
50
48
|
account.support_identifier = support_identifier
|
|
51
|
-
account.is_kip = is_kip
|
|
52
49
|
account.is_test = is_test
|
|
53
50
|
end
|
|
54
51
|
|
|
@@ -60,9 +60,9 @@ module OpenStax
|
|
|
60
60
|
# to the default Accounts logout URL.
|
|
61
61
|
attr_writer :logout_redirect_url
|
|
62
62
|
|
|
63
|
-
#
|
|
63
|
+
# forwardable_login_params
|
|
64
64
|
# Which params are forwarded on the accounts login path
|
|
65
|
-
attr_accessor :
|
|
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
|
-
@
|
|
122
|
+
@forwardable_login_params = [
|
|
123
123
|
:signup_at,
|
|
124
124
|
:go,
|
|
125
|
-
:
|
|
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'
|
|
@@ -6,7 +6,6 @@ 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] }
|
|
10
9
|
uuid { SecureRandom.uuid }
|
|
11
10
|
support_identifier { "cs_#{SecureRandom.hex(4)}" }
|
|
12
11
|
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
|
|
4
|
+
version: 9.1.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-
|
|
11
|
+
date: 2020-04-10 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: '
|
|
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: '
|
|
26
|
+
version: '5.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: omniauth
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -341,8 +341,6 @@ files:
|
|
|
341
341
|
- db/migrate/13_add_school_type_to_accounts_accounts.rb
|
|
342
342
|
- db/migrate/14_drop_openstax_uid_and_username_uniqueness.rb
|
|
343
343
|
- db/migrate/15_drop_accounts_groups.rb
|
|
344
|
-
- db/migrate/16_add_is_kip_to_openstax_accounts_accounts.rb
|
|
345
|
-
- db/migrate/17_add_school_location_to_openstax_accounts_accounts.rb
|
|
346
344
|
- db/migrate/1_create_openstax_accounts_groups.rb
|
|
347
345
|
- db/migrate/2_create_openstax_accounts_group_members.rb
|
|
348
346
|
- db/migrate/3_create_openstax_accounts_group_owners.rb
|