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:

  • (DateTime)


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

#criticaltrue, false

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

Returns:

  • (true)

    this tag is critical.

  • (false)

    this tag is non-critical.



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

#descString

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

Returns:

  • (String)


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

#nameString

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

Returns:

  • (String)


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

#report_detailtrue, false

Whether to include this tag in a report details section.

Returns:

  • (true)

    include this tag in the report details section.

  • (false)

    do not include this tag in the report details section.



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

#report_summarytrue, false

Whether to include this tag in a report summary section.

Returns:

  • (true)

    include this tag in the report summary section.

  • (false)

    do not include this tag in the report summary section.



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

#updated_atDateTime

The last time this tag was updated.

Returns:

  • (DateTime)


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

Instance Method Details

#destroy_if_orphanedvoid

This method returns an undefined value.

Destroy this tag if it has no #hosts_tags



101
102
103
104
105
106
107
108
# File 'app/models/mdm/tag.rb', line 101

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:

  • (String)


111
112
113
# File 'app/models/mdm/tag.rb', line 111

def to_s
  name
end