Class: Dradis::Plugins::Calculators::DREAD::IssuesController
- Inherits:
-
IssuesController
- Object
- IssuesController
- Dradis::Plugins::Calculators::DREAD::IssuesController
- Defined in:
- app/controllers/dradis/plugins/calculators/dread/issues_controller.rb
Overview
Does it matter that we’re inheriting from the no-frills controller?
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
6 7 |
# File 'app/controllers/dradis/plugins/calculators/dread/issues_controller.rb', line 6 def edit end |
#set_dread_vector ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/dradis/plugins/calculators/dread/issues_controller.rb', line 22 def set_dread_vector # Undefined values default to 0 @dread_vector = Hash.new { |h, k| h[k] = 0 } field_value = @issue.fields['DREAD.Vector'] # If no vector is set yet, that's OK return if field_value.blank? if field_value =~ V1::VECTOR_REGEXP field_value.split('/').each do |pair| field, value = pair.split(':') @dread_vector[field] = value.to_i end else redirect_to main_app.project_issue_path(current_project, @issue), alert: 'The format of the DREAD Vector field is invalid.' end end |
#update ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/dradis/plugins/calculators/dread/issues_controller.rb', line 9 def update dread_fields = Hash[ *params[:dread_fields].scan(FieldParser::FIELDS_REGEX).flatten.map(&:strip) ] dread_fields.each do |name, value| @issue.set_field(name, value) end if @issue.save redirect_to main_app.project_issue_path(current_project, @issue), notice: 'DREAD fields updated.' else render :edit end end |