Class: Dradis::Plugins::Calculators::CVSS::IssuesController

Inherits:
IssuesController
  • Object
show all
Defined in:
app/controllers/dradis/plugins/calculators/cvss/issues_controller.rb

Overview

Does it matter that we’re inheriting from the no-frills controller?

Instance Method Summary collapse

Instance Method Details

#editObject



10
# File 'app/controllers/dradis/plugins/calculators/cvss/issues_controller.rb', line 10

def edit; end

#updateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/dradis/plugins/calculators/cvss/issues_controller.rb', line 12

def update
  cvss_fields = Hash[*params[:cvss_fields].scan(FieldParser::FIELDS_REGEX).flatten.map(&:strip)]
  cvss_fields.each do |name, value|
    @issue.set_field(name, value)
  end

  existing_v4_fields = @issue.fields.keys & V4::FIELDS
  (existing_v4_fields - cvss_fields.keys).each do |name|
    @issue.delete_field(name)
  end

  if @issue.save
    redirect_to main_app.project_issue_path(current_project, @issue), notice: 'CVSS fields updated.'
  else
    render :edit
  end
end