From 19dbc6c9bb9d4d399f92dbd9879fa377876d08b0 Mon Sep 17 00:00:00 2001 From: Suresh Krishnan Date: Sat, 24 Mar 2012 15:03:11 +0000 Subject: [PATCH] Making doc writeup available as read-only text to regular users who are not shepherd/AD/Secretariat etc. Adding a link for viewing a writeup to the main datatracker page. - Legacy-Id: 4213 --- ietf/ietfworkflows/templatetags/ietf_streams.py | 2 ++ ietf/templates/wgchairs/edit_management_writeup.html | 6 ++++-- ietf/wgchairs/views.py | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) 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 @@ Return to shepherd list

-

Change protocol write-up for {{ doc }}

+

{% if can_edit %} Change {% else %} View {% endif %} protocol write-up for {{ doc }}

@@ -50,6 +50,7 @@ Please, note that the 'Doc Shepherd Follow-up Underway'
Draft stateActual protocol write-upLast updated
{% else %} +{% if authorized_user %}
Edit protocol write-up
@@ -62,4 +63,5 @@ Please, note that the 'Doc Shepherd Follow-up Underway'
{% 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))