Skip to content

Commit

Permalink
Superuser fix
Browse files Browse the repository at this point in the history
  • Loading branch information
julianweng committed Nov 1, 2024
1 parent 36e83f9 commit 2345852
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions backend/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,13 @@ def post(self, request, format=None):
).exclude(codename="penn_clubs_admin")
for perm in perms:
perm.user_set.clear()
User.objects.filter(Q(is_superuser=True) | Q(is_staff=True)).update(
is_superuser=False, is_staff=False
)

clubs_admins = Permission.objects.get(
content_type=content_type, codename="penn_clubs_admin"
).user_set.all()
User.objects.filter(Q(is_superuser=True) | Q(is_staff=True)).exclude(
pk__in=clubs_admins
).update(is_superuser=False, is_staff=False)

try:
body = json.loads(request.body)
Expand Down

0 comments on commit 2345852

Please sign in to comment.