openstax_accounts 7.5.0 → 7.6.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
  SHA1:
3
- metadata.gz: bf213fccf592a833a327ef4cda8e6058d04e9673
4
- data.tar.gz: a8b34d6b6ef575276bcb267c3beeeadf702429b1
3
+ metadata.gz: 1d81c2870f0cf53cc0f2a2e62dffa46d91e00827
4
+ data.tar.gz: 8d1cdb83f09c41c191aa797c4225000266d9f5f9
5
5
  SHA512:
6
- metadata.gz: 3ddac0b7c17d1c79351b2c404e0c0393b0c5c0fc71ec08b3c5a8456b68fa3a1f6578db13cac48523341b3af3bdd2862a044c2df9fa444d167a23a2f9af4624da
7
- data.tar.gz: d6966e2876ac6f0567a8981696d45e89ea2aa0bf02e7df0237ce0fab66b69236f521d6d2a91dd37dd9d80a63eabb5edb4b3733557682d315e923c8b84a5abb9c
6
+ metadata.gz: fa7630f877a37c8f012bdff3b2382d3a23dc7c3ddac56c18137a1ad2e8a0031b570e046a5304ecfe00ebc6f4445fe1ab957229b3f17deb15e5b1b4188ff8cbe5
7
+ data.tar.gz: 4d832b3054819da99d628e42174e10f9b3175d69eaf55caa930e1d4b586a12bb8d7473ab3f94e0cdd02f99ca639880d8ec3b05491aeb63b5fdd4137c66e76a7b
@@ -9,6 +9,7 @@ module OpenStax
9
9
  paramify :create do
10
10
  attribute :username, type: String
11
11
  validates :username, presence: true
12
+ attribute :role, type: String
12
13
  end
13
14
 
14
15
  uses_routine OpenStax::Accounts::Dev::CreateAccount,
@@ -23,11 +24,11 @@ module OpenStax
23
24
  end
24
25
 
25
26
  def handle
26
- run(:create_account, create_params.as_hash(:username))
27
+ run(:create_account, create_params.as_hash(:username, :role))
27
28
  end
28
29
 
29
- end
30
+ end
30
31
  end
31
32
 
32
33
  end
33
- end
34
+ end
@@ -17,6 +17,13 @@ module OpenStax
17
17
  required: true
18
18
  }
19
19
 
20
+ property :uuid,
21
+ type: String,
22
+ schema_info: {
23
+ description: "The unclaimed account's UUID",
24
+ required: true
25
+ }
26
+
20
27
  end
21
28
  end
22
29
  end
@@ -23,6 +23,8 @@ module OpenStax
23
23
  account.openstax_uid = -SecureRandom.hex(4).to_i(16)/2
24
24
  account.access_token = SecureRandom.hex.to_s
25
25
  account.username = username
26
+ account.uuid = SecureRandom.uuid
27
+ account.role = inputs[:role] || :unknown_role
26
28
 
27
29
  account.save
28
30
 
@@ -17,6 +17,7 @@ module OpenStax
17
17
  # We can only stub finding by username b/c accounts-rails doesn't persist emails
18
18
  id = Account.find_by(username: username).try!(:openstax_uid) ||
19
19
  -SecureRandom.hex(4).to_i(16)/2
20
+ uuid = SecureRandom.uuid
20
21
  else
21
22
  response = Api.find_or_create_account(
22
23
  email: email, username: username, password: password,
@@ -28,6 +29,7 @@ module OpenStax
28
29
  struct = OpenStruct.new
29
30
  Api::V1::UnclaimedAccountRepresenter.new(struct).from_json(response.body)
30
31
  id = struct.id
32
+ uuid = struct.uuid
31
33
  end
32
34
 
33
35
  account = Account.find_or_initialize_by(openstax_uid: id)
@@ -43,6 +45,8 @@ module OpenStax
43
45
  account.title = title
44
46
  account.salesforce_contact_id = salesforce_contact_id
45
47
  account.faculty_status = faculty_status || :no_faculty_info
48
+ account.role = role || :unknown_role
49
+ account.uuid = uuid
46
50
  account.save!
47
51
  end
48
52
 
@@ -9,9 +9,10 @@
9
9
  method: :post,
10
10
  html: {class: 'form-inline'} do |f| %>
11
11
 
12
- <%= f.label :username %>&nbsp;
12
+
13
13
  <div class="form-group">
14
- <%= f.text_field :username %>&nbsp;
14
+ <%= f.text_field :username, placeholder: "Username" %>&nbsp;
15
+ <%= f.select :role, OpenStax::Accounts::Account.roles.keys.map{|rr| [rr, rr]} %>&nbsp;
15
16
  <%= f.submit 'Create', class: 'btn btn-primary' %>
16
17
  </div>
17
18
 
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Accounts
3
- VERSION = "7.5.0"
3
+ VERSION = "7.6.0"
4
4
  end
5
5
  end
@@ -5,14 +5,12 @@ http_interactions:
5
5
  uri: http://localhost:2999/oauth/token
6
6
  body:
7
7
  encoding: UTF-8
8
- string: grant_type=client_credentials
8
+ string: client_id=6f3dbfdbb87bf28db1c8279f44c39ea3c3a702ae4303ebcb5a5d8067dc040f85&client_secret=a439ff2377713b3372f8044062f23ad1eb515237e1711cbe6f442c1bea935373&grant_type=client_credentials
9
9
  headers:
10
10
  User-Agent:
11
11
  - Faraday v0.9.2
12
12
  Content-Type:
13
13
  - application/x-www-form-urlencoded
14
- Authorization:
15
- - Basic c2VjcmV0OnNlY3JldA==
16
14
  Accept-Encoding:
17
15
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
16
  Accept:
@@ -22,6 +20,12 @@ http_interactions:
22
20
  code: 200
23
21
  message: OK
24
22
  headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
25
29
  Cache-Control:
26
30
  - no-store
27
31
  Pragma:
@@ -30,38 +34,36 @@ http_interactions:
30
34
  - application/json; charset=utf-8
31
35
  P3p:
32
36
  - CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
33
- X-Ua-Compatible:
34
- - IE=Edge
35
37
  Etag:
36
- - '"4d3718fd0478ef136de460e558d5c8d7"'
38
+ - W/"da2f9b92fc82c5fa07f64029a71cff95"
37
39
  X-Request-Id:
38
- - 249cad60b7aebb41386944e6b96e58b9
40
+ - 26a0a272-9fcf-42c9-a702-357b46a5c070
39
41
  X-Runtime:
40
- - '0.016859'
42
+ - '0.030377'
41
43
  Connection:
42
44
  - close
43
45
  Server:
44
46
  - thin
45
47
  body:
46
48
  encoding: UTF-8
47
- string: '{"access_token":"62eff19592e9e0cfdf08b43d4829d47ad0d321f78ad6e81b37199db94c3d5531","token_type":"bearer","created_at":1462315169}'
49
+ string: '{"access_token":"c31fe09157c9801c88356a972d0e0c95aa13081cea77ae45f098b5dc7f614642","token_type":"bearer","created_at":1497844427}'
48
50
  http_version:
49
- recorded_at: Tue, 03 May 2016 22:39:29 GMT
51
+ recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
50
52
  - request:
51
53
  method: post
52
54
  uri: http://localhost:2999/api/user/find-or-create
53
55
  body:
54
56
  encoding: UTF-8
55
- string: '{"email":"alice@example.com","username":null,"password":null,"first_name":null,"last_name":null,"full_name":null}'
57
+ string: '{"email":"alice@example.com","username":null,"password":null,"first_name":null,"last_name":null,"full_name":null,"salesforce_contact_id":null,"faculty_status":null,"role":null}'
56
58
  headers:
57
59
  User-Agent:
58
60
  - Faraday v0.9.2
59
61
  Accept:
60
62
  - application/vnd.accounts.openstax.v1
61
- Authorization:
62
- - Bearer 62eff19592e9e0cfdf08b43d4829d47ad0d321f78ad6e81b37199db94c3d5531
63
63
  Content-Type:
64
- - application/x-www-form-urlencoded
64
+ - application/json
65
+ Authorization:
66
+ - Bearer c31fe09157c9801c88356a972d0e0c95aa13081cea77ae45f098b5dc7f614642
65
67
  Accept-Encoding:
66
68
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
67
69
  response:
@@ -69,42 +71,46 @@ http_interactions:
69
71
  code: 201
70
72
  message: Created
71
73
  headers:
74
+ X-Frame-Options:
75
+ - SAMEORIGIN
76
+ X-Xss-Protection:
77
+ - 1; mode=block
78
+ X-Content-Type-Options:
79
+ - nosniff
80
+ Date:
81
+ - Mon, 19 Jun 2017 03:53:47 GMT
72
82
  Content-Type:
73
83
  - application/json; charset=utf-8
74
84
  P3p:
75
85
  - CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
76
- X-Ua-Compatible:
77
- - IE=Edge
78
86
  Etag:
79
- - '"32010082256a713244a9f66180c4631e"'
87
+ - W/"c61c434670d5436a6af8a75c120f5bdf"
80
88
  Cache-Control:
81
89
  - max-age=0, private, must-revalidate
82
90
  X-Request-Id:
83
- - 7791a847ebc816bb146145e5f92fe7af
91
+ - 4d8fb993-d7ef-4820-9248-8c830caf1b78
84
92
  X-Runtime:
85
- - '0.030350'
93
+ - '0.227730'
86
94
  Connection:
87
95
  - close
88
96
  Server:
89
97
  - thin
90
98
  body:
91
99
  encoding: UTF-8
92
- string: '{"id":52}'
100
+ string: '{"id":18,"uuid":"8c5c819f-d9d9-46e7-98b9-d737fc0f13fe"}'
93
101
  http_version:
94
- recorded_at: Tue, 03 May 2016 22:39:29 GMT
102
+ recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
95
103
  - request:
96
104
  method: post
97
105
  uri: http://localhost:2999/oauth/token
98
106
  body:
99
107
  encoding: UTF-8
100
- string: grant_type=client_credentials
108
+ string: client_id=6f3dbfdbb87bf28db1c8279f44c39ea3c3a702ae4303ebcb5a5d8067dc040f85&client_secret=a439ff2377713b3372f8044062f23ad1eb515237e1711cbe6f442c1bea935373&grant_type=client_credentials
101
109
  headers:
102
110
  User-Agent:
103
111
  - Faraday v0.9.2
104
112
  Content-Type:
105
113
  - application/x-www-form-urlencoded
106
- Authorization:
107
- - Basic c2VjcmV0OnNlY3JldA==
108
114
  Accept-Encoding:
109
115
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
110
116
  Accept:
@@ -114,6 +120,12 @@ http_interactions:
114
120
  code: 200
115
121
  message: OK
116
122
  headers:
123
+ X-Frame-Options:
124
+ - SAMEORIGIN
125
+ X-Xss-Protection:
126
+ - 1; mode=block
127
+ X-Content-Type-Options:
128
+ - nosniff
117
129
  Cache-Control:
118
130
  - no-store
119
131
  Pragma:
@@ -122,38 +134,36 @@ http_interactions:
122
134
  - application/json; charset=utf-8
123
135
  P3p:
124
136
  - CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
125
- X-Ua-Compatible:
126
- - IE=Edge
127
137
  Etag:
128
- - '"db04ae46157ec6201ca409769f9016d8"'
138
+ - W/"c7a634c41cb04b393e0cd348d63efec1"
129
139
  X-Request-Id:
130
- - b1535a57c791c79854f6c336af0bc4fd
140
+ - b977409f-0914-4eac-832e-3d406140ef24
131
141
  X-Runtime:
132
- - '0.010447'
142
+ - '0.023528'
133
143
  Connection:
134
144
  - close
135
145
  Server:
136
146
  - thin
137
147
  body:
138
148
  encoding: UTF-8
139
- string: '{"access_token":"8775df1803c483f2c200833d73be5a6a47ee5734c13954b608a61c6a32b77a87","token_type":"bearer","created_at":1462315169}'
149
+ string: '{"access_token":"1c4df98e8f1b07b4dd33aa81150262c829999aaf0564721c423f01c263c2114f","token_type":"bearer","created_at":1497844427}'
140
150
  http_version:
141
- recorded_at: Tue, 03 May 2016 22:39:29 GMT
151
+ recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
142
152
  - request:
143
153
  method: post
144
154
  uri: http://localhost:2999/api/user/find-or-create
145
155
  body:
146
156
  encoding: UTF-8
147
- string: '{"email":null,"username":"alice","password":null,"first_name":null,"last_name":null,"full_name":null}'
157
+ string: '{"email":null,"username":"alice","password":null,"first_name":null,"last_name":null,"full_name":null,"salesforce_contact_id":null,"faculty_status":null,"role":null}'
148
158
  headers:
149
159
  User-Agent:
150
160
  - Faraday v0.9.2
151
161
  Accept:
152
162
  - application/vnd.accounts.openstax.v1
153
- Authorization:
154
- - Bearer 8775df1803c483f2c200833d73be5a6a47ee5734c13954b608a61c6a32b77a87
155
163
  Content-Type:
156
- - application/x-www-form-urlencoded
164
+ - application/json
165
+ Authorization:
166
+ - Bearer 1c4df98e8f1b07b4dd33aa81150262c829999aaf0564721c423f01c263c2114f
157
167
  Accept-Encoding:
158
168
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
159
169
  response:
@@ -161,42 +171,46 @@ http_interactions:
161
171
  code: 201
162
172
  message: Created
163
173
  headers:
174
+ X-Frame-Options:
175
+ - SAMEORIGIN
176
+ X-Xss-Protection:
177
+ - 1; mode=block
178
+ X-Content-Type-Options:
179
+ - nosniff
180
+ Date:
181
+ - Mon, 19 Jun 2017 03:53:47 GMT
164
182
  Content-Type:
165
183
  - application/json; charset=utf-8
166
184
  P3p:
167
185
  - CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
168
- X-Ua-Compatible:
169
- - IE=Edge
170
186
  Etag:
171
- - '"e773f5532f2567755653d537dac4a60b"'
187
+ - W/"a6c213351d9df66ee31997f7ed447fbc"
172
188
  Cache-Control:
173
189
  - max-age=0, private, must-revalidate
174
190
  X-Request-Id:
175
- - e5706745ca116b03fa6c1b69557a40f9
191
+ - ee7c0cba-d530-4a21-b94c-5adf7efb994a
176
192
  X-Runtime:
177
- - '0.027753'
193
+ - '0.067316'
178
194
  Connection:
179
195
  - close
180
196
  Server:
181
197
  - thin
182
198
  body:
183
199
  encoding: UTF-8
184
- string: '{"id":53}'
200
+ string: '{"id":19,"uuid":"c1ebaa86-b8ef-4100-9213-a16ca741d47f"}'
185
201
  http_version:
186
- recorded_at: Tue, 03 May 2016 22:39:29 GMT
202
+ recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
187
203
  - request:
188
204
  method: post
189
205
  uri: http://localhost:2999/oauth/token
190
206
  body:
191
207
  encoding: UTF-8
192
- string: grant_type=client_credentials
208
+ string: client_id=6f3dbfdbb87bf28db1c8279f44c39ea3c3a702ae4303ebcb5a5d8067dc040f85&client_secret=a439ff2377713b3372f8044062f23ad1eb515237e1711cbe6f442c1bea935373&grant_type=client_credentials
193
209
  headers:
194
210
  User-Agent:
195
211
  - Faraday v0.9.2
196
212
  Content-Type:
197
213
  - application/x-www-form-urlencoded
198
- Authorization:
199
- - Basic c2VjcmV0OnNlY3JldA==
200
214
  Accept-Encoding:
201
215
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
202
216
  Accept:
@@ -206,6 +220,12 @@ http_interactions:
206
220
  code: 200
207
221
  message: OK
208
222
  headers:
223
+ X-Frame-Options:
224
+ - SAMEORIGIN
225
+ X-Xss-Protection:
226
+ - 1; mode=block
227
+ X-Content-Type-Options:
228
+ - nosniff
209
229
  Cache-Control:
210
230
  - no-store
211
231
  Pragma:
@@ -214,38 +234,36 @@ http_interactions:
214
234
  - application/json; charset=utf-8
215
235
  P3p:
216
236
  - CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
217
- X-Ua-Compatible:
218
- - IE=Edge
219
237
  Etag:
220
- - '"ce964e7db2a0f7f30e6ba0a48b4e2288"'
238
+ - W/"a0d885d8947b3be5da25673a937640fc"
221
239
  X-Request-Id:
222
- - d5da0cb12baeca40f42dcaf8278cf410
240
+ - 21711558-b1df-4a12-b141-1e0a073f71db
223
241
  X-Runtime:
224
- - '0.014209'
242
+ - '0.022856'
225
243
  Connection:
226
244
  - close
227
245
  Server:
228
246
  - thin
229
247
  body:
230
248
  encoding: UTF-8
231
- string: '{"access_token":"b7c5ce6a934afb2274976c59a0be9f7302b65a013b213ca43068f257fb6e025b","token_type":"bearer","created_at":1462315169}'
249
+ string: '{"access_token":"21bb7c60df067e7354ec7e3b2e83d2d39831aece5938d20e8e68e6ea52ab59ff","token_type":"bearer","created_at":1497844427}'
232
250
  http_version:
233
- recorded_at: Tue, 03 May 2016 22:39:29 GMT
251
+ recorded_at: Mon, 19 Jun 2017 03:53:47 GMT
234
252
  - request:
235
253
  method: post
236
254
  uri: http://localhost:2999/api/user/find-or-create
237
255
  body:
238
256
  encoding: UTF-8
239
- string: '{"email":null,"username":"alice2","password":"abcdefghijklmnop","first_name":null,"last_name":null,"full_name":null}'
257
+ string: '{"email":null,"username":"alice2","password":"abcdefghijklmnop","first_name":null,"last_name":null,"full_name":null,"salesforce_contact_id":null,"faculty_status":null,"role":null}'
240
258
  headers:
241
259
  User-Agent:
242
260
  - Faraday v0.9.2
243
261
  Accept:
244
262
  - application/vnd.accounts.openstax.v1
245
- Authorization:
246
- - Bearer b7c5ce6a934afb2274976c59a0be9f7302b65a013b213ca43068f257fb6e025b
247
263
  Content-Type:
248
- - application/x-www-form-urlencoded
264
+ - application/json
265
+ Authorization:
266
+ - Bearer 21bb7c60df067e7354ec7e3b2e83d2d39831aece5938d20e8e68e6ea52ab59ff
249
267
  Accept-Encoding:
250
268
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
251
269
  response:
@@ -253,27 +271,33 @@ http_interactions:
253
271
  code: 201
254
272
  message: Created
255
273
  headers:
274
+ X-Frame-Options:
275
+ - SAMEORIGIN
276
+ X-Xss-Protection:
277
+ - 1; mode=block
278
+ X-Content-Type-Options:
279
+ - nosniff
280
+ Date:
281
+ - Mon, 19 Jun 2017 03:53:48 GMT
256
282
  Content-Type:
257
283
  - application/json; charset=utf-8
258
284
  P3p:
259
285
  - CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
260
- X-Ua-Compatible:
261
- - IE=Edge
262
286
  Etag:
263
- - '"113a43af89a575a4de9d701e79ea00b2"'
287
+ - W/"1574b45433f3e6117795d9e71a8a7fc9"
264
288
  Cache-Control:
265
289
  - max-age=0, private, must-revalidate
266
290
  X-Request-Id:
267
- - 203238eaa5500b54f6122aa9138b62f2
291
+ - 818cfe0a-9264-43c8-a73f-48cfbea35672
268
292
  X-Runtime:
269
- - '0.034642'
293
+ - '0.142613'
270
294
  Connection:
271
295
  - close
272
296
  Server:
273
297
  - thin
274
298
  body:
275
299
  encoding: UTF-8
276
- string: '{"id":54}'
300
+ string: '{"id":20,"uuid":"76c36a75-5b5a-4dbd-8800-5c1916c6f1f2"}'
277
301
  http_version:
278
- recorded_at: Tue, 03 May 2016 22:39:29 GMT
279
- recorded_with: VCR 3.0.1
302
+ recorded_at: Mon, 19 Jun 2017 03:53:48 GMT
303
+ recorded_with: VCR 3.0.3