dradis-projects 3.7.0 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25a395a59c0ca4e3b6f93229f6a26e0ba7c8e9c4
4
- data.tar.gz: f819ec97349717710edc060fb4cf4f88e7d3ee41
3
+ metadata.gz: c89adcdc78b9d1cb42caf85a3c5bdfac676f7537
4
+ data.tar.gz: 802d58668e34660d86f46b550e6544a3f62ed35f
5
5
  SHA512:
6
- metadata.gz: aa436c78584124948064ca23edf7f6130514391bf2e3bb9b1ee31dd06767bc10c6c4727121d110190da752d5c570f50c259634d43e5eec86fc46c44d8281da38
7
- data.tar.gz: a99db48a1e47d88ab6580c24388c221a93bc677b291b13a0136e9d4ae752f714b82a7ef4327753b6d1946fb05971114a148b7847891344b158f3309732feab26
6
+ metadata.gz: 8dda41635dd76a933bef1b412df282ced535f4f4f4fa31da0080da9337640cc23df02aa38174da8b2b70633faf7d9f67bbacfb50d793bf083a105c716ff68c5a
7
+ data.tar.gz: 63049c10e2b62045fa0bf6cd235f6c2ad8987c4c2898a37808e893f534e187a555104c7f4725c7c0a60a6960f1220335e17ae2a203bdbae2a8dac6d89678f2a6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Dradis Framework 3.8 (September, 2017) ##
2
+
3
+ * Add version attribute to exported methodologies
4
+
5
+ * Add parse_report_content placeholders to import/export.
6
+
1
7
  ## Dradis Framework 3.7 (July, 2017) ##
2
8
 
3
9
  * Skip closing the logger in thorfile
@@ -11,17 +11,19 @@ module Dradis::Plugins::Projects::Export
11
11
  build_methodologies(template_builder)
12
12
  build_categories(template_builder)
13
13
  build_tags(template_builder)
14
+ build_report_content(template_builder)
14
15
  end
15
16
  return result
16
17
  end
17
18
 
18
19
  private
19
- def build_categories(builder); raise NotImplementedError; end
20
- def build_issues(builder); raise NotImplementedError; end
21
- def build_methodologies(builder); raise NotImplementedError; end
22
- def build_nodes(builder); raise NotImplementedError; end
23
- def build_tags(builder); raise NotImplementedError; end
24
- def version; raise NotImplementedError; end
20
+ def build_categories(builder); raise NotImplementedError; end
21
+ def build_issues(builder); raise NotImplementedError; end
22
+ def build_methodologies(builder); raise NotImplementedError; end
23
+ def build_nodes(builder); raise NotImplementedError; end
24
+ def build_tags(builder); raise NotImplementedError; end
25
+ def build_report_content(builder); raise NotImplementedError; end
26
+ def version; raise NotImplementedError; end
25
27
  end
26
28
  end
27
29
 
@@ -70,7 +70,7 @@ module Dradis::Plugins::Projects::Export::V1
70
70
  methodologies = Node.methodology_library.notes
71
71
  builder.methodologies do |methodologies_builder|
72
72
  methodologies.each do |methodology|
73
- methodologies_builder.methodology do |methodology_builder|
73
+ methodologies_builder.methodology(version: VERSION) do |methodology_builder|
74
74
  methodology_builder.text do
75
75
  methodology_builder.cdata!(methodology.text)
76
76
  end
@@ -122,6 +122,8 @@ module Dradis::Plugins::Projects::Export::V1
122
122
  end
123
123
  end
124
124
 
125
+ def build_report_content(builder); end
126
+
125
127
  def build_tags(builder)
126
128
  tags = Tag.all
127
129
  builder.tags do |tags_builder|
@@ -8,7 +8,7 @@ module Dradis
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 3
11
- MINOR = 7
11
+ MINOR = 8
12
12
  TINY = 0
13
13
  PRE = nil
14
14
 
@@ -81,7 +81,7 @@ module Dradis::Plugins::Projects::Upload
81
81
  def parse_issues(template); raise NotImplementedError; end
82
82
  def parse_methodologies(template); raise NotImplementedError; end
83
83
  def parse_nodes(template); raise NotImplementedError; end
84
- def parse_report_content(template); raise NotImplementedError; end
84
+ def parse_report_content(template) raise NotImplementedError; end
85
85
  def parse_tags(template); raise NotImplementedError; end
86
86
  end
87
87
  end
@@ -214,27 +214,27 @@ module Dradis::Plugins::Projects::Upload::V1
214
214
 
215
215
  logger.info { "New node detected: #{label}, parent_id: #{parent_id}, type_id: #{type_id}" }
216
216
 
217
- # There is one exception to the rule, the Configuration.uploadsNode node,
218
- # it does not make sense to have more than one of this nodes, in any
219
- # given tree
220
- node = nil
221
- note = nil
222
- evidence = nil
223
- if (label == Configuration.plugin_uploads_node)
224
- node = Node.create_with(type_id: type_id, parent_id: parent_id).
225
- find_or_create_by!(label: label)
226
- else
227
- node = Node.create!(
228
- type_id: type_id,
229
- label: label,
230
- parent_id: parent_id,
231
- position: position
232
- )
233
- end
217
+ # There are exceptions to the rule, when it does not make sense to have
218
+ # more than one of this nodes, in any given tree:
219
+ # - the Configuration.uploadsNode node (detected by its label)
220
+ # - any nodes with type different from DEFAULT or HOST
221
+ node =
222
+ if label == Configuration.plugin_uploads_node
223
+ Node.create_with(type_id: type_id, parent_id: parent_id)
224
+ .find_or_create_by!(label: label)
225
+ elsif [Node::Types::DEFAULT, Node::Types::HOST].exclude?(type_id.to_i)
226
+ Node.create_with(label: label)
227
+ .find_or_create_by!(type_id: type_id)
228
+ else
229
+ Node.create!(
230
+ type_id: type_id,
231
+ label: label,
232
+ parent_id: parent_id,
233
+ position: position
234
+ )
235
+ end
234
236
 
235
- if properties
236
- node.raw_properties = properties
237
- end
237
+ node.raw_properties = properties if properties
238
238
 
239
239
  node.update_attribute(:created_at, created_at.text.strip) if created_at
240
240
  node.update_attribute(:updated_at, updated_at.text.strip) if updated_at
@@ -328,27 +328,7 @@ module Dradis::Plugins::Projects::Upload::V1
328
328
  end
329
329
  end
330
330
 
331
- def parse_report_content(template)
332
- logger.info { 'Processing Report Content...' }
333
-
334
- contentlib_type_id =
335
- template.at_xpath(
336
- "//nodes/node/type-id[text()='#{Node::Types::CONTENTLIB}']"
337
- )
338
-
339
- if contentlib_type_id
340
- content_library_xml = contentlib_type_id.parent
341
- document_properties =
342
- JSON.parse(content_library_xml.at_xpath('properties').text)
343
-
344
- content_library = Node.content_library
345
- content_library.properties =
346
- content_library.properties.merge(document_properties)
347
- content_library.save
348
- end
349
-
350
- logger.info { 'Done.' }
351
- end
331
+ def parse_report_content(template); end
352
332
 
353
333
  def parse_tags(template)
354
334
  logger.info { 'Processing Tags...' }
@@ -79,7 +79,12 @@ class UploadTasks < Thor
79
79
 
80
80
  detect_and_set_project_scope
81
81
 
82
- task_options.merge!(plugin: Dradis::Plugins::Projects::Upload::Template)
82
+ default_user_id = @project.owners.first.id
83
+
84
+ task_options.merge!({
85
+ plugin: Dradis::Plugins::Projects::Upload::Template,
86
+ default_user_id: default_user_id
87
+ })
83
88
 
84
89
  importer = Dradis::Plugins::Projects::Upload::Template::Importer.new(task_options)
85
90
  importer.import(file: file_path)
@@ -100,7 +105,12 @@ class UploadTasks < Thor
100
105
 
101
106
  detect_and_set_project_scope
102
107
 
103
- task_options.merge!(plugin: Dradis::Plugins::Projects::Upload::Package)
108
+ default_user_id = @project.owners.first.id
109
+
110
+ task_options.merge!({
111
+ plugin: Dradis::Plugins::Projects::Upload::Package,
112
+ default_user_id: default_user_id
113
+ })
104
114
 
105
115
  importer = Dradis::Plugins::Projects::Upload::Package::Importer.new(task_options)
106
116
  importer.import(file: file_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-projects
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-27 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler