Mercurial > farol
changeset 64:aad7db3f93b6
Add support for Acknowledgments with multiple names and organizations
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Wed, 08 Oct 2014 14:28:29 +0200 |
parents | b4fb652484b4 |
children | 08a24e470de2 |
files | farol/document.py farol/templates/common_edits.j2 farol/templates/document/edit_acknowledgment.j2 farol/templates/document/view_acknowledgment.j2 farol/templates/vulnerability/edit_acknowledgment.j2 farol/templates/vulnerability/view_acknowledgment.j2 farol/vulnerability.py |
diffstat | 7 files changed, 22 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/document.py Wed Oct 08 14:15:16 2014 +0200 +++ b/farol/document.py Wed Oct 08 14:28:29 2014 +0200 @@ -240,7 +240,10 @@ except IndexError: abort(404) if request.method != 'POST': - return render_template('document/edit_acknowledgment.j2', name=ack._name, organization=ack._organization, description=ack._description, url=ack._url, action='Update') + return render_template('document/edit_acknowledgment.j2', + names=ack._names, organizations=ack._organizations, + description=ack._description, url=ack._url, + action='Update') update_acknowledgment_from_request(ack) return redirect(url_for('.view')) @@ -249,7 +252,8 @@ @document_required def add_acknowledgment(): if request.method != 'POST': - return render_template('document/edit_acknowledgment.j2', action='Add') + return render_template('document/edit_acknowledgment.j2', + action='Add') ack = create_acknowledgment_from_request() get_current().addAcknowledgment(ack)
--- a/farol/templates/common_edits.j2 Wed Oct 08 14:15:16 2014 +0200 +++ b/farol/templates/common_edits.j2 Wed Oct 08 14:28:29 2014 +0200 @@ -96,14 +96,14 @@ {% endcall %} {% endmacro %} -{% macro edit_acknowledgment(name, organization, description, url) %} +{% macro edit_acknowledgment(names, organizations, description, url) %} <p><strong>Acknowledgment</strong> contains recognition of external parties that reported noncritical/low-severity security issues or provided information, observations, or suggestions that contributed to improved security or improved documentation in future releases of the document producer's products. This may also contain recognition to external parties that contributed toward producing this document.</p> <p>This element indicates collaboration with the security community in a positive fashion and is an important part of a notice or advisory. Care should be taken to ensure that individuals would like to be acknowledged before they are included.</p> -{% call textinput("name", "Names", "", name, help="Multiple names should be comma-separated.") %} +{% call textinput("names", "Names", "", names | join(', '), help="Multiple names should be comma-separated.") %} <p>The <strong>Name</strong> should contain the name of the party being acknowledged.</p> {% endcall %} -{% call textinput("organization", "Organizations", "", organization, help="Multiple organizations should be comma-separated.") %} +{% call textinput("organizations", "Organizations", "", organizations | join(', '), help="Multiple organizations should be comma-separated.") %} <p>The <strong>Organization</strong> should contain the organization of the party or if the <strong>Name</strong> is omitted, the organization itself that is being acknowledged.</p> {% endcall %} {% call textarea("description", "Description", "", description, 5) %}
--- a/farol/templates/document/edit_acknowledgment.j2 Wed Oct 08 14:15:16 2014 +0200 +++ b/farol/templates/document/edit_acknowledgment.j2 Wed Oct 08 14:28:29 2014 +0200 @@ -30,7 +30,7 @@ {% block content %} <form role="form" method="POST"> - {{ edit_acknowledgment(name, organization, description, url) }} + {{ edit_acknowledgment(names, organizations, description, url) }} <button class="btn btn-primary" type="submit">{{ action }}</button> <a class="btn btn-danger" href="{{ url_for('.view') }}">Cancel</a>
--- a/farol/templates/document/view_acknowledgment.j2 Wed Oct 08 14:15:16 2014 +0200 +++ b/farol/templates/document/view_acknowledgment.j2 Wed Oct 08 14:28:29 2014 +0200 @@ -30,7 +30,7 @@ {% block content %} <a class="pull-right" href="{{ url_for('.edit_acknowledgment', index=index) }}">edit</a> <div class='page-header'> - <h1>{{ acknowledgment._name }} <small>{{ acknowledgment._organization }}</small></h1> + <h1>{{ acknowledgment._names | join(', ') }} <small>{{ acknowledgment._organizations | join(', ') }}</small></h1> </div> <div class="form-horizontal"> {{ label_value('Description', acknowledgment._description or '') }}
--- a/farol/templates/vulnerability/edit_acknowledgment.j2 Wed Oct 08 14:15:16 2014 +0200 +++ b/farol/templates/vulnerability/edit_acknowledgment.j2 Wed Oct 08 14:28:29 2014 +0200 @@ -32,7 +32,7 @@ {% block content %} <form role="form" method="POST"> - {{ edit_acknowledgment(name, organization, description, url) }} + {{ edit_acknowledgment(names, organizations, description, url) }} <button class="btn btn-primary" type="submit">{{ action }}</button> <a class="btn btn-danger" href="{{ url_for('.view', ordinal=ordinal) }}">Cancel</a>
--- a/farol/templates/vulnerability/view_acknowledgment.j2 Wed Oct 08 14:15:16 2014 +0200 +++ b/farol/templates/vulnerability/view_acknowledgment.j2 Wed Oct 08 14:28:29 2014 +0200 @@ -30,7 +30,7 @@ {% block i_content %} <a class="pull-right" href="{{ url_for('.edit_acknowledgment', ordinal=ordinal, index=index) }}">edit</a> <div class='page-header'> - <h1>{{ acknowledgment._name }} <small>{{ acknowledgment._organization }}</small></h1> + <h1>{{ acknowledgment._names | join(', ') }} <small>{{ acknowledgment._organizations | join(', ') }}</small></h1> </div> <div class="form-horizontal"> {{ label_value('Description', acknowledgment._description or '') }}
--- a/farol/vulnerability.py Wed Oct 08 14:15:16 2014 +0200 +++ b/farol/vulnerability.py Wed Oct 08 14:28:29 2014 +0200 @@ -446,7 +446,10 @@ ack = get_vuln(ordinal)._acknowledgments[index] except IndexError: abort(404) - return render_template('vulnerability/view_acknowledgment.j2', ordinal=ordinal, acknowledgment=ack, index=index, action='Update') + return render_template('vulnerability/view_acknowledgment.j2', + ordinal=ordinal, + acknowledgment=ack, index=index, + action='Update') @vulnerability.route('/<int:ordinal>/acknowledgment/<int:index>/edit', methods=['GET', 'POST']) @document_required @@ -456,7 +459,11 @@ except IndexError: abort(404) if request.method != 'POST': - return render_template('vulnerability/edit_acknowledgment.j2', ordinal=ordinal, name=ack._name, organization=ack._organization, description=ack._description, url=ack._url, action='Update') + return render_template('vulnerability/edit_acknowledgment.j2', + ordinal=ordinal, + names=ack._names, organizations=ack._organizations, + description=ack._description, url=ack._url, + action='Update') update_acknowledgment_from_request(ack) return redirect(url_for('.view', ordinal=ordinal))