changeset 98:9b525f33080a

Add deletion of Vulnerabilities as a whole
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 09 Oct 2014 16:43:22 +0200
parents 4ec281e68821
children 0b9f19f51d79
files farol/templates/vulnerability/view.j2 farol/vulnerability.py
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/farol/templates/vulnerability/view.j2	Thu Oct 09 16:37:06 2014 +0200
+++ b/farol/templates/vulnerability/view.j2	Thu Oct 09 16:43:22 2014 +0200
@@ -122,4 +122,5 @@
   </ul>
   <a class="pull-right" href="{{ url_for('.add_acknowledgment', ordinal=vulnerability._ordinal) }}">add</a>
 {% endcall %}
+<div class="pull-right">{{ delete_button(url_for('.delete', ordinal=vulnerability._ordinal), text="delete vulnerability definition") }}</div>
 {% endblock %}
--- a/farol/vulnerability.py	Thu Oct 09 16:37:06 2014 +0200
+++ b/farol/vulnerability.py	Thu Oct 09 16:43:22 2014 +0200
@@ -105,6 +105,13 @@
     get_current().addVulnerability(vuln)
     return redirect(url_for('.view', ordinal=vuln._ordinal))
 
+@vulnerability.route('/<int:ordinal>/del', methods=['POST'])
+@document_required
+def delete(ordinal):
+    vuln = get_vuln(ordinal)
+    get_current()._vulnerabilities.remove(vuln)
+    return redirect(url_for('document.view'))
+
 @vulnerability.route('/<int:ordinal>/note/<int:note_ordinal>')
 @document_required
 def view_note(ordinal, note_ordinal):

http://farol.wald.intevation.org