main
  1module Scim
  2  module Shady
  3    class User < ::Scim::Kit::V2::Resource
  4      def initialize(attributes = {})
  5        super(schemas: [self.class.schema], attributes: attributes)
  6      end
  7
  8      def self.schema(location: "/v2/Schemas/#{::Scim::Kit::V2::Schemas::USER}")
  9        schema = ::Scim::Kit::V2::Schema.new(id: ::Scim::Kit::V2::Schemas::USER, name: 'User', location: location)
 10        schema.add_attribute(name: :user_name) do |x|
 11          x.multi_valued = false
 12          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."
 13          x.required = true
 14          x.case_exact = false
 15          x.mutability = :read_write
 16          x.returned = :default
 17          x.uniqueness = :server
 18        end
 19        schema.add_attribute(name: :name, type: :complex) do |x|
 20          x.multi_valued = false
 21          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."
 22          x.required = false
 23          x.mutability = :read_write
 24          x.returned = :default
 25          x.uniqueness = :none
 26          x.add_attribute(name: :formatted) do |y|
 27            y.multi_valued = false
 28            y.description = "The full name, including all middle names, titles, and suffixes as appropriate, formatted for display (e.g., 'Ms. Barbara J Jensen, III')."
 29            y.required = false
 30            y.case_exact = false
 31            y.mutability = :read_write
 32            y.returned = :default
 33            y.uniqueness = :none
 34          end
 35          x.add_attribute(name: :family_name) do |y|
 36            y.multi_valued = false
 37            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')."
 38            y.required = false
 39            y.case_exact = false
 40            y.mutability = :read_write
 41            y.returned = :default
 42            y.uniqueness = :none
 43          end
 44          x.add_attribute(name: :given_name) do |y|
 45            y.multi_valued = false
 46            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')."
 47            y.required = false
 48            y.case_exact = false
 49            y.mutability = :read_write
 50            y.returned = :default
 51            y.uniqueness = :none
 52          end
 53          x.add_attribute(name: :middle_name) do |y|
 54            y.multi_valued = false
 55            y.description = "The middle name(s) of the User (e.g., 'Jane' given the full name 'Ms. Barbara J Jensen, III')."
 56            y.required = false
 57            y.case_exact = false
 58            y.mutability = :read_write
 59            y.returned = :default
 60            y.uniqueness = :none
 61          end
 62          x.add_attribute(name: :honorific_prefix) do |y|
 63            y.multi_valued = false
 64            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')."
 65            y.required = false
 66            y.case_exact = false
 67            y.mutability = :read_write
 68            y.returned = :default
 69            y.uniqueness = :none
 70          end
 71          x.add_attribute(name: :honorific_suffix) do |y|
 72            y.multi_valued = false
 73            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')."
 74            y.required = false
 75            y.case_exact = false
 76            y.mutability = :read_write
 77            y.returned = :default
 78            y.uniqueness = :none
 79          end
 80        end
 81        schema.add_attribute(name: :display_name, type: :string) do |x|
 82          x.multi_valued = false
 83          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."
 84          x.required = false
 85          x.case_exact = false
 86          x.mutability = :read_write
 87          x.returned = :default
 88          x.uniqueness = :none
 89        end
 90        schema.add_attribute(name: :nick_name, type: :string) do |x|
 91          x.multi_valued = false
 92          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')."
 93          x.required = false
 94          x.case_exact = false
 95          x.mutability = :read_write
 96          x.returned = :default
 97          x.uniqueness = :none
 98        end
 99        schema.add_attribute(name: :preferred_language, type: :string) do |x|
100          x.multi_valued = false
101          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."
102          x.required = false
103          x.case_exact = false
104          x.mutability = :read_write
105          x.returned = :default
106          x.uniqueness = :none
107        end
108        schema.add_attribute(name: :locale, type: :string) do |x|
109          x.multi_valued = false
110          x.description = "Used to indicate the User's default location for purposes of localizing items such as currency, date time format, or numerical representations."
111          x.required = false
112          x.case_exact = false
113          x.mutability = :read_write
114          x.returned = :default
115          x.uniqueness = :none
116        end
117        schema.add_attribute(name: :timezone, type: :string) do |x|
118          x.multi_valued = false
119          x.description = "The User's time zone in the 'Olson' time zone database format, e.g., 'America/Los_Angeles'."
120          x.required = false
121          x.case_exact = false
122          x.mutability = :read_write
123          x.returned = :default
124          x.uniqueness = :none
125        end
126        schema.add_attribute(name: :active, type: :boolean) do |x|
127          x.multi_valued = false
128          x.description = "A Boolean value indicating the User's administrative status."
129          x.required = false
130          x.mutability = :read_write
131          x.returned = :default
132        end
133        schema.add_attribute(name: :password, type: :string) do |x|
134          x.multi_valued = false
135          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."
136          x.required = false
137          x.case_exact = false
138          x.mutability = :write_only
139          x.returned = :never
140          x.uniqueness = :none
141        end
142        schema.add_attribute(name: :emails, type: :complex) do |x|
143          x.multi_valued = true
144          x.description = "Email addresses for the user.  The value SHOULD be canonicalized by the service provider, e.g., 'bjensen@example.com' instead of 'bjensen@EXAMPLE.COM'.  Canonical type values of 'work', 'home', and 'other'."
145          x.required = false
146          x.case_exact = false
147          x.mutability = :read_write
148          x.returned = :default
149          x.uniqueness = :none
150          x.add_attribute(name: :value, type: :string) do |y|
151            y.multi_valued = false
152            y.description = "Email addresses for the user.  The value SHOULD be canonicalized by the service provider, e.g., 'bjensen@example.com' instead of 'bjensen@EXAMPLE.COM'.  Canonical type values of 'work', 'home', and 'other'."
153            y.required = false
154            y.case_exact = false
155            y.mutability = :read_write
156            y.returned = :default
157            y.uniqueness = :none
158          end
159          x.add_attribute(name: :display, type: :string) do |y|
160            y.multi_valued = false
161            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
162            y.required = false
163            y.case_exact = false
164            y.mutability = :read_write
165            y.returned = :default
166            y.uniqueness = :none
167          end
168          x.add_attribute(name: :type, type: :string) do |y|
169            y.multi_valued = false
170            y.description = "A label indicating the attribute's function, e.g., 'work' or 'home'."
171            y.required = false
172            y.case_exact = false
173            y.canonical_values = ['work', 'home', 'other']
174            y.mutability = :read_write
175            y.returned = :default
176            y.uniqueness = :none
177          end
178          x.add_attribute(name: :primary, type: :boolean) do |y|
179            y.multi_valued = false
180            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."
181            y.required = false
182            y.mutability = :read_write
183            y.returned = :default
184          end
185        end
186        schema.add_attribute(name: :phone_numbers, type: :complex) do |x|
187          x.multi_valued = true
188          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'."
189          x.required = false
190          x.mutability = :read_write
191          x.returned = :default
192          x.add_attribute(name: :value, type: :string) do |y|
193            y.multi_valued = false
194            y.description = "Phone number of the User."
195            y.required = false
196            y.case_exact = false
197            y.mutability = :read_write
198            y.returned = :default
199            y.uniqueness = :none
200          end
201          x.add_attribute(name: :display, type: :string) do |y|
202            y.multi_valued = false
203            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
204            y.required = false
205            y.case_exact = false
206            y.mutability = :read_write
207            y.returned = :default
208            y.uniqueness = :none
209          end
210          x.add_attribute(name: :type, type: :string) do |y|
211            y.multi_valued = false
212            y.description = "A label indicating the attribute's function, e.g., 'work', 'home', 'mobile'."
213            y.required = false
214            y.case_exact = false
215            y.canonical_values = ['work', 'home', 'mobile', 'fax', 'pager', 'other']
216            y.mutability = :read_write
217            y.returned = :default
218            y.uniqueness = :none
219          end
220          x.add_attribute(name: :primary, type: :boolean) do |y|
221            y.multi_valued = false
222            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."
223            y.required = false
224            y.mutability = :read_write
225            y.returned = :default
226          end
227        end
228        schema.add_attribute(name: :ims, type: :complex) do |x|
229          x.multi_valued = true
230          x.description = "Instant messaging addresses for the User."
231          x.required = false
232          x.mutability = :read_write
233          x.returned = :default
234          x.add_attribute(name: :value, type: :string) do |y|
235            y.multi_valued = false
236            y.description = "Instant messaging address for the User."
237            y.required = false
238            y.case_exact = false
239            y.mutability = :read_write
240            y.returned = :default
241            y.uniqueness = :none
242          end
243          x.add_attribute(name: :display, type: :string) do |y|
244            y.multi_valued = false
245            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
246            y.required = false
247            y.case_exact = false
248            y.mutability = :read_write
249            y.returned = :default
250            y.uniqueness = :none
251          end
252          x.add_attribute(name: :type, type: :string) do |y|
253            y.multi_valued = false
254            y.description = "A label indicating the attribute's function, e.g., 'aim', 'gtalk', 'xmpp'."
255            y.required = false
256            y.case_exact = false
257            y.canonical_values = ['aim', 'gtalk', 'icq', 'xmpp', 'msn', 'skype', 'qq', 'yahoo']
258            y.mutability = :read_write
259            y.returned = :default
260            y.uniqueness = :none
261          end
262          x.add_attribute(name: :primary, type: :boolean) do |y|
263            y.multi_valued = false
264            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."
265            y.required = false
266            y.mutability = :read_write
267            y.returned = :default
268          end
269        end
270        schema.add_attribute(name: :photos, type: :complex) do |x|
271          x.multi_valued = true
272          x.description = "URLs of photos of the User."
273          x.required = false
274          x.mutability = :read_write
275          x.returned = :default
276          x.add_attribute(name: :value, type: :reference) do |y|
277            y.reference_types = ['external']
278            y.multi_valued = false
279            y.description = "URL of a photo of the User."
280            y.required = false
281            y.case_exact = false
282            y.mutability = :read_write
283            y.returned = :default
284            y.uniqueness = :none
285          end
286          x.add_attribute(name: :display, type: :string) do |y|
287            y.multi_valued = false
288            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
289            y.required = false
290            y.case_exact = false
291            y.mutability = :read_write
292            y.returned = :default
293            y.uniqueness = :none
294          end
295          x.add_attribute(name: :type, type: :string) do |y|
296            y.multi_valued = false
297            y.description = "A label indicating the attribute's function, i.e., 'photo' or 'thumbnail'."
298            y.required = false
299            y.case_exact = false
300            y.canonical_values = ['photo', 'thumbnail']
301            y.mutability = :read_write
302            y.returned = :default
303            y.uniqueness = :none
304          end
305          x.add_attribute(name: :primary, type: :boolean) do |y|
306            y.multi_valued = false
307            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."
308            y.required = false
309            y.mutability = :read_write
310            y.returned = :default
311          end
312        end
313        schema.add_attribute(name: :addresses, type: :complex) do |x|
314          x.multi_valued = true
315          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."
316          x.required = false
317          x.mutability = :read_write
318          x.returned = :default
319          x.uniqueness = :none
320          x.add_attribute(name: :formatted, type: :string) do |y|
321            y.multi_valued = false
322            y.description = "The full mailing address, formatted for display or use with a mailing label.  This attribute MAY contain newlines."
323            y.required = false
324            y.case_exact = false
325            y.mutability = :read_write
326            y.returned = :default
327            y.uniqueness = :none
328          end
329          x.add_attribute(name: :street_address, type: :string) do |y|
330            y.multi_valued = false
331            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."
332            y.required = false
333            y.case_exact = false
334            y.mutability = :read_write
335            y.returned = :default
336            y.uniqueness = :none
337          end
338          x.add_attribute(name: :locality, type: :string) do |y|
339            y.multi_valued = false
340            y.description = "The city or locality component."
341            y.required = false
342            y.case_exact = false
343            y.mutability = :read_write
344            y.returned = :default
345            y.uniqueness = :none
346          end
347          x.add_attribute(name: :region, type: :string) do |y|
348            y.multi_valued = false
349            y.description = "The state or region component."
350            y.required = false
351            y.case_exact = false
352            y.mutability = :read_write
353            y.returned = :default
354            y.uniqueness = :none
355          end
356          x.add_attribute(name: :postal_code, type: :string) do |y|
357            y.multi_valued = false
358            y.description = "The zip code or postal code component."
359            y.required = false
360            y.case_exact = false
361            y.mutability = :read_write
362            y.returned = :default
363            y.uniqueness = :none
364          end
365          x.add_attribute(name: :country, type: :string) do |y|
366            y.multi_valued = false
367            y.description = "The country name component."
368            y.required = false
369            y.case_exact = false
370            y.mutability = :read_write
371            y.returned = :default
372            y.uniqueness = :none
373          end
374          x.add_attribute(name: :type, type: :string) do |y|
375            y.multi_valued = false
376            y.description = "A label indicating the attribute's function, e.g., 'work' or 'home'."
377            y.required = false
378            y.case_exact = false
379            y.canonical_values = ['work', 'home', 'other']
380            y.mutability = :read_write
381            y.returned = :default
382            y.uniqueness = :none
383          end
384        end
385        schema.add_attribute(name: :groups, type: :complex) do |x|
386          x.multi_valued = true
387          x.description = "A list of groups to which the user belongs, either through direct membership, through nested groups, or dynamically calculated."
388          x.required = false
389          x.mutability = :read_only
390          x.returned = :default
391          x.add_attribute(name: :value, type: :string) do |y|
392            y.multi_valued = false
393            y.description = "The identifier of the User's group."
394            y.required = false
395            y.case_exact = false
396            y.mutability = :read_only
397            y.returned = :default
398            y.uniqueness = :none
399          end
400          x.add_attribute(name: '$ref', type: :reference) do |y|
401            y.multi_valued = false
402            y.description = "The URI of the corresponding 'Group' resource to which the user belongs."
403            y.required = false
404            y.case_exact = false
405            y.mutability = :read_only
406            y.returned = :default
407            y.uniqueness = :none
408          end
409          x.add_attribute(name: :display, type: :string) do |y|
410            y.multi_valued = false
411            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
412            y.required = false
413            y.case_exact = false
414            y.mutability = :read_only
415            y.returned = :default
416            y.uniqueness = :none
417          end
418          x.add_attribute(name: :type, type: :string) do |y|
419            y.multi_valued = false
420            y.description = "A label indicating the attribute's function, e.g., 'direct' or 'indirect'."
421            y.required = false
422            y.case_exact = false
423            y.canonical_values = ['direct', 'indirect']
424            y.mutability = :read_only
425            y.returned = :default
426            y.uniqueness = :none
427          end
428        end
429        schema.add_attribute(name: :entitlements, type: :complex) do |x|
430          x.multi_valued = true
431          x.description = "A list of entitlements for the User that represent a thing the User has."
432          x.required = false
433          x.mutability = :read_write
434          x.returned = :default
435          x.add_attribute(name: :value, type: :string) do |y|
436            y.multi_valued = false
437            y.description = "The value of an entitlement."
438            y.required = false
439            y.case_exact = false
440            y.mutability = :read_write
441            y.returned = :default
442            y.uniqueness = :none
443          end
444          x.add_attribute(name: :display, type: :string) do |y|
445            y.multi_valued = false
446            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
447            y.required = false
448            y.case_exact = false
449            y.mutability = :read_write
450            y.returned = :default
451            y.uniqueness = :none
452          end
453          x.add_attribute(name: :type, type: :string) do |y|
454            y.multi_valued = false
455            y.description = "A label indicating the attribute's function."
456            y.required = false
457            y.case_exact = false
458            y.mutability = :read_write
459            y.returned = :default
460            y.uniqueness = :none
461          end
462          x.add_attribute(name: :primary, type: :boolean) do |y|
463            y.multi_valued = false
464            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."
465            y.required = false
466            y.mutability = :read_write
467            y.returned = :default
468          end
469        end
470        schema.add_attribute(name: :roles, type: :complex) do |x|
471          x.multi_valued = true
472          x.description = "A list of roles for the User that collectively represent who the User is, e.g., 'Student', 'Faculty'."
473          x.required = false
474          x.mutability = :read_write
475          x.returned = :default
476          x.add_attribute(name: :value, type: :string) do |y|
477            y.multi_valued = false
478            y.description = "The value of a role."
479            y.required = false
480            y.case_exact = false
481            y.mutability = :read_write
482            y.returned = :default
483            y.uniqueness = :none
484          end
485          x.add_attribute(name: :display, type: :string) do |y|
486            y.multi_valued = false
487            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
488            y.required = false
489            y.case_exact = false
490            y.mutability = :read_write
491            y.returned = :default
492            y.uniqueness = :none
493          end
494          x.add_attribute(name: :type, type: :string) do |y|
495            y.multi_valued = false
496            y.description = "A label indicating the attribute's function."
497            y.required = false
498            y.case_exact = false
499            y.canonical_values = []
500            y.mutability = :read_write
501            y.returned = :default
502            y.uniqueness = :none
503          end
504          x.add_attribute(name: :primary, type: :boolean) do |y|
505            y.multi_valued = false
506            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."
507            y.required = false
508            y.mutability = :read_write
509            y.returned = :default
510          end
511        end
512        schema.add_attribute(name: :x509_certificates, type: :complex) do |x|
513          x.multi_valued = true
514          x.description = "A list of certificates issued to the User."
515          x.required = false
516          x.case_exact = false
517          x.mutability = :read_write
518          x.returned = :default
519          x.add_attribute(name: :value, type: :binary) do |y|
520            y.multi_valued = false
521            y.description = "The value of an X.509 certificate."
522            y.required = false
523            y.case_exact = false
524            y.mutability = :read_write
525            y.returned = :default
526            y.uniqueness = :none
527          end
528          x.add_attribute(name: :display, type: :string) do |y|
529            y.multi_valued = false
530            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
531            y.required = false
532            y.case_exact = false
533            y.mutability = :read_write
534            y.returned = :default
535            y.uniqueness = :none
536          end
537          x.add_attribute(name: :type, type: :string) do |y|
538            y.multi_valued = false
539            y.description = "A label indicating the attribute's function."
540            y.required = false
541            y.case_exact = false
542            y.mutability = :read_write
543            y.returned = :default
544            y.uniqueness = :none
545          end
546          x.add_attribute(name: :primary, type: :boolean) do |y|
547            y.multi_valued = false
548            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."
549            y.required = false
550            y.mutability = :read_write
551            y.returned = :default
552          end
553        end
554        schema
555      end
556    end
557  end
558end