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