dradis-plugins 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27463a50ab791e6e6e647c44c07d6db13b64dc884aaf0908c9ed4a373eac1ca9
4
- data.tar.gz: 9fb60f1832800289ad84b195cd21be24fbf9c912221e2468f5a63ebcec773d00
3
+ metadata.gz: ac76cb676d1435a70bffb933f994cab055b305bc82f6b299d3f733123894ca47
4
+ data.tar.gz: 8488275c5d2f4bc919f99e8977db110c48553b8f5174686d541348f4fa60ef69
5
5
  SHA512:
6
- metadata.gz: 9aa312de4c83dd08a7286b50ede29b0ef0d790ce34e67198cb5fa8c408d53e8408d9ff3734c93a561a40160a28c9c31193111dfc97e3f359188716d476448697
7
- data.tar.gz: 7da6e8ca0b7f4c0a7bb3a22ef5b7ef0c2f716981a81c0181f2835549e55328551426daea75a94ddf402d5e41f1e9a215fdd270bb9a62d6a61c37004eed945e0a
6
+ metadata.gz: de2e3063402c9cdb4f586281058c69f765a8de7698cf09ce4c20cdab82adce32bd7f3c9caa6e0955ae2084020e4c5693476412d3c6c6e20c4850795bf7673fbc
7
+ data.tar.gz: d4a1d1a9906e92d9f5113dc3b7f8549a4a1a5d298643fc827cb2cabb45cdb375c64ca29545da79c054ccd8e69c3544063c8e9ab5d316cbc20eb8a5ff995559ad
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ v5.3.0 (August 2026)
2
+ - Add shared report template source resolution for mappings across ticketing integrations (Jira, DevOps, ServiceNow)
3
+
1
4
  v5.2.0 (June 2026)
2
5
  - No changes
3
6
 
@@ -0,0 +1,43 @@
1
+ module Dradis
2
+ module Plugins
3
+ module Mappings
4
+ module Ticketing
5
+ # Shared by ticketing integrations' MappingsControllers (e.g. Jira,
6
+ # VSTS, ServiceNow) to list Dradis Report Templates as mapping
7
+ # sources. Distinct from Dradis::Plugins::Mappings::Base, which
8
+ # handles the opposite direction (mapping inbound upload data into
9
+ # Dradis fields).
10
+ module FieldsAndSources
11
+ extend ActiveSupport::Concern
12
+
13
+ def set_rtp_fields_and_sources
14
+ set_rtp_fields
15
+ set_sources
16
+ end
17
+
18
+ def set_rtp_fields
19
+ @rtp_fields = ReportTemplateProperties.all.filter_map do |rtp|
20
+ next if rtp.issue_fields.count == 0
21
+ [rtp.id, rtp.issue_fields.map(&:name)]
22
+ end.to_h
23
+ end
24
+
25
+ def set_sources
26
+ @sources = ReportTemplateProperties.all.group_by(&:plugin_name).map do |plugin_name, rtps|
27
+ mapped_rtps = rtps.map do |rtp|
28
+ suffix = ''
29
+ options = {}
30
+ if rtp.issue_fields.count == 0
31
+ suffix = ' (no issue fields)'
32
+ options = { disabled: 'disabled' }
33
+ end
34
+ [rtp.title + suffix, rtp.id, options]
35
+ end
36
+ [plugin_name.titleize, mapped_rtps]
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -7,9 +7,9 @@ module Dradis
7
7
 
8
8
  module VERSION
9
9
  MAJOR = 5
10
- MINOR = 2
10
+ MINOR = 3
11
11
  TINY = 0
12
- PRE = nil
12
+ PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
15
15
  end
@@ -7,7 +7,6 @@ module Dradis
7
7
  @destination = destination
8
8
  @integration = integration
9
9
  @component = @integration.meta[:name].to_s
10
- @sample_dir = default_sample_dir
11
10
  end
12
11
 
13
12
  def apply_mapping(data:, source:, mapping_fields: nil)
@@ -31,21 +30,14 @@ module Dradis
31
30
  # This returns a sample of valid entry for the Mappings Manager
32
31
  def sample
33
32
  @sample ||= {}
34
- if valid_source?
35
- @sample[source] ||= begin
36
- sample_file = File.join(@sample_dir, "#{source}.sample")
37
- File.read(sample_file)
38
- end
39
- end
33
+ @sample[source] ||= integration.sample(source) if valid_source?
40
34
  end
41
35
 
42
36
  private
43
37
 
44
- # This method returns the default location in which integrations store their sample files
45
- def default_sample_dir
46
- @default_sample_dir ||= begin
47
- File.join(Configuration.paths_templates_plugins, component)
48
- end
38
+ def source_fields
39
+ @source_fields ||= {}
40
+ @source_fields[source] ||= integration.source_fields(source)
49
41
  end
50
42
 
51
43
  def get_mapping_fields
@@ -61,7 +53,7 @@ module Dradis
61
53
  content.gsub(/{{\s?#{component}\[(\S*?)\]\s?}}/) do |field|
62
54
  name = field.split(/\[|\]/)[1]
63
55
 
64
- if integration.source_fields(source).include?(name)
56
+ if source_fields.include?(name)
65
57
  field_processor.value(field: name)
66
58
  else
67
59
  "Field [#{field}] not recognized by the integration"
@@ -70,7 +62,8 @@ module Dradis
70
62
  end
71
63
 
72
64
  def valid_source?
73
- @source = source if integration.mapping_sources.include?(source.to_sym)
65
+ valid_sources ||= integration.mapping_sources
66
+ @source = source if valid_sources.include?(source.to_sym)
74
67
  end
75
68
  end
76
69
  end
@@ -72,6 +72,17 @@ module Dradis::Plugins::Mappings::Base
72
72
  self::Mapping::SOURCE_FIELDS.keys
73
73
  end
74
74
 
75
+ # The sample content for a source, used by the Mappings Manager to
76
+ # preview an integration's mapping fields applied to real-looking data.
77
+ # Static-source integrations ship a real .sample file in the gem (see
78
+ # Dradis::Plugins::Templates::Samples, copied into place at boot);
79
+ # integrations whose sources aren't known ahead of time (e.g. csv) can
80
+ # override this instead.
81
+ def sample(source)
82
+ sample_file = File.join(Configuration.paths_templates_plugins, component, "#{source}.sample")
83
+ File.read(sample_file)
84
+ end
85
+
75
86
  def source_fields(source)
76
87
  if mapping_sources.include?(source.to_sym)
77
88
  self::Mapping::SOURCE_FIELDS[source.to_sym]
@@ -0,0 +1,30 @@
1
+ module Dradis
2
+ module Plugins
3
+ module Mappings
4
+ module Ticketing
5
+ # Shared by ticketing integrations' Mapping::Source classes (e.g.
6
+ # Jira, VSTS, ServiceNow) to identify a Report Template as a mapping
7
+ # source. Distinct from Dradis::Plugins::Mappings::Base, which
8
+ # handles the opposite direction (mapping inbound upload data into
9
+ # Dradis fields).
10
+ class Source
11
+ attr_reader :rtp_id, :source
12
+
13
+ def initialize(args)
14
+ if args[:source]
15
+ @source = args[:source]
16
+ @rtp_id = args[:source][/rtp_(\d+)/, 1]
17
+ elsif args[:rtp_id]
18
+ @rtp_id = args[:rtp_id]
19
+ @source = "rtp_#{args[:rtp_id]}"
20
+ end
21
+ end
22
+
23
+ def to_s
24
+ source
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -6,3 +6,4 @@ module Dradis
6
6
  end
7
7
 
8
8
  require 'dradis/plugins/mappings/base'
9
+ require 'dradis/plugins/mappings/ticketing/source'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Martin
@@ -82,6 +82,7 @@ files:
82
82
  - README.md
83
83
  - Rakefile
84
84
  - app/controllers/concerns/dradis/plugins/exportable.rb
85
+ - app/controllers/concerns/dradis/plugins/mappings/ticketing/fields_and_sources.rb
85
86
  - app/controllers/concerns/dradis/plugins/persistent_permissions.rb
86
87
  - app/controllers/dradis/plugins/export/base_controller.rb
87
88
  - dradis-plugins.gemspec
@@ -110,6 +111,7 @@ files:
110
111
  - lib/dradis/plugins/mapping_service.rb
111
112
  - lib/dradis/plugins/mappings.rb
112
113
  - lib/dradis/plugins/mappings/base.rb
114
+ - lib/dradis/plugins/mappings/ticketing/source.rb
113
115
  - lib/dradis/plugins/settings.rb
114
116
  - lib/dradis/plugins/settings/adapters/db.rb
115
117
  - lib/dradis/plugins/settings/adapters/encrypted_configuration.rb