Class: Dradis::Plugins::Projects::Upload::V1::Template::Importer

Inherits:
Template::Importer
  • Object
show all
Defined in:
lib/dradis/plugins/projects/upload/v1/template.rb

Constant Summary collapse

ATTACHMENT_URL =
%r{^!(/[a-z]+)?/(?:projects/\d+/)?nodes/(\d+)/attachments/(.+)!$}

Instance Attribute Summary collapse

Attributes inherited from Template::Importer

#lookup_table, #template_version

Instance Method Summary collapse

Methods inherited from Template::Importer

#import, #parse, templates

Instance Attribute Details

#attachment_notesObject

Returns the value of attribute attachment_notes.



14
15
16
# File 'lib/dradis/plugins/projects/upload/v1/template.rb', line 14

def attachment_notes
  @attachment_notes
end

#loggerObject

Returns the value of attribute logger.



14
15
16
# File 'lib/dradis/plugins/projects/upload/v1/template.rb', line 14

def logger
  @logger
end

#pending_changesObject

Returns the value of attribute pending_changes.



14
15
16
# File 'lib/dradis/plugins/projects/upload/v1/template.rb', line 14

def pending_changes
  @pending_changes
end

#users=(value) ⇒ Object

Sets the attribute users

Parameters:

  • value

    the value to set the attribute users to.



14
15
16
# File 'lib/dradis/plugins/projects/upload/v1/template.rb', line 14

def users=(value)
  @users = value
end

Instance Method Details

#post_initialize(args = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dradis/plugins/projects/upload/v1/template.rb', line 18

def post_initialize(args={})
  @lookup_table = {
    categories: {},
    nodes: {},
    issues: {}
  }

  @pending_changes = {
    # If the note has an attachment screenshot (i.e. !.../nodes/i/attachments/...!)
    # we will fix the URL to point to the new Node ID.
    #
    # WARNING: we need a lookup table because one note may be referencing a
    # different (yet unprocessed) node's attachments.
    attachment_notes: [],

    # evidence is parsed when nodes are parsed, but cannot be saved until
    # issues have been created. Therefore, parse evidence into arrays until
    # time for creation
    evidence: [],

    # likewise we also need to hold on to the XML about evidence activities
    # and comments until after the evidence has been saved
    evidence_activity: [],
    evidence_comments: [],

    # all children nodes, we will need to find the ID of their new parents.
    orphan_nodes: []
  }
end