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



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

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?(:'base_url')
    self.base_url = attributes[:'base_url']
  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

#base_urlObject

Configure the base URL under which this authentik instance is reachable, e.g. https://authentik.company



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

def base_url
  @base_url
end

#default_token_durationObject

Default token duration



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

def default_token_duration
  @default_token_duration
end

#default_token_lengthObject

Default token length



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

def default_token_length
  @default_token_length
end

#default_user_change_emailObject

Enable the ability for users to change their email address.



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

def default_user_change_email
  @default_user_change_email
end

#default_user_change_nameObject

Enable the ability for users to change their name.



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

def default_user_change_name
  @default_user_change_name
end

#default_user_change_usernameObject

Enable the ability for users to change their username.



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

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).



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

def event_retention
  @event_retention
end

#flagsObject

Returns the value of attribute flags.



60
61
62
# File 'lib/authentik/api/models/settings.rb', line 60

def flags
  @flags
end

Returns the value of attribute footer_links.



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

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.



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

def gdpr_compliance
  @gdpr_compliance
end

#impersonationObject

Globally enable/disable impersonation.



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

def impersonation
  @impersonation
end

#impersonation_require_reasonObject

Require administrators to provide a reason for impersonating a user.



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

def impersonation_require_reason
  @impersonation_require_reason
end

#pagination_default_page_sizeObject

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



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

def pagination_default_page_size
  @pagination_default_page_size
end

#pagination_max_page_sizeObject

Maximum page size



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

def pagination_max_page_size
  @pagination_max_page_size
end

#reputation_lower_limitObject

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



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

def reputation_lower_limit
  @reputation_lower_limit
end

#reputation_upper_limitObject

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



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

def reputation_upper_limit
  @reputation_upper_limit
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



91
92
93
# File 'lib/authentik/api/models/settings.rb', line 91

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'avatars' => :'avatars',
    :'base_url' => :'base_url',
    :'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



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/authentik/api/models/settings.rb', line 440

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



119
120
121
122
123
# File 'lib/authentik/api/models/settings.rb', line 119

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

.openapi_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/authentik/api/models/settings.rb', line 96

def self.openapi_types
  {
    :'avatars' => :'String',
    :'base_url' => :'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



403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/authentik/api/models/settings.rb', line 403

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      avatars == o.avatars &&
      base_url == o.base_url &&
      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


427
428
429
# File 'lib/authentik/api/models/settings.rb', line 427

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



433
434
435
# File 'lib/authentik/api/models/settings.rb', line 433

def hash
  [avatars, base_url, 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



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

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

  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



462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/authentik/api/models/settings.rb', line 462

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



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/authentik/api/models/settings.rb', line 270

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@base_url.nil? && @base_url.to_s.length > 200
  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