Class: MistApi::PrivilegeMsp

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

Overview

Privileges 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, org_id = SKIP, org_name = SKIP, orggroup_id = SKIP, views = SKIP) ⇒ PrivilegeMsp

Returns a new instance of PrivilegeMsp.



86
87
88
89
90
91
92
93
94
# File 'lib/mist_api/models/privilege_msp.rb', line 86

def initialize(role = nil, scope = nil, org_id = SKIP, org_name = SKIP,
               orggroup_id = SKIP, views = SKIP)
  @org_id = org_id unless org_id == SKIP
  @org_name = org_name unless org_name == SKIP
  @orggroup_id = orggroup_id unless orggroup_id == SKIP
  @role = role
  @scope = scope
  @views = views unless views == SKIP
end

Instance Attribute Details

#org_idUUID | String

If ‘scope`==`org`

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#org_nameString

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

Returns:

  • (String)


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

def org_name
  @org_name
end

#orggroup_idUUID | String

If ‘scope`==`orggroup`

Returns:

  • (UUID | String)


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

def orggroup_id
  @orggroup_id
end

#rolePrivilegeMspRoleEnum

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



27
28
29
# File 'lib/mist_api/models/privilege_msp.rb', line 27

def role
  @role
end

#scopePrivilegeMspScopeEnum

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



31
32
33
# File 'lib/mist_api/models/privilege_msp.rb', line 31

def scope
  @scope
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:



57
58
59
# File 'lib/mist_api/models/privilege_msp.rb', line 57

def views
  @views
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  org_name = hash.key?('org_name') ? hash['org_name'] : SKIP
  orggroup_id = hash.key?('orggroup_id') ? hash['orggroup_id'] : SKIP
  views = hash.key?('views') ? hash['views'] : SKIP

  # Create object from extracted values.
  PrivilegeMsp.new(role,
                   scope,
                   org_id,
                   org_name,
                   orggroup_id,
                   views)
end

.namesObject

A mapping from model property names to API property names.



60
61
62
63
64
65
66
67
68
69
# File 'lib/mist_api/models/privilege_msp.rb', line 60

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['org_id'] = 'org_id'
  @_hash['org_name'] = 'org_name'
  @_hash['orggroup_id'] = 'orggroup_id'
  @_hash['role'] = 'role'
  @_hash['scope'] = 'scope'
  @_hash['views'] = 'views'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
# File 'lib/mist_api/models/privilege_msp.rb', line 82

def self.nullables
  []
end

.optionalsObject

An array for optional fields



72
73
74
75
76
77
78
79
# File 'lib/mist_api/models/privilege_msp.rb', line 72

def self.optionals
  %w[
    org_id
    org_name
    orggroup_id
    views
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



125
126
127
128
129
130
# File 'lib/mist_api/models/privilege_msp.rb', line 125

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} org_id: #{@org_id.inspect}, org_name: #{@org_name.inspect}, orggroup_id:"\
  " #{@orggroup_id.inspect}, role: #{@role.inspect}, scope: #{@scope.inspect}, views:"\
  " #{@views.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



118
119
120
121
122
# File 'lib/mist_api/models/privilege_msp.rb', line 118

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} org_id: #{@org_id}, org_name: #{@org_name}, orggroup_id: #{@orggroup_id},"\
  " role: #{@role}, scope: #{@scope}, views: #{@views}>"
end