# HG changeset patch # User BenoƮt Allard # Date 1412864065 -7200 # Node ID 8e72f31d739237eb10b6d011b81c586bcd788725 # Parent 33d6fd9a5e123614171b572df1f2a6c857f407be Add deletion of Threats diff -r 33d6fd9a5e12 -r 8e72f31d7392 farol/templates/vulnerability/view_threat.j2 --- a/farol/templates/vulnerability/view_threat.j2 Thu Oct 09 16:08:45 2014 +0200 +++ b/farol/templates/vulnerability/view_threat.j2 Thu Oct 09 16:14:25 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import panel, label_value %} +{% from "macros.j2" import panel, label_value, delete_button %} {% block title %}Edit {{ threat.getTitle() }}{% endblock %} {% block i_content %} @@ -56,4 +56,5 @@ {% endcall %} {% endif %} +
{{ delete_button(url_for('.del_threat', ordinal=ordinal, index=index)) }}
{% endblock %} diff -r 33d6fd9a5e12 -r 8e72f31d7392 farol/vulnerability.py --- a/farol/vulnerability.py Thu Oct 09 16:08:45 2014 +0200 +++ b/farol/vulnerability.py Thu Oct 09 16:14:25 2014 +0200 @@ -337,6 +337,17 @@ threat.addGroupID(groupid) return redirect(url_for('.view', ordinal=ordinal)) +@vulnerability.route('//threat//del', methods=['POST']) +@document_required +def del_threat(ordinal, index): + threats = get_vuln(ordinal)._threats + if not (0 <= index < len(threats)): + flash('Threat not found', 'danger') + abort(404) + + del threats[index] + return redirect(url_for('.view', ordinal=ordinal)) + @vulnerability.route('//cvss/') @document_required