# HG changeset patch # User BenoƮt Allard # Date 1412864561 -7200 # Node ID 1ca989387aeb848b3e870bd1c0ceab942a6a836d # Parent 8e72f31d739237eb10b6d011b81c586bcd788725 Add deletion of CVSS diff -r 8e72f31d7392 -r 1ca989387aeb farol/templates/vulnerability/view_cvss.j2 --- a/farol/templates/vulnerability/view_cvss.j2 Thu Oct 09 16:14:25 2014 +0200 +++ b/farol/templates/vulnerability/view_cvss.j2 Thu Oct 09 16:22:41 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import label_value %} +{% from "macros.j2" import label_value, delete_button %} {% block title %}CVSS: {{ cvss._basescore }}{% endblock %} {% block i_content %} @@ -47,4 +47,5 @@ {% endcall %} {% endif %} +
{{ delete_button(url_for('.del_cvss', ordinal=ordinal, index=index)) }}
{% endblock %} diff -r 8e72f31d7392 -r 1ca989387aeb farol/vulnerability.py --- a/farol/vulnerability.py Thu Oct 09 16:14:25 2014 +0200 +++ b/farol/vulnerability.py Thu Oct 09 16:22:41 2014 +0200 @@ -377,7 +377,6 @@ get_vuln(ordinal).addCVSSSet(cvss) return redirect(url_for('.view', ordinal=ordinal)) - @vulnerability.route('//cvss//edit', methods=['GET', 'POST']) @document_required def edit_cvss(ordinal, index): @@ -402,6 +401,17 @@ cvss.setVector(request.form['vector'] or None) return redirect(url_for('.view', ordinal=ordinal)) +@vulnerability.route('//cvss//del', methods=['POST']) +@document_required +def del_cvss(ordinal, index): + cvsss = get_vuln(ordinal)._cvsss + if not ( 0 <= index < len(cvsss)): + flash('CVSS not found', 'danger') + abort(404) + + del cvsss[index] + return redirect(url_for('.view', ordinal=ordinal)) + @vulnerability.route('//remediation/') @document_required