Class: Comet::UserProfileConfig
- Inherits:
-
Object
- Object
- Comet::UserProfileConfig
- Defined in:
- lib/comet/models/user_profile_config.rb
Overview
UserProfileConfig is a typed class wrapper around the underlying Comet Server API data structure. This is the main data structure for a user’s profile.
Instance Attribute Summary collapse
-
#account_name ⇒ Object
A longer descriptive name for this account.
-
#all_protected_items_quota_bytes ⇒ Object
A limit on the total Size of all Protected Items in this account.
-
#all_protected_items_quota_enabled ⇒ Object
A limit on the total Size of all Protected Items in this account.
-
#allow_password_and_totplogin ⇒ Object
If true, then TOTP is required to open the desktop app or the Comet Server web interface with this user’s credentials.
-
#allow_password_login ⇒ Object
Allow login using the password alone.
-
#auto_storage_template_guid ⇒ Object
Returns the value of attribute auto_storage_template_guid.
-
#backup_rules ⇒ Object
Schedules The string keys can be any unique key.
-
#create_time ⇒ Object
Unix timestamp in seconds.
-
#creation_guid ⇒ Object
A random GUID that is allocated when the user profile is created for the first time.
-
#destinations ⇒ Object
Storage Vaults The string keys can be any unique key.
-
#devices ⇒ Object
Devices The string keys are the device’s ID.
-
#emails ⇒ Object
A list of email addresses to send reports to.
-
#group_id ⇒ Object
Returns the value of attribute group_id.
-
#is_suspended ⇒ Object
Returns the value of attribute is_suspended.
-
#language_code ⇒ Object
One of the supported languages, such as en_US (DEFAULT_LANGUAGE).
-
#last_suspended ⇒ Object
Unix timestamp in seconds.
-
#local_timezone ⇒ Object
Timezone in IANA format.
-
#maximum_devices ⇒ Object
A limit on the total number of devices registered in this account.
-
#organization_id ⇒ Object
Tenant.
-
#override_email_settings ⇒ Object
By default, all the email addresses in the Emails field will receive the policy-default or server-wide-default style of email report.
-
#password_format ⇒ Object
One of the PASSWORD_FORMAT_ constants To change the user’s password, use the AdminResetUserPassword API instead of accessing these fields directly.
-
#password_hash ⇒ Object
Returns the value of attribute password_hash.
-
#password_recovery ⇒ Object
If this field is empty, the “Allow administrator to reset my password” feature is turned off.
-
#policy ⇒ Object
The Policy field contains a read-only copy of the effective Policy that is applied to this user account.
-
#policy_id ⇒ Object
If the PolicyID field is set to a non-empty string, the Comet Server will enforce the contents of the Policy field based on the matching server’s policy.
-
#quota_hyper_vguests ⇒ Object
A limit on the total number of Hyper-V guests across all Hyper-V Protected Items in this account.
-
#quota_office_365protected_accounts ⇒ Object
A limit on the total number of Office 365 Protected Accounts across all Office 365 Protected Items in this account.
-
#quota_vmware_guests ⇒ Object
A limit on the total number of VMware guests across all VMware Protected Items in this account.
-
#require_password_change ⇒ Object
This field is available in Comet 20.3.4 and later.
-
#send_email_reports ⇒ Object
This option can be used to control whether any email reports are sent.
-
#server_config ⇒ Object
Additional server-wide settings that are enforced for this user profile.
-
#sources ⇒ Object
Protected Items The string keys can be any unique key.
-
#supports_device_associations ⇒ Object
Leave as true.
-
#totpkey ⇒ Object
Returns the value of attribute totpkey.
-
#totpkey_encryption_format ⇒ Object
One of the ENCRYPTIONMETHOD_ constants.
-
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
-
#username ⇒ Object
The name for this account.
Instance Method Summary collapse
- #clear ⇒ Object
- #from_hash(obj) ⇒ Object
- #from_json(json_string) ⇒ Object
-
#initialize ⇒ UserProfileConfig
constructor
A new instance of UserProfileConfig.
-
#to_h ⇒ Hash
The complete object as a Ruby hash.
-
#to_hash ⇒ Hash
The complete object as a Ruby hash.
-
#to_json(options = {}) ⇒ String
The complete object as a JSON string.
Constructor Details
#initialize ⇒ UserProfileConfig
Returns a new instance of UserProfileConfig.
187 188 189 |
# File 'lib/comet/models/user_profile_config.rb', line 187 def initialize clear end |
Instance Attribute Details
#account_name ⇒ Object
A longer descriptive name for this account. It is not necessarily unique to the Comet Server. The end-user might be able to change it inside the Comet Backup desktop app.
24 25 26 |
# File 'lib/comet/models/user_profile_config.rb', line 24 def account_name @account_name end |
#all_protected_items_quota_bytes ⇒ Object
A limit on the total Size of all Protected Items in this account. It is enforced if AllProtectedItemsQuotaEnabled is true.
99 100 101 |
# File 'lib/comet/models/user_profile_config.rb', line 99 def all_protected_items_quota_bytes @all_protected_items_quota_bytes end |
#all_protected_items_quota_enabled ⇒ Object
A limit on the total Size of all Protected Items in this account. The number of bytes should be configured in AllProtectedItemsQuotaBytes.
94 95 96 |
# File 'lib/comet/models/user_profile_config.rb', line 94 def all_protected_items_quota_enabled @all_protected_items_quota_enabled end |
#allow_password_and_totplogin ⇒ Object
If true, then TOTP is required to open the desktop app or the Comet Server web interface with this user’s credentials.
155 156 157 |
# File 'lib/comet/models/user_profile_config.rb', line 155 def allow_password_and_totplogin @allow_password_and_totplogin end |
#allow_password_login ⇒ Object
Allow login using the password alone. Set this to false if the password alone should not be sufficient.
150 151 152 |
# File 'lib/comet/models/user_profile_config.rb', line 150 def allow_password_login @allow_password_login end |
#auto_storage_template_guid ⇒ Object
Returns the value of attribute auto_storage_template_guid.
182 183 184 |
# File 'lib/comet/models/user_profile_config.rb', line 182 def auto_storage_template_guid @auto_storage_template_guid end |
#backup_rules ⇒ Object
Schedules The string keys can be any unique key. Using a GUID is recommended, but optional.
73 74 75 |
# File 'lib/comet/models/user_profile_config.rb', line 73 def backup_rules @backup_rules end |
#create_time ⇒ Object
Unix timestamp in seconds
170 171 172 |
# File 'lib/comet/models/user_profile_config.rb', line 170 def create_time @create_time end |
#creation_guid ⇒ Object
A random GUID that is allocated when the user profile is created for the first time. You can use this to help disambiguate users with the same username across multiple Comet Servers.
175 176 177 |
# File 'lib/comet/models/user_profile_config.rb', line 175 def creation_guid @creation_guid end |
#destinations ⇒ Object
Storage Vaults The string keys can be any unique key. Using a GUID is recommended, but optional.
59 60 61 |
# File 'lib/comet/models/user_profile_config.rb', line 59 def destinations @destinations end |
#devices ⇒ Object
Devices The string keys are the device’s ID. The device ID is generated automatically based on a mix of hardware and software identifiers on the installed PC. To revoke a device, use the AdminRevokeDevice API instead of accessing these fields directly. This API can also remove associated Protected Items, uninstall the remote device, and disconnect its live connection.
82 83 84 |
# File 'lib/comet/models/user_profile_config.rb', line 82 def devices @devices end |
#emails ⇒ Object
A list of email addresses to send reports to.
44 45 46 |
# File 'lib/comet/models/user_profile_config.rb', line 44 def emails @emails end |
#group_id ⇒ Object
Returns the value of attribute group_id.
40 41 42 |
# File 'lib/comet/models/user_profile_config.rb', line 40 def group_id @group_id end |
#is_suspended ⇒ Object
Returns the value of attribute is_suspended.
85 86 87 |
# File 'lib/comet/models/user_profile_config.rb', line 85 def is_suspended @is_suspended end |
#language_code ⇒ Object
One of the supported languages, such as en_US (DEFAULT_LANGUAGE).
33 34 35 |
# File 'lib/comet/models/user_profile_config.rb', line 33 def language_code @language_code end |
#last_suspended ⇒ Object
Unix timestamp in seconds. Zero if the device is not suspended.
89 90 91 |
# File 'lib/comet/models/user_profile_config.rb', line 89 def last_suspended @last_suspended end |
#local_timezone ⇒ Object
Timezone in IANA format. Individual devices may declare a more specific timezone in the Devices field.
29 30 31 |
# File 'lib/comet/models/user_profile_config.rb', line 29 def local_timezone @local_timezone end |
#maximum_devices ⇒ Object
A limit on the total number of devices registered in this account. Set to zero to allow unlimited devices.
104 105 106 |
# File 'lib/comet/models/user_profile_config.rb', line 104 def maximum_devices @maximum_devices end |
#organization_id ⇒ Object
Tenant
37 38 39 |
# File 'lib/comet/models/user_profile_config.rb', line 37 def organization_id @organization_id end |
#override_email_settings ⇒ Object
By default, all the email addresses in the Emails field will receive the policy-default or server-wide-default style of email report. Add an override for a specific email address in here to allow customizing the email report that will be received.
50 51 52 |
# File 'lib/comet/models/user_profile_config.rb', line 50 def override_email_settings @override_email_settings end |
#password_format ⇒ Object
One of the PASSWORD_FORMAT_ constants To change the user’s password, use the AdminResetUserPassword API instead of accessing these fields directly. Otherwise, other encrypted fields in the user profile may become corrupted.
136 137 138 |
# File 'lib/comet/models/user_profile_config.rb', line 136 def password_format @password_format end |
#password_hash ⇒ Object
Returns the value of attribute password_hash.
139 140 141 |
# File 'lib/comet/models/user_profile_config.rb', line 139 def password_hash @password_hash end |
#password_recovery ⇒ Object
If this field is empty, the “Allow administrator to reset my password” feature is turned off. If this field is filled, it contains a cryptographic root of trust that can decrypt and re-encrypt other secrets in this profile.
145 146 147 |
# File 'lib/comet/models/user_profile_config.rb', line 145 def password_recovery @password_recovery end |
#policy ⇒ Object
The Policy field contains a read-only copy of the effective Policy that is applied to this user account.
130 131 132 |
# File 'lib/comet/models/user_profile_config.rb', line 130 def policy @policy end |
#policy_id ⇒ Object
If the PolicyID field is set to a non-empty string, the Comet Server will enforce the contents of the Policy field based on the matching server’s policy. Otherwise if the PolicyID field is set to an empty string, the administrator may configure any custom values in the Policy field.
125 126 127 |
# File 'lib/comet/models/user_profile_config.rb', line 125 def policy_id @policy_id end |
#quota_hyper_vguests ⇒ Object
A limit on the total number of Hyper-V guests across all Hyper-V Protected Items in this account. Set to zero to allow unlimited Office 365 Protected Accounts.
114 115 116 |
# File 'lib/comet/models/user_profile_config.rb', line 114 def quota_hyper_vguests @quota_hyper_vguests end |
#quota_office_365protected_accounts ⇒ Object
A limit on the total number of Office 365 Protected Accounts across all Office 365 Protected Items in this account. Set to zero to allow unlimited Office 365 Protected Accounts.
109 110 111 |
# File 'lib/comet/models/user_profile_config.rb', line 109 def quota_office_365protected_accounts @quota_office_365protected_accounts end |
#quota_vmware_guests ⇒ Object
A limit on the total number of VMware guests across all VMware Protected Items in this account. Set to zero to allow unlimited Office 365 Protected Accounts.
119 120 121 |
# File 'lib/comet/models/user_profile_config.rb', line 119 def quota_vmware_guests @quota_vmware_guests end |
#require_password_change ⇒ Object
This field is available in Comet 20.3.4 and later.
166 167 168 |
# File 'lib/comet/models/user_profile_config.rb', line 166 def require_password_change @require_password_change end |
#send_email_reports ⇒ Object
This option can be used to control whether any email reports are sent.
54 55 56 |
# File 'lib/comet/models/user_profile_config.rb', line 54 def send_email_reports @send_email_reports end |
#server_config ⇒ Object
Additional server-wide settings that are enforced for this user profile
179 180 181 |
# File 'lib/comet/models/user_profile_config.rb', line 179 def server_config @server_config end |
#sources ⇒ Object
Protected Items The string keys can be any unique key. Using a GUID is recommended, but optional.
68 69 70 |
# File 'lib/comet/models/user_profile_config.rb', line 68 def sources @sources end |
#supports_device_associations ⇒ Object
Leave as true
63 64 65 |
# File 'lib/comet/models/user_profile_config.rb', line 63 def supports_device_associations @supports_device_associations end |
#totpkey ⇒ Object
Returns the value of attribute totpkey.
162 163 164 |
# File 'lib/comet/models/user_profile_config.rb', line 162 def totpkey @totpkey end |
#totpkey_encryption_format ⇒ Object
One of the ENCRYPTIONMETHOD_ constants
159 160 161 |
# File 'lib/comet/models/user_profile_config.rb', line 159 def totpkey_encryption_format @totpkey_encryption_format end |
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
185 186 187 |
# File 'lib/comet/models/user_profile_config.rb', line 185 def unknown_json_fields @unknown_json_fields end |
#username ⇒ Object
The name for this account. It uniquely identifies this UserProfileConfig across the entire Comet Server. It cannot be changed directly.
19 20 21 |
# File 'lib/comet/models/user_profile_config.rb', line 19 def username @username end |
Instance Method Details
#clear ⇒ Object
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 |
# File 'lib/comet/models/user_profile_config.rb', line 191 def clear @username = '' @account_name = '' @local_timezone = '' @language_code = '' @organization_id = '' @group_id = '' @emails = [] @override_email_settings = {} @destinations = {} @sources = {} @backup_rules = {} @devices = {} @last_suspended = 0 @all_protected_items_quota_bytes = 0 @maximum_devices = 0 @quota_office_365protected_accounts = 0 @quota_hyper_vguests = 0 @quota_vmware_guests = 0 @policy_id = '' @policy = Comet::UserPolicy.new @password_format = 0 @password_hash = '' @password_recovery = '' @totpkey_encryption_format = 0 @totpkey = '' @create_time = 0 @creation_guid = '' @server_config = Comet::UserServerConfig.new @auto_storage_template_guid = '' @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
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 |
# File 'lib/comet/models/user_profile_config.rb', line 232 def from_hash(obj) raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash obj.each do |k, v| case k when 'Username' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @username = v when 'AccountName' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @account_name = v when 'LocalTimezone' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @local_timezone = v when 'LanguageCode' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @language_code = v when 'OrganizationID' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @organization_id = v when 'GroupID' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @group_id = v when 'Emails' if v.nil? @emails = [] else @emails = Array.new(v.length) v.each_with_index do |v1, i1| raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String @emails[i1] = v1 end end when 'OverrideEmailSettings' @override_email_settings = {} if v.nil? @override_email_settings = {} else v.each do |k1, v1| @override_email_settings[k1] = Comet::UserCustomEmailSettings.new @override_email_settings[k1].from_hash(v1) end end when 'SendEmailReports' @send_email_reports = v when 'Destinations' @destinations = {} if v.nil? @destinations = {} else v.each do |k1, v1| @destinations[k1] = Comet::DestinationConfig.new @destinations[k1].from_hash(v1) end end when 'SupportsDeviceAssociations' @supports_device_associations = v when 'Sources' @sources = {} if v.nil? @sources = {} else v.each do |k1, v1| @sources[k1] = Comet::SourceConfig.new @sources[k1].from_hash(v1) end end when 'BackupRules' @backup_rules = {} if v.nil? @backup_rules = {} else v.each do |k1, v1| @backup_rules[k1] = Comet::BackupRuleConfig.new @backup_rules[k1].from_hash(v1) end end when 'Devices' @devices = {} if v.nil? @devices = {} else v.each do |k1, v1| @devices[k1] = Comet::DeviceConfig.new @devices[k1].from_hash(v1) end end when 'IsSuspended' @is_suspended = v when 'LastSuspended' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @last_suspended = v when 'AllProtectedItemsQuotaEnabled' @all_protected_items_quota_enabled = v when 'AllProtectedItemsQuotaBytes' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @all_protected_items_quota_bytes = v when 'MaximumDevices' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @maximum_devices = v when 'QuotaOffice365ProtectedAccounts' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @quota_office_365protected_accounts = v when 'QuotaHyperVGuests' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @quota_hyper_vguests = v when 'QuotaVMwareGuests' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @quota_vmware_guests = v when 'PolicyID' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @policy_id = v when 'Policy' @policy = Comet::UserPolicy.new @policy.from_hash(v) when 'PasswordFormat' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @password_format = v when 'PasswordHash' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @password_hash = v when 'PasswordRecovery' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @password_recovery = v when 'AllowPasswordLogin' @allow_password_login = v when 'AllowPasswordAndTOTPLogin' @allow_password_and_totplogin = v when 'TOTPKeyEncryptionFormat' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @totpkey_encryption_format = v when 'TOTPKey' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @totpkey = v when 'RequirePasswordChange' @require_password_change = v when 'CreateTime' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @create_time = v when 'CreationGUID' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @creation_guid = v when 'ServerConfig' @server_config = Comet::UserServerConfig.new @server_config.from_hash(v) when 'AutoStorageTemplateGUID' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @auto_storage_template_guid = v else @unknown_json_fields[k] = v end end end |
#from_json(json_string) ⇒ Object
225 226 227 228 229 |
# File 'lib/comet/models/user_profile_config.rb', line 225 def from_json(json_string) raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String from_hash(JSON.parse(json_string)) end |
#to_h ⇒ Hash
Returns The complete object as a Ruby hash.
462 463 464 |
# File 'lib/comet/models/user_profile_config.rb', line 462 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
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 |
# File 'lib/comet/models/user_profile_config.rb', line 409 def to_hash ret = {} ret['Username'] = @username ret['AccountName'] = @account_name ret['LocalTimezone'] = @local_timezone ret['LanguageCode'] = @language_code unless @organization_id.nil? ret['OrganizationID'] = @organization_id end ret['GroupID'] = @group_id ret['Emails'] = @emails ret['OverrideEmailSettings'] = @override_email_settings ret['SendEmailReports'] = @send_email_reports ret['Destinations'] = @destinations ret['SupportsDeviceAssociations'] = @supports_device_associations ret['Sources'] = @sources ret['BackupRules'] = @backup_rules ret['Devices'] = @devices ret['IsSuspended'] = @is_suspended unless @last_suspended.nil? ret['LastSuspended'] = @last_suspended end ret['AllProtectedItemsQuotaEnabled'] = @all_protected_items_quota_enabled ret['AllProtectedItemsQuotaBytes'] = @all_protected_items_quota_bytes ret['MaximumDevices'] = @maximum_devices ret['QuotaOffice365ProtectedAccounts'] = @quota_office_365protected_accounts ret['QuotaHyperVGuests'] = @quota_hyper_vguests ret['QuotaVMwareGuests'] = @quota_vmware_guests ret['PolicyID'] = @policy_id ret['Policy'] = @policy ret['PasswordFormat'] = @password_format ret['PasswordHash'] = @password_hash unless @password_recovery.nil? ret['PasswordRecovery'] = @password_recovery end ret['AllowPasswordLogin'] = @allow_password_login ret['AllowPasswordAndTOTPLogin'] = @allow_password_and_totplogin ret['TOTPKeyEncryptionFormat'] = @totpkey_encryption_format ret['TOTPKey'] = @totpkey ret['RequirePasswordChange'] = @require_password_change ret['CreateTime'] = @create_time ret['CreationGUID'] = @creation_guid unless @server_config.nil? ret['ServerConfig'] = @server_config end ret['AutoStorageTemplateGUID'] = @auto_storage_template_guid @unknown_json_fields.each do |k, v| ret[k] = v end ret end |
#to_json(options = {}) ⇒ String
Returns The complete object as a JSON string.
467 468 469 |
# File 'lib/comet/models/user_profile_config.rb', line 467 def to_json( = {}) to_hash.to_json() end |