Class: Scim::Shady::User

Inherits:
Kit::V2::Resource
  • Object
show all
Defined in:
lib/scim/shady/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ User

Returns a new instance of User.



4
5
6
# File 'lib/scim/shady/user.rb', line 4

def initialize(attributes = {})
  super(schemas: [self.class.schema], attributes: attributes)
end

Class Method Details

.schema(location: "/v2/Schemas/#{::Scim::Kit::V2::Schemas::USER}") ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/scim/shady/user.rb', line 8

def self.schema(location: "/v2/Schemas/#{::Scim::Kit::V2::Schemas::USER}")
  schema = ::Scim::Kit::V2::Schema.new(id: ::Scim::Kit::V2::Schemas::USER, name: 'User', location: location)
  schema.add_attribute(name: :user_name) do |x|
    x.multi_valued = false
    x.description = "Unique identifier for the User, typically used by the user to directly authenticate to the service provider.  Each User MUST include a non-empty userName value.  This identifier MUST be unique across the service provider's entire set of Users.  REQUIRED."
    x.required = true
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :server
  end
  schema.add_attribute(name: :name, type: :complex) do |x|
    x.multi_valued = false
    x.description = "The components of the user's real name.  Providers MAY return just the full name as a single string in the formatted sub-attribute, or they MAY return just the individual component attributes using the other sub-attributes, or they MAY return both.  If both variants are returned, they SHOULD be describing the same name, with the formatted name indicating how the component attributes should be combined."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
    x.add_attribute(name: :formatted) do |y|
      y.multi_valued = false
      y.description = "The full name, including all middle names, titles, and suffixes as appropriate, formatted for display (e.g., 'Ms. Barbara J Jensen, III')."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :family_name) do |y|
      y.multi_valued = false
      y.description = "The family name of the User, or last name in most Western languages (e.g., 'Jensen' given the full name 'Ms. Barbara J Jensen, III')."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :given_name) do |y|
      y.multi_valued = false
      y.description = "The given name of the User, or first name in most Western languages (e.g., 'Barbara' given the full name 'Ms. Barbara J Jensen, III')."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :middle_name) do |y|
      y.multi_valued = false
      y.description = "The middle name(s) of the User (e.g., 'Jane' given the full name 'Ms. Barbara J Jensen, III')."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :honorific_prefix) do |y|
      y.multi_valued = false
      y.description = "The honorific prefix(es) of the User, or title in most Western languages (e.g., 'Ms.' given the full name 'Ms. Barbara J Jensen, III')."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :honorific_suffix) do |y|
      y.multi_valued = false
      y.description = "The honorific suffix(es) of the User, or suffix in most Western languages (e.g., 'III' given the full name 'Ms. Barbara J Jensen, III')."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
  end
  schema.add_attribute(name: :display_name, type: :string) do |x|
    x.multi_valued = false
    x.description = "The name of the User, suitable for display to end-users.  The name SHOULD be the full name of the User being described, if known."
    x.required = false
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
  end
  schema.add_attribute(name: :nick_name, type: :string) do |x|
    x.multi_valued = false
    x.description = "The casual way to address the user in real life, e.g., 'Bob' or 'Bobby' instead of 'Robert'.  This attribute SHOULD NOT be used to represent a User's username (e.g., 'bjensen' or 'mpepperidge')."
    x.required = false
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
  end
  schema.add_attribute(name: :preferred_language, type: :string) do |x|
    x.multi_valued = false
    x.description = "Indicates the User's preferred written or spoken language.  Generally used for selecting a localized user interface; e.g., 'en_US' specifies the language English and country US."
    x.required = false
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
  end
  schema.add_attribute(name: :locale, type: :string) do |x|
    x.multi_valued = false
    x.description = "Used to indicate the User's default location for purposes of localizing items such as currency, date time format, or numerical representations."
    x.required = false
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
  end
  schema.add_attribute(name: :timezone, type: :string) do |x|
    x.multi_valued = false
    x.description = "The User's time zone in the 'Olson' time zone database format, e.g., 'America/Los_Angeles'."
    x.required = false
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
  end
  schema.add_attribute(name: :active, type: :boolean) do |x|
    x.multi_valued = false
    x.description = "A Boolean value indicating the User's administrative status."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
  end
  schema.add_attribute(name: :password, type: :string) do |x|
    x.multi_valued = false
    x.description = "The User's cleartext password.  This attribute is intended to be used as a means to specify an initial password when creating a new User or to reset an existing User's password."
    x.required = false
    x.case_exact = false
    x.mutability = :write_only
    x.returned = :never
    x.uniqueness = :none
  end
  schema.add_attribute(name: :emails, type: :complex) do |x|
    x.multi_valued = true
    x.description = "Email addresses for the user.  The value SHOULD be canonicalized by the service provider, e.g., '[email protected]' instead of '[email protected]'.  Canonical type values of 'work', 'home', and 'other'."
    x.required = false
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
    x.add_attribute(name: :value, type: :string) do |y|
      y.multi_valued = false
      y.description = "Email addresses for the user.  The value SHOULD be canonicalized by the service provider, e.g., '[email protected]' instead of '[email protected]'.  Canonical type values of 'work', 'home', and 'other'."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function, e.g., 'work' or 'home'."
      y.required = false
      y.case_exact = false
      y.canonical_values = ['work', 'home', 'other']
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :primary, type: :boolean) do |y|
      y.multi_valued = false
      y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred mailing address or primary email address.  The primary attribute value 'true' MUST appear no more than once."
      y.required = false
      y.mutability = :read_write
      y.returned = :default
    end
  end
  schema.add_attribute(name: :phone_numbers, type: :complex) do |x|
    x.multi_valued = true
    x.description = "Phone numbers for the User.  The value SHOULD be canonicalized by the service provider according to the format specified in RFC 3966, e.g., 'tel:+1-201-555-0123'.  Canonical type values of 'work', 'home', 'mobile', 'fax', 'pager', and 'other'."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
    x.add_attribute(name: :value, type: :string) do |y|
      y.multi_valued = false
      y.description = "Phone number of the User."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function, e.g., 'work', 'home', 'mobile'."
      y.required = false
      y.case_exact = false
      y.canonical_values = ['work', 'home', 'mobile', 'fax', 'pager', 'other']
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :primary, type: :boolean) do |y|
      y.multi_valued = false
      y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred phone number or primary phone number.  The primary attribute value 'true' MUST appear no more than once."
      y.required = false
      y.mutability = :read_write
      y.returned = :default
    end
  end
  schema.add_attribute(name: :ims, type: :complex) do |x|
    x.multi_valued = true
    x.description = "Instant messaging addresses for the User."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
    x.add_attribute(name: :value, type: :string) do |y|
      y.multi_valued = false
      y.description = "Instant messaging address for the User."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function, e.g., 'aim', 'gtalk', 'xmpp'."
      y.required = false
      y.case_exact = false
      y.canonical_values = ['aim', 'gtalk', 'icq', 'xmpp', 'msn', 'skype', 'qq', 'yahoo']
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :primary, type: :boolean) do |y|
      y.multi_valued = false
      y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred messenger or primary messenger.  The primary attribute value 'true' MUST appear no more than once."
      y.required = false
      y.mutability = :read_write
      y.returned = :default
    end
  end
  schema.add_attribute(name: :photos, type: :complex) do |x|
    x.multi_valued = true
    x.description = "URLs of photos of the User."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
    x.add_attribute(name: :value, type: :reference) do |y|
      y.reference_types = ['external']
      y.multi_valued = false
      y.description = "URL of a photo of the User."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function, i.e., 'photo' or 'thumbnail'."
      y.required = false
      y.case_exact = false
      y.canonical_values = ['photo', 'thumbnail']
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :primary, type: :boolean) do |y|
      y.multi_valued = false
      y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred photo or thumbnail.  The primary attribute value 'true' MUST appear no more than once."
      y.required = false
      y.mutability = :read_write
      y.returned = :default
    end
  end
  schema.add_attribute(name: :addresses, type: :complex) do |x|
    x.multi_valued = true
    x.description = "A physical mailing address for this User.  Canonical type values of 'work', 'home', and 'other'.  This attribute is a complex type with the following sub-attributes."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
    x.uniqueness = :none
    x.add_attribute(name: :formatted, type: :string) do |y|
      y.multi_valued = false
      y.description = "The full mailing address, formatted for display or use with a mailing label.  This attribute MAY contain newlines."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :street_address, type: :string) do |y|
      y.multi_valued = false
      y.description = "The full street address component, which may include house number, street name, P.O. box, and multi-line extended street address information.  This attribute MAY contain newlines."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :locality, type: :string) do |y|
      y.multi_valued = false
      y.description = "The city or locality component."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :region, type: :string) do |y|
      y.multi_valued = false
      y.description = "The state or region component."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :postal_code, type: :string) do |y|
      y.multi_valued = false
      y.description = "The zip code or postal code component."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :country, type: :string) do |y|
      y.multi_valued = false
      y.description = "The country name component."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function, e.g., 'work' or 'home'."
      y.required = false
      y.case_exact = false
      y.canonical_values = ['work', 'home', 'other']
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
  end
  schema.add_attribute(name: :groups, type: :complex) do |x|
    x.multi_valued = true
    x.description = "A list of groups to which the user belongs, either through direct membership, through nested groups, or dynamically calculated."
    x.required = false
    x.mutability = :read_only
    x.returned = :default
    x.add_attribute(name: :value, type: :string) do |y|
      y.multi_valued = false
      y.description = "The identifier of the User's group."
      y.required = false
      y.case_exact = false
      y.mutability = :read_only
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: '$ref', type: :reference) do |y|
      y.multi_valued = false
      y.description = "The URI of the corresponding 'Group' resource to which the user belongs."
      y.required = false
      y.case_exact = false
      y.mutability = :read_only
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_only
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function, e.g., 'direct' or 'indirect'."
      y.required = false
      y.case_exact = false
      y.canonical_values = ['direct', 'indirect']
      y.mutability = :read_only
      y.returned = :default
      y.uniqueness = :none
    end
  end
  schema.add_attribute(name: :entitlements, type: :complex) do |x|
    x.multi_valued = true
    x.description = "A list of entitlements for the User that represent a thing the User has."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
    x.add_attribute(name: :value, type: :string) do |y|
      y.multi_valued = false
      y.description = "The value of an entitlement."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :primary, type: :boolean) do |y|
      y.multi_valued = false
      y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute.  The primary attribute value 'true' MUST appear no more than once."
      y.required = false
      y.mutability = :read_write
      y.returned = :default
    end
  end
  schema.add_attribute(name: :roles, type: :complex) do |x|
    x.multi_valued = true
    x.description = "A list of roles for the User that collectively represent who the User is, e.g., 'Student', 'Faculty'."
    x.required = false
    x.mutability = :read_write
    x.returned = :default
    x.add_attribute(name: :value, type: :string) do |y|
      y.multi_valued = false
      y.description = "The value of a role."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function."
      y.required = false
      y.case_exact = false
      y.canonical_values = []
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :primary, type: :boolean) do |y|
      y.multi_valued = false
      y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute.  The primary attribute value 'true' MUST appear no more than once."
      y.required = false
      y.mutability = :read_write
      y.returned = :default
    end
  end
  schema.add_attribute(name: :x509_certificates, type: :complex) do |x|
    x.multi_valued = true
    x.description = "A list of certificates issued to the User."
    x.required = false
    x.case_exact = false
    x.mutability = :read_write
    x.returned = :default
    x.add_attribute(name: :value, type: :binary) do |y|
      y.multi_valued = false
      y.description = "The value of an X.509 certificate."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :display, type: :string) do |y|
      y.multi_valued = false
      y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :type, type: :string) do |y|
      y.multi_valued = false
      y.description = "A label indicating the attribute's function."
      y.required = false
      y.case_exact = false
      y.mutability = :read_write
      y.returned = :default
      y.uniqueness = :none
    end
    x.add_attribute(name: :primary, type: :boolean) do |y|
      y.multi_valued = false
      y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute.  The primary attribute value 'true' MUST appear no more than once."
      y.required = false
      y.mutability = :read_write
      y.returned = :default
    end
  end
  schema
end