class Nessus6::Permission

The Permissions class is for interacting with Nessus6 user permissions. Permissions are used to provide access rights to a given object. localhost:8834/api#/resources/permissions

Public Class Methods

new(client) click to toggle source
# File lib/Nessus6/permission.rb, line 11
def initialize(client)
  @client = client
end

Public Instance Methods

change(object_type, object_id, permissions) click to toggle source

Changes the permissions for an object.

@param object_type [String] The type of object. @param object_id [String, Fixnum] The unique id of the object. @param permissions [String] An array of permission resources to apply

to the object.

@return [Hash]

# File lib/Nessus6/permission.rb, line 22
def change(object_type, object_id, permissions)
  response = @client.put("permissions/#{object_type}/#{object_id}",
                         body: permissions)
  verify response,
         forbidden: 'You do not have permission to edit the object',
         not_found: 'Object does not exist'
end
list(object_type, object_id) click to toggle source

Returns the current object's permissions.

@param object_type [String] The type of object. @param object_id [String, Fixnum] The unique id of the object. @return [Hash]

# File lib/Nessus6/permission.rb, line 35
def list(object_type, object_id)
  response = @client.get("permissions/#{object_type}/#{object_id}")
  verify response,
         forbidden: 'You do not have permission to view the object',
         not_found: 'Object does not exist'
end