Mercurial > farol
changeset 94:1ca989387aeb
Add deletion of CVSS
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 16:22:41 +0200 |
parents | 8e72f31d7392 |
children | 0b64dc3f50eb |
files | farol/templates/vulnerability/view_cvss.j2 farol/vulnerability.py |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ </ul> {% endcall %} {% endif %} +<div class="pull-right">{{ delete_button(url_for('.del_cvss', ordinal=ordinal, index=index)) }}</div> {% endblock %}
--- 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('/<int:ordinal>/cvss/<int:index>/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('/<int:ordinal>/cvss/<int:index>/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('/<int:ordinal>/remediation/<int:index>') @document_required