Class: MistApi::PrivilegeOrg

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/privilege_org.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, site_id = SKIP, sitegroup_id = SKIP, view = SKIP, views = SKIP) ⇒ PrivilegeOrg

Returns a new instance of PrivilegeOrg.



92
93
94
95
96
97
98
99
100
101
# File 'lib/mist_api/models/privilege_org.rb', line 92

def initialize(role = nil, scope = nil, org_id = SKIP, site_id = SKIP,
               sitegroup_id = SKIP, view = SKIP, views = SKIP)
  @org_id = org_id unless org_id == SKIP
  @role = role
  @scope = scope
  @site_id = site_id unless site_id == SKIP
  @sitegroup_id = sitegroup_id unless sitegroup_id == SKIP
  @view = view unless view == SKIP
  @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_org.rb', line 14

def org_id
  @org_id
end

#rolePrivilegeOrgRoleEnum

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



19
20
21
# File 'lib/mist_api/models/privilege_org.rb', line 19

def role
  @role
end

#scopePrivilegeOrgScopeEnum

enum: ‘org`, `site`, `sitegroup`, `orgsites`



23
24
25
# File 'lib/mist_api/models/privilege_org.rb', line 23

def scope
  @scope
end

#site_idUUID | String

If ‘scope`==`site`

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#sitegroup_idUUID | String

If ‘scope`==`sitegroup`

Returns:

  • (UUID | String)


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

def sitegroup_id
  @sitegroup_id
end

#viewString

Used for backward compatibility. Use ‘views` instead.

Returns:

  • (String)


35
36
37
# File 'lib/mist_api/models/privilege_org.rb', line 35

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



61
62
63
# File 'lib/mist_api/models/privilege_org.rb', line 61

def views
  @views
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/mist_api/models/privilege_org.rb', line 104

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
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  sitegroup_id = hash.key?('sitegroup_id') ? hash['sitegroup_id'] : SKIP
  view = hash.key?('view') ? hash['view'] : SKIP
  views = hash.key?('views') ? hash['views'] : SKIP

  # Create object from extracted values.
  PrivilegeOrg.new(role,
                   scope,
                   org_id,
                   site_id,
                   sitegroup_id,
                   view,
                   views)
end

.namesObject

A mapping from model property names to API property names.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/mist_api/models/privilege_org.rb', line 64

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

.nullablesObject

An array for nullable fields



88
89
90
# File 'lib/mist_api/models/privilege_org.rb', line 88

def self.nullables
  []
end

.optionalsObject

An array for optional fields



77
78
79
80
81
82
83
84
85
# File 'lib/mist_api/models/privilege_org.rb', line 77

def self.optionals
  %w[
    org_id
    site_id
    sitegroup_id
    view
    views
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



134
135
136
137
138
139
# File 'lib/mist_api/models/privilege_org.rb', line 134

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

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
# File 'lib/mist_api/models/privilege_org.rb', line 127

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