Mercurial > farol > farol
diff farol/vulnerability.py @ 91:6a61c02f2156
Add deletion of CWEs
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 16:03:04 +0200 |
parents | 2201d0ea0bf3 |
children | 33d6fd9a5e12 |
line wrap: on
line diff
--- a/farol/vulnerability.py Thu Oct 09 15:56:43 2014 +0200 +++ b/farol/vulnerability.py Thu Oct 09 16:03:04 2014 +0200 @@ -212,7 +212,6 @@ cwe._value = request.form['description'] return redirect(url_for('.view', ordinal=ordinal)) - @vulnerability.route('/<int:ordinal>/cwe/add', methods=['GET', 'POST']) @document_required def add_cwe(ordinal): @@ -223,6 +222,17 @@ get_vuln(ordinal).addCWE(cwe) return redirect(url_for('.view', ordinal=ordinal)) +@vulnerability.route('/<int:ordinal>/cwe/<int:index>/del', methods=['POST']) +@document_required +def del_cwe(ordinal, index): + cwes = get_vuln(ordinal)._cwes + if not ( 0 <= index < len(cwes)): + flash('CWE not found', 'danger') + abort(404) + del cwes[index] + return redirect(url_for('.view', ordinal=ordinal)) + + @vulnerability.route('/<int:ordinal>/productstatus/<int:index>') @document_required def view_status(ordinal, index):