Class: Nexpose::RoleSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/role.rb

Overview

Role summary object encapsulating information about a role.

Direct Known Subclasses

Role

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, full_name, id, description, enabled = true, scope = Scope::SILO) ⇒ RoleSummary

Returns a new instance of RoleSummary.



99
100
101
# File 'lib/nexpose/role.rb', line 99

def initialize(name, full_name, id, description, enabled = true, scope = Scope::SILO)
  @name, @full_name, @id, @description, @enabled, @scope = name, full_name, id.to_i, description, enabled, scope
end

Instance Attribute Details

#descriptionObject

A description of the role.



90
91
92
# File 'lib/nexpose/role.rb', line 90

def description
  @description
end

#enabledObject

Whether or not the role is enabled.



93
94
95
# File 'lib/nexpose/role.rb', line 93

def enabled
  @enabled
end

#full_nameObject

The full name of the role. Must be unique.



84
85
86
# File 'lib/nexpose/role.rb', line 84

def full_name
  @full_name
end

#idObject

The unique identifier of the role.



87
88
89
# File 'lib/nexpose/role.rb', line 87

def id
  @id
end

#nameObject

The short name of the role. Must be unique.



81
82
83
# File 'lib/nexpose/role.rb', line 81

def name
  @name
end

#scopeObject

Specifies if the role has global or silo scope.

See Also:



97
98
99
# File 'lib/nexpose/role.rb', line 97

def scope
  @scope
end

Class Method Details

.parse(xml) ⇒ Object



103
104
105
106
107
108
109
110
# File 'lib/nexpose/role.rb', line 103

def self.parse(xml)
  new(xml.attributes['name'],
      xml.attributes['full-name'],
      xml.attributes['id'].to_i,
      xml.attributes['description'],
      xml.attributes['enabled'] == 'true',
      xml.attributes['scope'])
end