# HG changeset patch # User BenoƮt Allard # Date 1412865426 -7200 # Node ID 4ec281e688214d3a29633fa70e86117c16920e44 # Parent 3848faa88cd5bbc1c6eabf91ad85fe003e824ca8 Add deletion of Vulnerability's Acknowledgments diff -r 3848faa88cd5 -r 4ec281e68821 farol/templates/vulnerability/view_acknowledgment.j2 --- 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) }} +
{{ delete_button(url_for('.del_acknowledgment', ordinal=ordinal, index=index)) }}
{% endblock %} diff -r 3848faa88cd5 -r 4ec281e68821 farol/vulnerability.py --- 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('//acknowledgment//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))