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

Inherits:
Template::Importer
  • Object
show all
Defined in:
lib/dradis/plugins/projects/upload/v4/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.



5
6
7
# File 'lib/dradis/plugins/projects/upload/v4/template.rb', line 5

def attachment_notes
  @attachment_notes
end

#loggerObject

Returns the value of attribute logger.



5
6
7
# File 'lib/dradis/plugins/projects/upload/v4/template.rb', line 5

def logger
  @logger
end

#pending_changesObject

Returns the value of attribute pending_changes.



5
6
7
# File 'lib/dradis/plugins/projects/upload/v4/template.rb', line 5

def pending_changes
  @pending_changes
end

#users=(value) ⇒ Object

Sets the attribute users

Parameters:

  • value

    the value to set the attribute users to.



5
6
7
# File 'lib/dradis/plugins/projects/upload/v4/template.rb', line 5

def users=(value)
  @users = value
end

Instance Method Details

#post_initialize(args = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dradis/plugins/projects/upload/v4/template.rb', line 9

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