Delete perms: must be staff and in group (#82)

* Delete perms: must be staff and in group

* separate group check and staff check

* test_del_list => test_del_list_not_in_list_group
This commit is contained in:
james1293 2019-07-24 01:30:07 -04:00 committed by Scot Hacker
parent 21e0c6d656
commit 7f576c9bc8
2 changed files with 10 additions and 8 deletions

View file

@ -17,7 +17,9 @@ def del_list(request, list_id: int, list_slug: str) -> HttpResponse:
# Ensure user has permission to delete list. Get the group this list belongs to,
# and check whether current user is a member of that group AND a staffer.
if task_list.group not in request.user.groups.all() and not request.user.is_staff:
if task_list.group not in request.user.groups.all():
raise PermissionDenied
if not request.user.is_staff:
raise PermissionDenied
if request.method == "POST":