diff --git a/ietf/ietfworkflows/templatetags/ietf_streams.py b/ietf/ietfworkflows/templatetags/ietf_streams.py index db6be14e1..0a8f7dcef 100644 --- a/ietf/ietfworkflows/templatetags/ietf_streams.py +++ b/ietf/ietfworkflows/templatetags/ietf_streams.py @@ -83,6 +83,8 @@ def edit_actions(context, wrapper): if can_manage_writeup_of_a_document(user, draft): actions.append(("Change stream writeup", urlreverse('doc_managing_writeup', kwargs=dict(acronym=draft.group.acronym, name=draft.filename)))) + else: + actions.append(("View writeup", urlreverse('doc_managing_writeup', kwargs=dict(acronym=draft.group.acronym, name=draft.filename)))) return dict(actions=actions) diff --git a/ietf/templates/wgchairs/edit_management_writeup.html b/ietf/templates/wgchairs/edit_management_writeup.html index d00663530..094a54116 100644 --- a/ietf/templates/wgchairs/edit_management_writeup.html +++ b/ietf/templates/wgchairs/edit_management_writeup.html @@ -1,7 +1,7 @@ {% extends "wginfo/wg_base.html" %} {% load ietf_filters wgchairs_tags %} -{% block title %}Change protocol write-up for {{ doc }}{% endblock %} +{% block title %} {% if can_edit %} Change {% else %} View {% endif %} protocol write-up for {{ doc }}{% endblock %} {% block wg_content %} @@ -9,7 +9,7 @@ <a href="{% url manage_shepherds wg.group_acronym.acronym %}">Return to shepherd list</a> </p> -<h1>Change protocol write-up for {{ doc }}</h1> +<h1> {% if can_edit %} Change {% else %} View {% endif %} protocol write-up for {{ doc }}</h1> <table class="ietf-table" style="width: 100%;"> <tr><th>Draft state</th><th>Actual protocol write-up</th><th>Last updated</th></tr> @@ -50,6 +50,7 @@ Please, <strong>note</strong> that the <strong>'Doc Shepherd Follow-up Underway' </form> </td></tr></table> {% else %} +{% if authorized_user %} <table class="ietf-table" style="width: 100%;"> <tr><th>Edit protocol write-up</th></tr> <tr><td> @@ -62,4 +63,5 @@ Please, <strong>note</strong> that the <strong>'Doc Shepherd Follow-up Underway' </td></tr> </table> {% endif %} +{% endif %} {% endblock %} diff --git a/ietf/wgchairs/views.py b/ietf/wgchairs/views.py index 22648eb38..8cfc6f8ac 100644 --- a/ietf/wgchairs/views.py +++ b/ietf/wgchairs/views.py @@ -251,8 +251,7 @@ def managing_writeup(request, acronym, name): wg = get_object_or_404(IETFWG, group_acronym__acronym=acronym, group_type=1) user = request.user doc = get_object_or_404(InternetDraft, filename=name) - if not can_manage_writeup_of_a_document(user, doc): - return HttpResponseForbidden('You do not have permission to access this page') + authorized_user = can_manage_writeup_of_a_document_no_state(user, doc) if settings.USE_DB_REDESIGN_PROXY_CLASSES: from ietf.doc.models import State state = doc.get_state("draft-stream-%s" % doc.stream_id) @@ -293,6 +292,7 @@ def managing_writeup(request, acronym, name): form=form, writeup=writeup, can_edit=can_edit, + authorized_user=authorized_user, ), context_instance=RequestContext(request)) elif valid and not error: @@ -312,5 +312,6 @@ def managing_writeup(request, acronym, name): writeup=writeup, followup=followup, can_edit=can_edit, + authorized_user=authorized_user, ), context_instance=RequestContext(request))