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 31

#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 36

#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 42

#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 47

#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 52

#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 58

#updated_atDateTime

The last time this tag was updated.

Returns:

  • (DateTime)


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

Instance Method Details

#destroy_if_orphanedvoid

This method returns an undefined value.

Destroy this tag if it has no #hosts_tags



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

def destroy_if_orphaned
  self.class.transaction do
    if hosts_tags.empty?
      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)


109
110
111
# File 'app/models/mdm/tag.rb', line 109

def to_s
  name
end