Skip to content

Commit 93568b2

Browse files
committed
Add check to addcomment for WG/RG chair or secretary; Commit ready for merge
- Legacy-Id: 10343
1 parent 70890fb commit 93568b2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,18 @@ def add_comment(request, name):
905905

906906
login = request.user.person
907907

908+
if doc.type_id == "draft" and doc.group != None:
909+
can_add_comment = bool(has_role(request.user, ("Area Director", "Secretariat", "IRTF Chair", "IANA", "RFC Editor")) or (
910+
request.user.is_authenticated() and
911+
Role.objects.filter(name__in=("chair", "secr"),
912+
group__acronym=doc.group.acronym,
913+
person__user=request.user)))
914+
else:
915+
can_add_comment = has_role(request.user, ("Area Director", "Secretariat", "IRTF Chair"))
916+
if not can_add_comment:
917+
# The user is a chair or secretary, but not for this WG or RG
918+
return HttpResponseForbidden("You need to be a chair or secretary of this group to add a comment.")
919+
908920
if request.method == 'POST':
909921
form = AddCommentForm(request.POST)
910922
if form.is_valid():

0 commit comments

Comments
 (0)