Class: Comet::AdminUserPermissions

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAdminUserPermissions

Returns a new instance of AdminUserPermissions.



77
78
79
# File 'lib/comet/models/admin_user_permissions.rb', line 77

def initialize
  clear
end

Instance Attribute Details

#allow_edit_brandingObject

Returns the value of attribute allow_edit_branding.



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

def allow_edit_branding
  @allow_edit_branding
end

#allow_edit_email_optionsObject

Returns the value of attribute allow_edit_email_options.



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

def allow_edit_email_options
  @allow_edit_email_options
end

#allow_edit_external_auth_sourcesObject

Returns the value of attribute allow_edit_external_auth_sources.



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

def allow_edit_external_auth_sources
  @allow_edit_external_auth_sources
end

#allow_edit_remote_storageObject

Returns the value of attribute allow_edit_remote_storage.



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

def allow_edit_remote_storage
  @allow_edit_remote_storage
end

#allow_edit_webhooksObject

Returns the value of attribute allow_edit_webhooks.



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

def allow_edit_webhooks
  @allow_edit_webhooks
end

#allowed_providers_when_restrictedObject

This field is available in Comet 23.6.0 and later.



68
69
70
# File 'lib/comet/models/admin_user_permissions.rb', line 68

def allowed_providers_when_restricted
  @allowed_providers_when_restricted
end

#allowed_user_policiesObject

This field is available in Comet 23.9.11 and later.



72
73
74
# File 'lib/comet/models/admin_user_permissions.rb', line 72

def allowed_user_policies
  @allowed_user_policies
end

#deny_constellation_roleObject

Returns the value of attribute deny_constellation_role.



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

def deny_constellation_role
  @deny_constellation_role
end

#deny_view_server_historyObject

This field is available in Comet 23.6.0 and later.



44
45
46
# File 'lib/comet/models/admin_user_permissions.rb', line 44

def deny_view_server_history
  @deny_view_server_history
end

#deny_view_server_infoObject

This field is available in Comet 23.6.0 and later.



48
49
50
# File 'lib/comet/models/admin_user_permissions.rb', line 48

def deny_view_server_info
  @deny_view_server_info
end

#hide_cloud_storage_brandingObject

This field is available in Comet 23.6.0 and later.



60
61
62
# File 'lib/comet/models/admin_user_permissions.rb', line 60

def hide_cloud_storage_branding
  @hide_cloud_storage_branding
end

#prevent_add_custom_storage_vaultObject

This field is available in Comet 23.6.0 and later.



56
57
58
# File 'lib/comet/models/admin_user_permissions.rb', line 56

def prevent_add_custom_storage_vault
  @prevent_add_custom_storage_vault
end

#prevent_change_passwordObject

Returns the value of attribute prevent_change_password.



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

def prevent_change_password
  @prevent_change_password
end

#prevent_edit_server_settingsObject

Returns the value of attribute prevent_edit_server_settings.



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

def prevent_edit_server_settings
  @prevent_edit_server_settings
end

#prevent_request_storage_vaultObject

This field is available in Comet 23.6.0 and later.



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

def prevent_request_storage_vault
  @prevent_request_storage_vault
end

#prevent_server_shutdownObject

Returns the value of attribute prevent_server_shutdown.



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

def prevent_server_shutdown
  @prevent_server_shutdown
end

#should_restrict_provider_listObject

This field is available in Comet 23.6.0 and later.



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

def should_restrict_provider_list
  @should_restrict_provider_list
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



75
76
77
# File 'lib/comet/models/admin_user_permissions.rb', line 75

def unknown_json_fields
  @unknown_json_fields
end

Instance Method Details

#clearObject



81
82
83
84
85
# File 'lib/comet/models/admin_user_permissions.rb', line 81

def clear
  @allowed_providers_when_restricted = []
  @allowed_user_policies = []
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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
# File 'lib/comet/models/admin_user_permissions.rb', line 95

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 'PreventEditServerSettings'
      @prevent_edit_server_settings = v
    when 'PreventServerShutdown'
      @prevent_server_shutdown = v
    when 'PreventChangePassword'
      @prevent_change_password = v
    when 'AllowEditBranding'
      @allow_edit_branding = v
    when 'AllowEditEmailOptions'
      @allow_edit_email_options = v
    when 'AllowEditRemoteStorage'
      @allow_edit_remote_storage = v
    when 'AllowEditWebhooks'
      @allow_edit_webhooks = v
    when 'AllowEditExternalAuthSources'
      @allow_edit_external_auth_sources = v
    when 'DenyConstellationRole'
      @deny_constellation_role = v
    when 'DenyViewServerHistory'
      @deny_view_server_history = v
    when 'DenyViewServerInfo'
      @deny_view_server_info = v
    when 'PreventRequestStorageVault'
      @prevent_request_storage_vault = v
    when 'PreventAddCustomStorageVault'
      @prevent_add_custom_storage_vault = v
    when 'HideCloudStorageBranding'
      @hide_cloud_storage_branding = v
    when 'ShouldRestrictProviderList'
      @should_restrict_provider_list = v
    when 'AllowedProvidersWhenRestricted'
      if v.nil?
        @allowed_providers_when_restricted = []
      else
        @allowed_providers_when_restricted = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected Numeric, got #{v1.class}" unless v1.is_a? Numeric

          @allowed_providers_when_restricted[i1] = v1
        end
      end
    when 'AllowedUserPolicies'
      if v.nil?
        @allowed_user_policies = []
      else
        @allowed_user_policies = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String

          @allowed_user_policies[i1] = v1
        end
      end
    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)


88
89
90
91
92
# File 'lib/comet/models/admin_user_permissions.rb', line 88

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



219
220
221
# File 'lib/comet/models/admin_user_permissions.rb', line 219

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



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

def to_hash
  ret = {}
  unless @prevent_edit_server_settings.nil?
    ret['PreventEditServerSettings'] = @prevent_edit_server_settings
  end
  unless @prevent_server_shutdown.nil?
    ret['PreventServerShutdown'] = @prevent_server_shutdown
  end
  unless @prevent_change_password.nil?
    ret['PreventChangePassword'] = @prevent_change_password
  end
  unless @allow_edit_branding.nil?
    ret['AllowEditBranding'] = @allow_edit_branding
  end
  unless @allow_edit_email_options.nil?
    ret['AllowEditEmailOptions'] = @allow_edit_email_options
  end
  unless @allow_edit_remote_storage.nil?
    ret['AllowEditRemoteStorage'] = @allow_edit_remote_storage
  end
  unless @allow_edit_webhooks.nil?
    ret['AllowEditWebhooks'] = @allow_edit_webhooks
  end
  unless @allow_edit_external_auth_sources.nil?
    ret['AllowEditExternalAuthSources'] = @allow_edit_external_auth_sources
  end
  unless @deny_constellation_role.nil?
    ret['DenyConstellationRole'] = @deny_constellation_role
  end
  unless @deny_view_server_history.nil?
    ret['DenyViewServerHistory'] = @deny_view_server_history
  end
  unless @deny_view_server_info.nil?
    ret['DenyViewServerInfo'] = @deny_view_server_info
  end
  unless @prevent_request_storage_vault.nil?
    ret['PreventRequestStorageVault'] = @prevent_request_storage_vault
  end
  unless @prevent_add_custom_storage_vault.nil?
    ret['PreventAddCustomStorageVault'] = @prevent_add_custom_storage_vault
  end
  unless @hide_cloud_storage_branding.nil?
    ret['HideCloudStorageBranding'] = @hide_cloud_storage_branding
  end
  unless @should_restrict_provider_list.nil?
    ret['ShouldRestrictProviderList'] = @should_restrict_provider_list
  end
  unless @allowed_providers_when_restricted.nil?
    ret['AllowedProvidersWhenRestricted'] = @allowed_providers_when_restricted
  end
  unless @allowed_user_policies.nil?
    ret['AllowedUserPolicies'] = @allowed_user_policies
  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



224
225
226
# File 'lib/comet/models/admin_user_permissions.rb', line 224

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