Class: MistApi::PrivilegeOrg
- Defined in:
- lib/mist_api/models/privilege_org.rb
Overview
Privileges settings
Instance Attribute Summary collapse
-
#org_id ⇒ UUID | String
If ‘scope`==`org`.
-
#role ⇒ PrivilegeOrgRoleEnum
access permissions.
-
#scope ⇒ PrivilegeOrgScopeEnum
enum: ‘org`, `site`, `sitegroup`, `orgsites`.
-
#site_id ⇒ UUID | String
If ‘scope`==`site`.
-
#sitegroup_id ⇒ UUID | String
If ‘scope`==`sitegroup`.
-
#view ⇒ String
Used for backward compatibility.
-
#views ⇒ Array[AdminPrivilegeViewEnum]
Custom roles restrict Org users to specific UI views.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(role = nil, scope = nil, org_id = SKIP, site_id = SKIP, sitegroup_id = SKIP, view = SKIP, views = SKIP) ⇒ PrivilegeOrg
constructor
A new instance of PrivilegeOrg.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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_id ⇒ UUID | String
If ‘scope`==`org`
14 15 16 |
# File 'lib/mist_api/models/privilege_org.rb', line 14 def org_id @org_id end |
#role ⇒ PrivilegeOrgRoleEnum
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 |
#scope ⇒ PrivilegeOrgScopeEnum
enum: ‘org`, `site`, `sitegroup`, `orgsites`
23 24 25 |
# File 'lib/mist_api/models/privilege_org.rb', line 23 def scope @scope end |
#site_id ⇒ UUID | String
If ‘scope`==`site`
27 28 29 |
# File 'lib/mist_api/models/privilege_org.rb', line 27 def site_id @site_id end |
#sitegroup_id ⇒ UUID | String
If ‘scope`==`sitegroup`
31 32 33 |
# File 'lib/mist_api/models/privilege_org.rb', line 31 def sitegroup_id @sitegroup_id end |
#view ⇒ String
Used for backward compatibility. Use ‘views` instead.
35 36 37 |
# File 'lib/mist_api/models/privilege_org.rb', line 35 def view @view end |
#views ⇒ Array[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
|
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
88 89 90 |
# File 'lib/mist_api/models/privilege_org.rb', line 88 def self.nullables [] end |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |