Mercurial > farol > farol
comparison 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 |
comparison
equal
deleted
inserted
replaced
90:2201d0ea0bf3 | 91:6a61c02f2156 |
---|---|
210 | 210 |
211 cwe._id = request.form['id'] | 211 cwe._id = request.form['id'] |
212 cwe._value = request.form['description'] | 212 cwe._value = request.form['description'] |
213 return redirect(url_for('.view', ordinal=ordinal)) | 213 return redirect(url_for('.view', ordinal=ordinal)) |
214 | 214 |
215 | |
216 @vulnerability.route('/<int:ordinal>/cwe/add', methods=['GET', 'POST']) | 215 @vulnerability.route('/<int:ordinal>/cwe/add', methods=['GET', 'POST']) |
217 @document_required | 216 @document_required |
218 def add_cwe(ordinal): | 217 def add_cwe(ordinal): |
219 if request.method != 'POST': | 218 if request.method != 'POST': |
220 return render_template('vulnerability/edit_cwe.j2', ordinal=ordinal, action='Add') | 219 return render_template('vulnerability/edit_cwe.j2', ordinal=ordinal, action='Add') |
221 | 220 |
222 cwe = CVRFCWE(request.form['id'], request.form['description']) | 221 cwe = CVRFCWE(request.form['id'], request.form['description']) |
223 get_vuln(ordinal).addCWE(cwe) | 222 get_vuln(ordinal).addCWE(cwe) |
224 return redirect(url_for('.view', ordinal=ordinal)) | 223 return redirect(url_for('.view', ordinal=ordinal)) |
224 | |
225 @vulnerability.route('/<int:ordinal>/cwe/<int:index>/del', methods=['POST']) | |
226 @document_required | |
227 def del_cwe(ordinal, index): | |
228 cwes = get_vuln(ordinal)._cwes | |
229 if not ( 0 <= index < len(cwes)): | |
230 flash('CWE not found', 'danger') | |
231 abort(404) | |
232 del cwes[index] | |
233 return redirect(url_for('.view', ordinal=ordinal)) | |
234 | |
225 | 235 |
226 @vulnerability.route('/<int:ordinal>/productstatus/<int:index>') | 236 @vulnerability.route('/<int:ordinal>/productstatus/<int:index>') |
227 @document_required | 237 @document_required |
228 def view_status(ordinal, index): | 238 def view_status(ordinal, index): |
229 try: | 239 try: |