Class: Mdm::Tag

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Metasploit::Model::Search
Defined in:
app/models/mdm/tag.rb

Overview

Tag assigned to #hosts. Tags can be used to group together hosts for targeting and reporting.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#created_atDateTime

When this tag was created by #user.

Returns:



# File 'app/models/mdm/tag.rb', line 38


#criticaltrue, false

Whether this tag represents a critical finding about the #hosts.

Returns:

  • this tag is critical.

  • this tag is non-critical.



# File 'app/models/mdm/tag.rb', line 43


#descString

Longer description of what this tag should be used for or means when applied to a host.

Returns:



# File 'app/models/mdm/tag.rb', line 49


#nameString

The name of the tag. The name is what a user actually enters to tag a host.

Returns:



# File 'app/models/mdm/tag.rb', line 54


#report_detailtrue, false

Whether to include this tag in a report details section.

Returns:

  • include this tag in the report details section.

  • do not include this tag in the report details section.



# File 'app/models/mdm/tag.rb', line 59


#report_summarytrue, false

Whether to include this tag in a report summary section.

Returns:

  • include this tag in the report summary section.

  • do not include this tag in the report summary section.



# File 'app/models/mdm/tag.rb', line 65


#updated_atDateTime

The last time this tag was updated.

Returns:



# File 'app/models/mdm/tag.rb', line 71


Instance Method Details

#destroy_if_orphanedvoid

This method returns an undefined value.

Destroy this tag if it has no #hosts_tags



107
108
109
110
111
112
113
114
# File 'app/models/mdm/tag.rb', line 107

def destroy_if_orphaned
  self.class.transaction do
    # call `.count` to avoid serialization of any Mdm::HostTag that may exist
    if hosts_tags.count == 0
      destroy
    end
  end
end

#to_sString

The name of the tag. The name is what a user actually enters to tag a host.

Returns:



117
118
119
# File 'app/models/mdm/tag.rb', line 117

def to_s
  name
end