Skip to content

Commit 74753b6

Browse files
committed
Added a guard against an instance of queryset filtering using an object without primary key.
- Legacy-Id: 12640
1 parent fef0060 commit 74753b6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/dbtemplate/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from django.http import HttpResponseForbidden, HttpResponseRedirect
22
from django.shortcuts import get_object_or_404, render
33

4+
import debug # pyflakes:ignore
5+
46
from ietf.dbtemplate.models import DBTemplate
57
from ietf.dbtemplate.forms import DBTemplateForm
68
from ietf.group.models import Group
@@ -25,7 +27,7 @@ def template_edit(request, acronym, template_id, base_template='dbtemplate/templ
2527
chairs = group.role_set.filter(name__slug='chair')
2628
extra_context = extra_context or {}
2729

28-
if not has_role(request.user, "Secretariat") and not chairs.filter(person__user=request.user).count():
30+
if not has_role(request.user, "Secretariat") and not (request.user.id and chairs.filter(person__user=request.user).count()):
2931
return HttpResponseForbidden("You are not authorized to access this view")
3032

3133
template = get_object_or_404(DBTemplate, id=template_id, group=group)

0 commit comments

Comments
 (0)