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.



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

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.



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

def description
  @description
end

#enabledObject

Whether or not the role is enabled.



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

def enabled
  @enabled
end

#full_nameObject

The full name of the role. Must be unique.



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

def full_name
  @full_name
end

#idObject

The unique identifier of the role.



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

def id
  @id
end

#nameObject

The short name of the role. Must be unique.



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

def name
  @name
end

#scopeObject

Specifies if the role has global or silo scope.

See Also:



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

def scope
  @scope
end

Class Method Details

.parse(xml) ⇒ Object



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

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