Class: Comet::UserPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/models/user_policy.rb

Overview

UserPolicy is a typed class wrapper around the underlying Comet Server API data structure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUserPolicy

Returns a new instance of UserPolicy.



123
124
125
# File 'lib/comet/models/user_policy.rb', line 123

def initialize
  clear
end

Instance Attribute Details

#allow_edit_object_lock_retentionObject

Returns the value of attribute allow_edit_object_lock_retention.



103
104
105
# File 'lib/comet/models/user_policy.rb', line 103

def allow_edit_object_lock_retention
  @allow_edit_object_lock_retention
end

#default_backup_rulesObject

Returns the value of attribute default_backup_rules.



115
116
117
# File 'lib/comet/models/user_policy.rb', line 115

def default_backup_rules
  @default_backup_rules
end

#default_email_reportsObject

Returns the value of attribute default_email_reports.



91
92
93
# File 'lib/comet/models/user_policy.rb', line 91

def default_email_reports
  @default_email_reports
end

#default_sourcesObject

Returns the value of attribute default_sources.



106
107
108
# File 'lib/comet/models/user_policy.rb', line 106

def default_sources
  @default_sources
end

#default_sources_backup_rulesObject

Returns the value of attribute default_sources_backup_rules.



109
110
111
# File 'lib/comet/models/user_policy.rb', line 109

def default_sources_backup_rules
  @default_sources_backup_rules
end

#default_sources_with_osrestrictionObject

Returns the value of attribute default_sources_with_osrestriction.



112
113
114
# File 'lib/comet/models/user_policy.rb', line 112

def default_sources_with_osrestriction
  @default_sources_with_osrestriction
end

#default_storage_vault_retentionObject

Returns the value of attribute default_storage_vault_retention.



94
95
96
# File 'lib/comet/models/user_policy.rb', line 94

def default_storage_vault_retention
  @default_storage_vault_retention
end

#enforce_storage_vault_retentionObject

Returns the value of attribute enforce_storage_vault_retention.



97
98
99
# File 'lib/comet/models/user_policy.rb', line 97

def enforce_storage_vault_retention
  @enforce_storage_vault_retention
end

#file_and_folder_mandatory_exclusionsObject

Returns the value of attribute file_and_folder_mandatory_exclusions.



46
47
48
# File 'lib/comet/models/user_policy.rb', line 46

def file_and_folder_mandatory_exclusions
  @file_and_folder_mandatory_exclusions
end

#hide_app_importObject

Returns the value of attribute hide_app_import.



79
80
81
# File 'lib/comet/models/user_policy.rb', line 79

def hide_app_import
  @hide_app_import
end

#hide_app_versionObject

Returns the value of attribute hide_app_version.



82
83
84
# File 'lib/comet/models/user_policy.rb', line 82

def hide_app_version
  @hide_app_version
end

#hide_cloud_storage_brandingObject

Returns the value of attribute hide_cloud_storage_branding.



25
26
27
# File 'lib/comet/models/user_policy.rb', line 25

def hide_cloud_storage_branding
  @hide_cloud_storage_branding
end

#mode_admin_reset_passwordObject

Returns the value of attribute mode_admin_reset_password.



52
53
54
# File 'lib/comet/models/user_policy.rb', line 52

def mode_admin_reset_password
  @mode_admin_reset_password
end

#mode_admin_view_filenamesObject

Returns the value of attribute mode_admin_view_filenames.



55
56
57
# File 'lib/comet/models/user_policy.rb', line 55

def mode_admin_view_filenames
  @mode_admin_view_filenames
end

#mode_require_user_reset_passwordObject

Returns the value of attribute mode_require_user_reset_password.



58
59
60
# File 'lib/comet/models/user_policy.rb', line 58

def mode_require_user_reset_password
  @mode_require_user_reset_password
end

#mode_schedule_skip_already_runningObject

Returns the value of attribute mode_schedule_skip_already_running.



49
50
51
# File 'lib/comet/models/user_policy.rb', line 49

def mode_schedule_skip_already_running
  @mode_schedule_skip_already_running
end

#prevent_add_custom_storage_vaultObject

Returns the value of attribute prevent_add_custom_storage_vault.



19
20
21
# File 'lib/comet/models/user_policy.rb', line 19

def prevent_add_custom_storage_vault
  @prevent_add_custom_storage_vault
end

#prevent_change_account_nameObject

Returns the value of attribute prevent_change_account_name.



70
71
72
# File 'lib/comet/models/user_policy.rb', line 70

def 
  @prevent_change_account_name
end

#prevent_change_account_passwordObject

Returns the value of attribute prevent_change_account_password.



64
65
66
# File 'lib/comet/models/user_policy.rb', line 64

def 
  @prevent_change_account_password
end

#prevent_change_email_settingsObject

Returns the value of attribute prevent_change_email_settings.



67
68
69
# File 'lib/comet/models/user_policy.rb', line 67

def prevent_change_email_settings
  @prevent_change_email_settings
end

#prevent_delete_protected_itemObject

Returns the value of attribute prevent_delete_protected_item.



40
41
42
# File 'lib/comet/models/user_policy.rb', line 40

def prevent_delete_protected_item
  @prevent_delete_protected_item
end

#prevent_delete_single_snapshotsObject

Returns the value of attribute prevent_delete_single_snapshots.



61
62
63
# File 'lib/comet/models/user_policy.rb', line 61

def prevent_delete_single_snapshots
  @prevent_delete_single_snapshots
end

#prevent_delete_storage_vaultObject

Returns the value of attribute prevent_delete_storage_vault.



28
29
30
# File 'lib/comet/models/user_policy.rb', line 28

def prevent_delete_storage_vault
  @prevent_delete_storage_vault
end

#prevent_edit_protected_itemObject

Returns the value of attribute prevent_edit_protected_item.



37
38
39
# File 'lib/comet/models/user_policy.rb', line 37

def prevent_edit_protected_item
  @prevent_edit_protected_item
end

#prevent_edit_storage_vaultObject

Returns the value of attribute prevent_edit_storage_vault.



22
23
24
# File 'lib/comet/models/user_policy.rb', line 22

def prevent_edit_storage_vault
  @prevent_edit_storage_vault
end

#prevent_new_protected_itemObject

Returns the value of attribute prevent_new_protected_item.



34
35
36
# File 'lib/comet/models/user_policy.rb', line 34

def prevent_new_protected_item
  @prevent_new_protected_item
end

#prevent_open_app_uiObject

Returns the value of attribute prevent_open_app_ui.



73
74
75
# File 'lib/comet/models/user_policy.rb', line 73

def prevent_open_app_ui
  @prevent_open_app_ui
end

#prevent_open_web_uiObject

Returns the value of attribute prevent_open_web_ui.



85
86
87
# File 'lib/comet/models/user_policy.rb', line 85

def prevent_open_web_ui
  @prevent_open_web_ui
end

#prevent_protected_item_retentionObject

Returns the value of attribute prevent_protected_item_retention.



100
101
102
# File 'lib/comet/models/user_policy.rb', line 100

def prevent_protected_item_retention
  @prevent_protected_item_retention
end

#prevent_request_storage_vaultObject

Returns the value of attribute prevent_request_storage_vault.



16
17
18
# File 'lib/comet/models/user_policy.rb', line 16

def prevent_request_storage_vault
  @prevent_request_storage_vault
end

#prevent_view_device_namesObject

Returns the value of attribute prevent_view_device_names.



88
89
90
# File 'lib/comet/models/user_policy.rb', line 88

def prevent_view_device_names
  @prevent_view_device_names
end

#protected_item_engine_typesObject

Returns the value of attribute protected_item_engine_types.



43
44
45
# File 'lib/comet/models/user_policy.rb', line 43

def protected_item_engine_types
  @protected_item_engine_types
end

#random_delay_secsObject

Returns the value of attribute random_delay_secs.



118
119
120
# File 'lib/comet/models/user_policy.rb', line 118

def random_delay_secs
  @random_delay_secs
end

#require_password_open_app_uiObject

Returns the value of attribute require_password_open_app_ui.



76
77
78
# File 'lib/comet/models/user_policy.rb', line 76

def require_password_open_app_ui
  @require_password_open_app_ui
end

#storage_vault_providersObject

Returns the value of attribute storage_vault_providers.



31
32
33
# File 'lib/comet/models/user_policy.rb', line 31

def storage_vault_providers
  @storage_vault_providers
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



121
122
123
# File 'lib/comet/models/user_policy.rb', line 121

def unknown_json_fields
  @unknown_json_fields
end

Instance Method Details

#clearObject



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/comet/models/user_policy.rb', line 127

def clear
  @storage_vault_providers = Comet::StorageVaultProviderPolicy.new
  @protected_item_engine_types = Comet::ProtectedItemEngineTypePolicy.new
  @file_and_folder_mandatory_exclusions = []
  @mode_schedule_skip_already_running = 0
  @mode_admin_reset_password = 0
  @mode_admin_view_filenames = 0
  @mode_require_user_reset_password = 0
  @default_email_reports = Comet::DefaultEmailReportPolicy.new
  @default_storage_vault_retention = Comet::RetentionPolicy.new
  @default_sources = {}
  @default_sources_backup_rules = {}
  @default_sources_with_osrestriction = {}
  @default_backup_rules = {}
  @random_delay_secs = 0
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


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
279
280
281
282
283
284
285
286
# File 'lib/comet/models/user_policy.rb', line 153

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 'PreventRequestStorageVault'
      @prevent_request_storage_vault = v
    when 'PreventAddCustomStorageVault'
      @prevent_add_custom_storage_vault = v
    when 'PreventEditStorageVault'
      @prevent_edit_storage_vault = v
    when 'HideCloudStorageBranding'
      @hide_cloud_storage_branding = v
    when 'PreventDeleteStorageVault'
      @prevent_delete_storage_vault = v
    when 'StorageVaultProviders'
      @storage_vault_providers = Comet::StorageVaultProviderPolicy.new
      @storage_vault_providers.from_hash(v)
    when 'PreventNewProtectedItem'
      @prevent_new_protected_item = v
    when 'PreventEditProtectedItem'
      @prevent_edit_protected_item = v
    when 'PreventDeleteProtectedItem'
      @prevent_delete_protected_item = v
    when 'ProtectedItemEngineTypes'
      @protected_item_engine_types = Comet::ProtectedItemEngineTypePolicy.new
      @protected_item_engine_types.from_hash(v)
    when 'FileAndFolderMandatoryExclusions'
      if v.nil?
        @file_and_folder_mandatory_exclusions = []
      else
        @file_and_folder_mandatory_exclusions = Array.new(v.length)
        v.each_with_index do |v1, i1|
          @file_and_folder_mandatory_exclusions[i1] = Comet::ExtraFileExclusion.new
          @file_and_folder_mandatory_exclusions[i1].from_hash(v1)
        end
      end
    when 'ModeScheduleSkipAlreadyRunning'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @mode_schedule_skip_already_running = v
    when 'ModeAdminResetPassword'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @mode_admin_reset_password = v
    when 'ModeAdminViewFilenames'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @mode_admin_view_filenames = v
    when 'ModeRequireUserResetPassword'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @mode_require_user_reset_password = v
    when 'PreventDeleteSingleSnapshots'
      @prevent_delete_single_snapshots = v
    when 'PreventChangeAccountPassword'
      @prevent_change_account_password = v
    when 'PreventChangeEmailSettings'
      @prevent_change_email_settings = v
    when 'PreventChangeAccountName'
      @prevent_change_account_name = v
    when 'PreventOpenAppUI'
      @prevent_open_app_ui = v
    when 'RequirePasswordOpenAppUI'
      @require_password_open_app_ui = v
    when 'HideAppImport'
      @hide_app_import = v
    when 'HideAppVersion'
      @hide_app_version = v
    when 'PreventOpenWebUI'
      @prevent_open_web_ui = v
    when 'PreventViewDeviceNames'
      @prevent_view_device_names = v
    when 'DefaultEmailReports'
      @default_email_reports = Comet::DefaultEmailReportPolicy.new
      @default_email_reports.from_hash(v)
    when 'DefaultStorageVaultRetention'
      @default_storage_vault_retention = Comet::RetentionPolicy.new
      @default_storage_vault_retention.from_hash(v)
    when 'EnforceStorageVaultRetention'
      @enforce_storage_vault_retention = v
    when 'PreventProtectedItemRetention'
      @prevent_protected_item_retention = v
    when 'AllowEditObjectLockRetention'
      @allow_edit_object_lock_retention = v
    when 'DefaultSources'
      @default_sources = {}
      if v.nil?
        @default_sources = {}
      else
        v.each do |k1, v1|
          @default_sources[k1] = Comet::SourceConfig.new
          @default_sources[k1].from_hash(v1)
        end
      end
    when 'DefaultSourcesBackupRules'
      @default_sources_backup_rules = {}
      if v.nil?
        @default_sources_backup_rules = {}
      else
        v.each do |k1, v1|
          @default_sources_backup_rules[k1] = Comet::BackupRuleConfig.new
          @default_sources_backup_rules[k1].from_hash(v1)
        end
      end
    when 'DefaultSourcesWithOSRestriction'
      @default_sources_with_osrestriction = {}
      if v.nil?
        @default_sources_with_osrestriction = {}
      else
        v.each do |k1, v1|
          @default_sources_with_osrestriction[k1] = Comet::DefaultSourceWithOSRestriction.new
          @default_sources_with_osrestriction[k1].from_hash(v1)
        end
      end
    when 'DefaultBackupRules'
      @default_backup_rules = {}
      if v.nil?
        @default_backup_rules = {}
      else
        v.each do |k1, v1|
          @default_backup_rules[k1] = Comet::BackupRuleConfig.new
          @default_backup_rules[k1].from_hash(v1)
        end
      end
    when 'RandomDelaySecs'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @random_delay_secs = v
    else
      @unknown_json_fields[k] = v
    end
  end
end

#from_json(json_string) ⇒ Object

Parameters:

  • json_string (String)

    The complete object in JSON format

Raises:

  • (TypeError)


146
147
148
149
150
# File 'lib/comet/models/user_policy.rb', line 146

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_hHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



345
346
347
# File 'lib/comet/models/user_policy.rb', line 345

def to_h
  to_hash
end

#to_hashHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



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
# File 'lib/comet/models/user_policy.rb', line 289

def to_hash
  ret = {}
  ret['PreventRequestStorageVault'] = @prevent_request_storage_vault
  ret['PreventAddCustomStorageVault'] = @prevent_add_custom_storage_vault
  ret['PreventEditStorageVault'] = @prevent_edit_storage_vault
  ret['HideCloudStorageBranding'] = @hide_cloud_storage_branding
  ret['PreventDeleteStorageVault'] = @prevent_delete_storage_vault
  ret['StorageVaultProviders'] = @storage_vault_providers
  ret['PreventNewProtectedItem'] = @prevent_new_protected_item
  ret['PreventEditProtectedItem'] = @prevent_edit_protected_item
  ret['PreventDeleteProtectedItem'] = @prevent_delete_protected_item
  ret['ProtectedItemEngineTypes'] = @protected_item_engine_types
  unless @file_and_folder_mandatory_exclusions.nil?
    ret['FileAndFolderMandatoryExclusions'] = @file_and_folder_mandatory_exclusions
  end
  unless @mode_schedule_skip_already_running.nil?
    ret['ModeScheduleSkipAlreadyRunning'] = @mode_schedule_skip_already_running
  end
  unless @mode_admin_reset_password.nil?
    ret['ModeAdminResetPassword'] = @mode_admin_reset_password
  end
  unless @mode_admin_view_filenames.nil?
    ret['ModeAdminViewFilenames'] = @mode_admin_view_filenames
  end
  unless @mode_require_user_reset_password.nil?
    ret['ModeRequireUserResetPassword'] = @mode_require_user_reset_password
  end
  ret['PreventDeleteSingleSnapshots'] = @prevent_delete_single_snapshots
  ret['PreventChangeAccountPassword'] = @prevent_change_account_password
  ret['PreventChangeEmailSettings'] = @prevent_change_email_settings
  ret['PreventChangeAccountName'] = @prevent_change_account_name
  ret['PreventOpenAppUI'] = @prevent_open_app_ui
  ret['RequirePasswordOpenAppUI'] = @require_password_open_app_ui
  ret['HideAppImport'] = @hide_app_import
  ret['HideAppVersion'] = @hide_app_version
  ret['PreventOpenWebUI'] = @prevent_open_web_ui
  ret['PreventViewDeviceNames'] = @prevent_view_device_names
  ret['DefaultEmailReports'] = @default_email_reports
  ret['DefaultStorageVaultRetention'] = @default_storage_vault_retention
  ret['EnforceStorageVaultRetention'] = @enforce_storage_vault_retention
  ret['PreventProtectedItemRetention'] = @prevent_protected_item_retention
  ret['AllowEditObjectLockRetention'] = @allow_edit_object_lock_retention
  ret['DefaultSources'] = @default_sources
  ret['DefaultSourcesBackupRules'] = @default_sources_backup_rules
  ret['DefaultSourcesWithOSRestriction'] = @default_sources_with_osrestriction
  ret['DefaultBackupRules'] = @default_backup_rules
  unless @random_delay_secs.nil?
    ret['RandomDelaySecs'] = @random_delay_secs
  end
  @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.

Returns:

  • (String)

    The complete object as a JSON string



350
351
352
# File 'lib/comet/models/user_policy.rb', line 350

def to_json(options = {})
  to_hash.to_json(options)
end