Class: MistApi::AdminPrivilege

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/admin_privilege.rb

Overview

Privilieges settings

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(role = nil, scope = nil, msp_id = SKIP, msp_logo_url = SKIP, msp_name = SKIP, msp_url = SKIP, name = SKIP, org_id = SKIP, org_name = SKIP, orggroup_ids = SKIP, site_id = SKIP, sitegroup_ids = SKIP, views = SKIP) ⇒ AdminPrivilege

Returns a new instance of AdminPrivilege.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/mist_api/models/admin_privilege.rb', line 130

def initialize(role = nil, scope = nil, msp_id = SKIP, msp_logo_url = SKIP,
               msp_name = SKIP, msp_url = SKIP, name = SKIP, org_id = SKIP,
               org_name = SKIP, orggroup_ids = SKIP, site_id = SKIP,
               sitegroup_ids = SKIP, views = SKIP)
  @msp_id = msp_id unless msp_id == SKIP
  @msp_logo_url = msp_logo_url unless msp_logo_url == SKIP
  @msp_name = msp_name unless msp_name == SKIP
  @msp_url = msp_url unless msp_url == SKIP
  @name = name unless name == SKIP
  @org_id = org_id unless org_id == SKIP
  @org_name = org_name unless org_name == SKIP
  @orggroup_ids = orggroup_ids unless orggroup_ids == SKIP
  @role = role
  @scope = scope
  @site_id = site_id unless site_id == SKIP
  @sitegroup_ids = sitegroup_ids unless sitegroup_ids == SKIP
  @views = views unless views == SKIP
end

Instance Attribute Details

#msp_idUUID | String

Required if ‘scope`==`msp`

Returns:

  • (UUID | String)


14
15
16
# File 'lib/mist_api/models/admin_privilege.rb', line 14

def msp_id
  @msp_id
end

#msp_logo_urlString

Logo of the MSP (if the MSP belongs to an Advanced tier)

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/admin_privilege.rb', line 18

def msp_logo_url
  @msp_logo_url
end

#msp_nameString

Name of the MSP (if the org belongs to an MSP)

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/admin_privilege.rb', line 22

def msp_name
  @msp_name
end

#msp_urlString

Custom url of the MSP (if the MSP belongs to an Advanced tier)

Returns:

  • (String)


26
27
28
# File 'lib/mist_api/models/admin_privilege.rb', line 26

def msp_url
  @msp_url
end

#nameString

Name of the org/site/MSP depending on object scope

Returns:

  • (String)


30
31
32
# File 'lib/mist_api/models/admin_privilege.rb', line 30

def name
  @name
end

#org_idUUID | String

Required if ‘scope`==`org`

Returns:

  • (UUID | String)


34
35
36
# File 'lib/mist_api/models/admin_privilege.rb', line 34

def org_id
  @org_id
end

#org_nameString

Name of the org (for a site belonging to org)

Returns:

  • (String)


38
39
40
# File 'lib/mist_api/models/admin_privilege.rb', line 38

def org_name
  @org_name
end

#orggroup_idsArray[UUID | String]

If ‘scope`==`orggroup`

Returns:

  • (Array[UUID | String])


42
43
44
# File 'lib/mist_api/models/admin_privilege.rb', line 42

def orggroup_ids
  @orggroup_ids
end

#roleAdminPrivilegeRoleEnum

access permissions. enum: ‘admin`, `helpdesk`, `installer`, `read`, `write`



47
48
49
# File 'lib/mist_api/models/admin_privilege.rb', line 47

def role
  @role
end

#scopeAdminPrivilegeScopeEnum

enum: ‘msp`, `org`, `orggroup`, `site`, `sitegroup`



51
52
53
# File 'lib/mist_api/models/admin_privilege.rb', line 51

def scope
  @scope
end

#site_idUUID | String

Required if ‘scope`==`site`

Returns:

  • (UUID | String)


55
56
57
# File 'lib/mist_api/models/admin_privilege.rb', line 55

def site_id
  @site_id
end

#sitegroup_idsArray[UUID | String]

Required if ‘scope`==`site`

Returns:

  • (Array[UUID | String])


59
60
61
# File 'lib/mist_api/models/admin_privilege.rb', line 59

def sitegroup_ids
  @sitegroup_ids
end

#viewsArray[AdminPrivilegeViewEnum]

Custom roles restrict Org users to specific UI views. This is useful for limiting UI access of Org users. Custom roles restrict Org users to specific UI views. This is useful for limiting UI access of Org users.

You can define custom roles by adding the ‘views` attribute along with `role` when assigning privileges.

Below are the list of supported UI views. Note that this is UI only feature.

| UI View | Required Role | Description |
| --- | --- | --- |
| `reporting` | `read` | full access to all analytics tools |
| `marketing` | `read` | can view analytics and location maps |
| `super_observer` | `read` | can view all the organization except the

subscription page |

| `location` | `write` | can view and manage location maps, can view

analytics |

| `security` | `write` | can view and manage site labels, policies and

security |

| `switch_admin` | `helpdesk` | can view and manage Switch ports, can

view wired clients |

| `mxedge_admin` | `admin` | can view and manage Mist edges and Mist

tunnels |

| `lobby_admin` | `admin` | full access to Org and Site Pre-shared keys

|

Returns:



85
86
87
# File 'lib/mist_api/models/admin_privilege.rb', line 85

def views
  @views
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/mist_api/models/admin_privilege.rb', line 150

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  role = hash.key?('role') ? hash['role'] : nil
  scope = hash.key?('scope') ? hash['scope'] : nil
  msp_id = hash.key?('msp_id') ? hash['msp_id'] : SKIP
  msp_logo_url = hash.key?('msp_logo_url') ? hash['msp_logo_url'] : SKIP
  msp_name = hash.key?('msp_name') ? hash['msp_name'] : SKIP
  msp_url = hash.key?('msp_url') ? hash['msp_url'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  org_name = hash.key?('org_name') ? hash['org_name'] : SKIP
  orggroup_ids = hash.key?('orggroup_ids') ? hash['orggroup_ids'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  sitegroup_ids = hash.key?('sitegroup_ids') ? hash['sitegroup_ids'] : SKIP
  views = hash.key?('views') ? hash['views'] : SKIP

  # Create object from extracted values.
  AdminPrivilege.new(role,
                     scope,
                     msp_id,
                     msp_logo_url,
                     msp_name,
                     msp_url,
                     name,
                     org_id,
                     org_name,
                     orggroup_ids,
                     site_id,
                     sitegroup_ids,
                     views)
end

.namesObject

A mapping from model property names to API property names.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/mist_api/models/admin_privilege.rb', line 88

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['msp_id'] = 'msp_id'
  @_hash['msp_logo_url'] = 'msp_logo_url'
  @_hash['msp_name'] = 'msp_name'
  @_hash['msp_url'] = 'msp_url'
  @_hash['name'] = 'name'
  @_hash['org_id'] = 'org_id'
  @_hash['org_name'] = 'org_name'
  @_hash['orggroup_ids'] = 'orggroup_ids'
  @_hash['role'] = 'role'
  @_hash['scope'] = 'scope'
  @_hash['site_id'] = 'site_id'
  @_hash['sitegroup_ids'] = 'sitegroup_ids'
  @_hash['views'] = 'views'
  @_hash
end

.nullablesObject

An array for nullable fields



124
125
126
127
128
# File 'lib/mist_api/models/admin_privilege.rb', line 124

def self.nullables
  %w[
    msp_name
  ]
end

.optionalsObject

An array for optional fields



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/mist_api/models/admin_privilege.rb', line 107

def self.optionals
  %w[
    msp_id
    msp_logo_url
    msp_name
    msp_url
    name
    org_id
    org_name
    orggroup_ids
    site_id
    sitegroup_ids
    views
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



194
195
196
197
198
199
200
201
# File 'lib/mist_api/models/admin_privilege.rb', line 194

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} msp_id: #{@msp_id.inspect}, msp_logo_url: #{@msp_logo_url.inspect},"\
  " msp_name: #{@msp_name.inspect}, msp_url: #{@msp_url.inspect}, name: #{@name.inspect},"\
  " org_id: #{@org_id.inspect}, org_name: #{@org_name.inspect}, orggroup_ids:"\
  " #{@orggroup_ids.inspect}, role: #{@role.inspect}, scope: #{@scope.inspect}, site_id:"\
  " #{@site_id.inspect}, sitegroup_ids: #{@sitegroup_ids.inspect}, views: #{@views.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



185
186
187
188
189
190
191
# File 'lib/mist_api/models/admin_privilege.rb', line 185

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} msp_id: #{@msp_id}, msp_logo_url: #{@msp_logo_url}, msp_name: #{@msp_name},"\
  " msp_url: #{@msp_url}, name: #{@name}, org_id: #{@org_id}, org_name: #{@org_name},"\
  " orggroup_ids: #{@orggroup_ids}, role: #{@role}, scope: #{@scope}, site_id: #{@site_id},"\
  " sitegroup_ids: #{@sitegroup_ids}, views: #{@views}>"
end