Class: Authentik::Api::User

Inherits:
ApiModelBase show all
Defined in:
lib/authentik/api/models/user.rb

Overview

User Serializer

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ User

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
# File 'lib/authentik/api/models/user.rb', line 151

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Authentik::Api::User` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Authentik::Api::User`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'pk')
    self.pk = attributes[:'pk']
  else
    self.pk = nil
  end

  if attributes.key?(:'username')
    self.username = attributes[:'username']
  else
    self.username = nil
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'is_active')
    self.is_active = attributes[:'is_active']
  end

  if attributes.key?(:'last_login')
    self. = attributes[:'last_login']
  end

  if attributes.key?(:'date_joined')
    self.date_joined = attributes[:'date_joined']
  else
    self.date_joined = nil
  end

  if attributes.key?(:'is_superuser')
    self.is_superuser = attributes[:'is_superuser']
  else
    self.is_superuser = nil
  end

  if attributes.key?(:'groups')
    if (value = attributes[:'groups']).is_a?(Array)
      self.groups = value
    end
  end

  if attributes.key?(:'groups_obj')
    if (value = attributes[:'groups_obj']).is_a?(Array)
      self.groups_obj = value
    end
  else
    self.groups_obj = nil
  end

  if attributes.key?(:'roles')
    if (value = attributes[:'roles']).is_a?(Array)
      self.roles = value
    end
  end

  if attributes.key?(:'roles_obj')
    if (value = attributes[:'roles_obj']).is_a?(Array)
      self.roles_obj = value
    end
  else
    self.roles_obj = nil
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'avatar')
    self.avatar = attributes[:'avatar']
  else
    self.avatar = nil
  end

  if attributes.key?(:'attributes')
    if (value = attributes[:'attributes']).is_a?(Hash)
      self.attributes = value
    end
  end

  if attributes.key?(:'uid')
    self.uid = attributes[:'uid']
  else
    self.uid = nil
  end

  if attributes.key?(:'path')
    self.path = attributes[:'path']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'uuid')
    self.uuid = attributes[:'uuid']
  else
    self.uuid = nil
  end

  if attributes.key?(:'password_change_date')
    self.password_change_date = attributes[:'password_change_date']
  else
    self.password_change_date = nil
  end

  if attributes.key?(:'last_updated')
    self.last_updated = attributes[:'last_updated']
  else
    self.last_updated = nil
  end
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



42
43
44
# File 'lib/authentik/api/models/user.rb', line 42

def attributes
  @attributes
end

#avatarObject

User’s avatar, either a http/https URL or a data URI



40
41
42
# File 'lib/authentik/api/models/user.rb', line 40

def avatar
  @avatar
end

#date_joinedObject

Returns the value of attribute date_joined.



25
26
27
# File 'lib/authentik/api/models/user.rb', line 25

def date_joined
  @date_joined
end

#emailObject

Returns the value of attribute email.



37
38
39
# File 'lib/authentik/api/models/user.rb', line 37

def email
  @email
end

#groupsObject

Returns the value of attribute groups.



29
30
31
# File 'lib/authentik/api/models/user.rb', line 29

def groups
  @groups
end

#groups_objObject

Returns the value of attribute groups_obj.



31
32
33
# File 'lib/authentik/api/models/user.rb', line 31

def groups_obj
  @groups_obj
end

#is_activeObject

Designates whether this user should be treated as active. Unselect this instead of deleting accounts.



21
22
23
# File 'lib/authentik/api/models/user.rb', line 21

def is_active
  @is_active
end

#is_superuserObject

Returns the value of attribute is_superuser.



27
28
29
# File 'lib/authentik/api/models/user.rb', line 27

def is_superuser
  @is_superuser
end

#last_loginObject

Returns the value of attribute last_login.



23
24
25
# File 'lib/authentik/api/models/user.rb', line 23

def 
  @last_login
end

#last_updatedObject

Returns the value of attribute last_updated.



54
55
56
# File 'lib/authentik/api/models/user.rb', line 54

def last_updated
  @last_updated
end

#nameObject

User’s display name.



18
19
20
# File 'lib/authentik/api/models/user.rb', line 18

def name
  @name
end

#password_change_dateObject

Returns the value of attribute password_change_date.



52
53
54
# File 'lib/authentik/api/models/user.rb', line 52

def password_change_date
  @password_change_date
end

#pathObject

Returns the value of attribute path.



46
47
48
# File 'lib/authentik/api/models/user.rb', line 46

def path
  @path
end

#pkObject

Returns the value of attribute pk.



13
14
15
# File 'lib/authentik/api/models/user.rb', line 13

def pk
  @pk
end

#rolesObject

Returns the value of attribute roles.



33
34
35
# File 'lib/authentik/api/models/user.rb', line 33

def roles
  @roles
end

#roles_objObject

Returns the value of attribute roles_obj.



35
36
37
# File 'lib/authentik/api/models/user.rb', line 35

def roles_obj
  @roles_obj
end

#typeObject

Returns the value of attribute type.



48
49
50
# File 'lib/authentik/api/models/user.rb', line 48

def type
  @type
end

#uidObject

Returns the value of attribute uid.



44
45
46
# File 'lib/authentik/api/models/user.rb', line 44

def uid
  @uid
end

#usernameObject

Returns the value of attribute username.



15
16
17
# File 'lib/authentik/api/models/user.rb', line 15

def username
  @username
end

#uuidObject

Returns the value of attribute uuid.



50
51
52
# File 'lib/authentik/api/models/user.rb', line 50

def uuid
  @uuid
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



105
106
107
# File 'lib/authentik/api/models/user.rb', line 105

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



110
111
112
# File 'lib/authentik/api/models/user.rb', line 110

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/authentik/api/models/user.rb', line 79

def self.attribute_map
  {
    :'pk' => :'pk',
    :'username' => :'username',
    :'name' => :'name',
    :'is_active' => :'is_active',
    :'last_login' => :'last_login',
    :'date_joined' => :'date_joined',
    :'is_superuser' => :'is_superuser',
    :'groups' => :'groups',
    :'groups_obj' => :'groups_obj',
    :'roles' => :'roles',
    :'roles_obj' => :'roles_obj',
    :'email' => :'email',
    :'avatar' => :'avatar',
    :'attributes' => :'attributes',
    :'uid' => :'uid',
    :'path' => :'path',
    :'type' => :'type',
    :'uuid' => :'uuid',
    :'password_change_date' => :'password_change_date',
    :'last_updated' => :'last_updated'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/authentik/api/models/user.rb', line 515

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



141
142
143
144
145
146
147
# File 'lib/authentik/api/models/user.rb', line 141

def self.openapi_nullable
  Set.new([
    :'last_login',
    :'groups_obj',
    :'roles_obj',
  ])
end

.openapi_typesObject

Attribute type mapping.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/authentik/api/models/user.rb', line 115

def self.openapi_types
  {
    :'pk' => :'Integer',
    :'username' => :'String',
    :'name' => :'String',
    :'is_active' => :'Boolean',
    :'last_login' => :'Time',
    :'date_joined' => :'Time',
    :'is_superuser' => :'Boolean',
    :'groups' => :'Array<String>',
    :'groups_obj' => :'Array<PartialGroup>',
    :'roles' => :'Array<String>',
    :'roles_obj' => :'Array<Role>',
    :'email' => :'String',
    :'avatar' => :'String',
    :'attributes' => :'Hash<String, Object>',
    :'uid' => :'String',
    :'path' => :'String',
    :'type' => :'UserTypeEnum',
    :'uuid' => :'String',
    :'password_change_date' => :'Time',
    :'last_updated' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/authentik/api/models/user.rb', line 475

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      pk == o.pk &&
      username == o.username &&
      name == o.name &&
      is_active == o.is_active &&
       == o. &&
      date_joined == o.date_joined &&
      is_superuser == o.is_superuser &&
      groups == o.groups &&
      groups_obj == o.groups_obj &&
      roles == o.roles &&
      roles_obj == o.roles_obj &&
      email == o.email &&
      avatar == o.avatar &&
      attributes == o.attributes &&
      uid == o.uid &&
      path == o.path &&
      type == o.type &&
      uuid == o.uuid &&
      password_change_date == o.password_change_date &&
      last_updated == o.last_updated
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


502
503
504
# File 'lib/authentik/api/models/user.rb', line 502

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



508
509
510
# File 'lib/authentik/api/models/user.rb', line 508

def hash
  [pk, username, name, is_active, , date_joined, is_superuser, groups, groups_obj, roles, roles_obj, email, avatar, attributes, uid, path, type, uuid, password_change_date, last_updated].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/authentik/api/models/user.rb', line 282

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @pk.nil?
    invalid_properties.push('invalid value for "pk", pk cannot be nil.')
  end

  if @username.nil?
    invalid_properties.push('invalid value for "username", username cannot be nil.')
  end

  if @username.to_s.length > 150
    invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 150.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @date_joined.nil?
    invalid_properties.push('invalid value for "date_joined", date_joined cannot be nil.')
  end

  if @is_superuser.nil?
    invalid_properties.push('invalid value for "is_superuser", is_superuser cannot be nil.')
  end

  if !@email.nil? && @email.to_s.length > 254
    invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 254.')
  end

  if @avatar.nil?
    invalid_properties.push('invalid value for "avatar", avatar cannot be nil.')
  end

  if @uid.nil?
    invalid_properties.push('invalid value for "uid", uid cannot be nil.')
  end

  if @uuid.nil?
    invalid_properties.push('invalid value for "uuid", uuid cannot be nil.')
  end

  if @password_change_date.nil?
    invalid_properties.push('invalid value for "password_change_date", password_change_date cannot be nil.')
  end

  if @last_updated.nil?
    invalid_properties.push('invalid value for "last_updated", last_updated cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/authentik/api/models/user.rb', line 537

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/authentik/api/models/user.rb', line 338

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @pk.nil?
  return false if @username.nil?
  return false if @username.to_s.length > 150
  return false if @name.nil?
  return false if @date_joined.nil?
  return false if @is_superuser.nil?
  return false if !@email.nil? && @email.to_s.length > 254
  return false if @avatar.nil?
  return false if @uid.nil?
  return false if @uuid.nil?
  return false if @password_change_date.nil?
  return false if @last_updated.nil?
  true
end