Class: Authentik::Api::Settings

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

Overview

Settings Serializer

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 = {}) ⇒ Settings

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Authentik::Api::Settings` 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::Settings`. 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?(:'avatars')
    self.avatars = attributes[:'avatars']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#avatarsObject

Configure how authentik should show avatars for users.



14
15
16
# File 'lib/authentik/api/models/settings.rb', line 14

def avatars
  @avatars
end

#default_token_durationObject

Default token duration



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

def default_token_duration
  @default_token_duration
end

#default_token_lengthObject

Default token length



49
50
51
# File 'lib/authentik/api/models/settings.rb', line 49

def default_token_length
  @default_token_length
end

#default_user_change_emailObject

Enable the ability for users to change their email address.



20
21
22
# File 'lib/authentik/api/models/settings.rb', line 20

def default_user_change_email
  @default_user_change_email
end

#default_user_change_nameObject

Enable the ability for users to change their name.



17
18
19
# File 'lib/authentik/api/models/settings.rb', line 17

def default_user_change_name
  @default_user_change_name
end

#default_user_change_usernameObject

Enable the ability for users to change their username.



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

def default_user_change_username
  @default_user_change_username
end

#event_retentionObject

Events will be deleted after this duration.(Format: weeks=3;days=2;hours=3,seconds=2).



26
27
28
# File 'lib/authentik/api/models/settings.rb', line 26

def event_retention
  @event_retention
end

#flagsObject

Returns the value of attribute flags.



57
58
59
# File 'lib/authentik/api/models/settings.rb', line 57

def flags
  @flags
end

Returns the value of attribute footer_links.



34
35
36
# File 'lib/authentik/api/models/settings.rb', line 34

def footer_links
  @footer_links
end

#gdpr_complianceObject

When enabled, all the events caused by a user will be deleted upon the user’s deletion.



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

def gdpr_compliance
  @gdpr_compliance
end

#impersonationObject

Globally enable/disable impersonation.



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

def impersonation
  @impersonation
end

#impersonation_require_reasonObject

Require administrators to provide a reason for impersonating a user.



43
44
45
# File 'lib/authentik/api/models/settings.rb', line 43

def impersonation_require_reason
  @impersonation_require_reason
end

#pagination_default_page_sizeObject

Default page size for API responses, if no size was requested.



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

def pagination_default_page_size
  @pagination_default_page_size
end

#pagination_max_page_sizeObject

Maximum page size



55
56
57
# File 'lib/authentik/api/models/settings.rb', line 55

def pagination_max_page_size
  @pagination_max_page_size
end

#reputation_lower_limitObject

Reputation cannot decrease lower than this value. Zero or negative.



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

def reputation_lower_limit
  @reputation_lower_limit
end

#reputation_upper_limitObject

Reputation cannot increase higher than this value. Zero or positive.



32
33
34
# File 'lib/authentik/api/models/settings.rb', line 32

def reputation_upper_limit
  @reputation_upper_limit
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



82
83
84
# File 'lib/authentik/api/models/settings.rb', line 82

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



87
88
89
# File 'lib/authentik/api/models/settings.rb', line 87

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/authentik/api/models/settings.rb', line 60

def self.attribute_map
  {
    :'avatars' => :'avatars',
    :'default_user_change_name' => :'default_user_change_name',
    :'default_user_change_email' => :'default_user_change_email',
    :'default_user_change_username' => :'default_user_change_username',
    :'event_retention' => :'event_retention',
    :'reputation_lower_limit' => :'reputation_lower_limit',
    :'reputation_upper_limit' => :'reputation_upper_limit',
    :'footer_links' => :'footer_links',
    :'gdpr_compliance' => :'gdpr_compliance',
    :'impersonation' => :'impersonation',
    :'impersonation_require_reason' => :'impersonation_require_reason',
    :'default_token_duration' => :'default_token_duration',
    :'default_token_length' => :'default_token_length',
    :'pagination_default_page_size' => :'pagination_default_page_size',
    :'pagination_max_page_size' => :'pagination_max_page_size',
    :'flags' => :'flags'
  }
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



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/authentik/api/models/settings.rb', line 411

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



114
115
116
117
118
# File 'lib/authentik/api/models/settings.rb', line 114

def self.openapi_nullable
  Set.new([
    :'footer_links',
  ])
end

.openapi_typesObject

Attribute type mapping.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/authentik/api/models/settings.rb', line 92

def self.openapi_types
  {
    :'avatars' => :'String',
    :'default_user_change_name' => :'Boolean',
    :'default_user_change_email' => :'Boolean',
    :'default_user_change_username' => :'Boolean',
    :'event_retention' => :'String',
    :'reputation_lower_limit' => :'Integer',
    :'reputation_upper_limit' => :'Integer',
    :'footer_links' => :'Object',
    :'gdpr_compliance' => :'Boolean',
    :'impersonation' => :'Boolean',
    :'impersonation_require_reason' => :'Boolean',
    :'default_token_duration' => :'String',
    :'default_token_length' => :'Integer',
    :'pagination_default_page_size' => :'Integer',
    :'pagination_max_page_size' => :'Integer',
    :'flags' => :'PatchedSettingsRequestFlags'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/authentik/api/models/settings.rb', line 375

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      avatars == o.avatars &&
      default_user_change_name == o.default_user_change_name &&
      default_user_change_email == o.default_user_change_email &&
      default_user_change_username == o.default_user_change_username &&
      event_retention == o.event_retention &&
      reputation_lower_limit == o.reputation_lower_limit &&
      reputation_upper_limit == o.reputation_upper_limit &&
      footer_links == o.footer_links &&
      gdpr_compliance == o.gdpr_compliance &&
      impersonation == o.impersonation &&
      impersonation_require_reason == o.impersonation_require_reason &&
      default_token_duration == o.default_token_duration &&
      default_token_length == o.default_token_length &&
      pagination_default_page_size == o.pagination_default_page_size &&
      pagination_max_page_size == o.pagination_max_page_size &&
      flags == o.flags
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


398
399
400
# File 'lib/authentik/api/models/settings.rb', line 398

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



404
405
406
# File 'lib/authentik/api/models/settings.rb', line 404

def hash
  [avatars, default_user_change_name, default_user_change_email, default_user_change_username, event_retention, reputation_lower_limit, reputation_upper_limit, footer_links, gdpr_compliance, impersonation, impersonation_require_reason, default_token_duration, default_token_length, pagination_default_page_size, pagination_max_page_size, flags].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@reputation_lower_limit.nil? && @reputation_lower_limit > 0
    invalid_properties.push('invalid value for "reputation_lower_limit", must be smaller than or equal to 0.')
  end

  if !@reputation_lower_limit.nil? && @reputation_lower_limit < -2147483648
    invalid_properties.push('invalid value for "reputation_lower_limit", must be greater than or equal to -2147483648.')
  end

  if !@reputation_upper_limit.nil? && @reputation_upper_limit > 2147483647
    invalid_properties.push('invalid value for "reputation_upper_limit", must be smaller than or equal to 2147483647.')
  end

  if !@reputation_upper_limit.nil? && @reputation_upper_limit < 0
    invalid_properties.push('invalid value for "reputation_upper_limit", must be greater than or equal to 0.')
  end

  if !@default_token_length.nil? && @default_token_length > 2147483647
    invalid_properties.push('invalid value for "default_token_length", must be smaller than or equal to 2147483647.')
  end

  if !@default_token_length.nil? && @default_token_length < 1
    invalid_properties.push('invalid value for "default_token_length", must be greater than or equal to 1.')
  end

  if !@pagination_default_page_size.nil? && @pagination_default_page_size > 2147483647
    invalid_properties.push('invalid value for "pagination_default_page_size", must be smaller than or equal to 2147483647.')
  end

  if !@pagination_default_page_size.nil? && @pagination_default_page_size < 0
    invalid_properties.push('invalid value for "pagination_default_page_size", must be greater than or equal to 0.')
  end

  if !@pagination_max_page_size.nil? && @pagination_max_page_size > 2147483647
    invalid_properties.push('invalid value for "pagination_max_page_size", must be smaller than or equal to 2147483647.')
  end

  if !@pagination_max_page_size.nil? && @pagination_max_page_size < 0
    invalid_properties.push('invalid value for "pagination_max_page_size", must be greater than or equal to 0.')
  end

  if @flags.nil?
    invalid_properties.push('invalid value for "flags", flags 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



433
434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/authentik/api/models/settings.rb', line 433

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



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/authentik/api/models/settings.rb', line 257

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@reputation_lower_limit.nil? && @reputation_lower_limit > 0
  return false if !@reputation_lower_limit.nil? && @reputation_lower_limit < -2147483648
  return false if !@reputation_upper_limit.nil? && @reputation_upper_limit > 2147483647
  return false if !@reputation_upper_limit.nil? && @reputation_upper_limit < 0
  return false if !@default_token_length.nil? && @default_token_length > 2147483647
  return false if !@default_token_length.nil? && @default_token_length < 1
  return false if !@pagination_default_page_size.nil? && @pagination_default_page_size > 2147483647
  return false if !@pagination_default_page_size.nil? && @pagination_default_page_size < 0
  return false if !@pagination_max_page_size.nil? && @pagination_max_page_size > 2147483647
  return false if !@pagination_max_page_size.nil? && @pagination_max_page_size < 0
  return false if @flags.nil?
  true
end