changeset 97:4ec281e68821

Add deletion of Vulnerability's Acknowledgments
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 09 Oct 2014 16:37:06 +0200
parents 3848faa88cd5
children 9b525f33080a
files farol/templates/vulnerability/view_acknowledgment.j2 farol/vulnerability.py
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/farol/templates/vulnerability/view_acknowledgment.j2	Thu Oct 09 16:32:03 2014 +0200
+++ b/farol/templates/vulnerability/view_acknowledgment.j2	Thu Oct 09 16:37:06 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 %}{{ acknowledgment.getTitle() }}{% endblock %}
 
 {% block i_content %}
@@ -36,4 +36,5 @@
   {{ label_value('Description', acknowledgment._description or '') }}
   {{ label_value('URL', (acknowledgment._url or '') | urlize) }}
 </div>
+<div class="pull-right">{{ delete_button(url_for('.del_acknowledgment', ordinal=ordinal, index=index)) }}</div>
 {% endblock %}
--- a/farol/vulnerability.py	Thu Oct 09 16:32:03 2014 +0200
+++ b/farol/vulnerability.py	Thu Oct 09 16:37:06 2014 +0200
@@ -562,3 +562,14 @@
     ack = create_acknowledgment_from_request()
     get_vuln(ordinal).addAcknowledgment(ack)
     return redirect(url_for('.view', ordinal=ordinal))
+
+@vulnerability.route('/<int:ordinal>/acknowledgment/<int:index>/del', methods=['POST'])
+@document_required
+def del_acknowledgment(ordinal, index):
+    acks = get_vuln(ordinal)._acknowledgments
+    if not( 0 <= index < len(acks)):
+        flash('Acknowledgment not found', 'danger')
+        abort(404)
+
+    del acks[index]
+    return redirect(url_for('.view', ordinal=ordinal))

http://farol.wald.intevation.org