diff --git a/ietf/ietfauth/utils.py b/ietf/ietfauth/utils.py index 96bca58b9..1ab5f2181 100644 --- a/ietf/ietfauth/utils.py +++ b/ietf/ietfauth/utils.py @@ -100,9 +100,23 @@ def is_authorized_in_doc_stream(user, doc): document.""" if has_role(user, ["Secretariat"]): return True - + ''' if not doc.stream or not user.is_authenticated(): return False + ''' + + if not user.is_authenticated(): + return False + + if not doc.stream: + group_req = None + if has_role(user, ["Area Director"]): + return True + if not doc.group.type == "individ": + group_req = Q(group=doc.group) + if not group_req: + return False + return bool(Role.objects.filter(Q(name__in=("chair", "secr", "delegate", "auth"), person__user=user) & group_req)) # must be authorized in the stream or group