Skip to content

Commit

Permalink
🎨 Jank
Browse files Browse the repository at this point in the history
  • Loading branch information
joyliu-q committed Nov 3, 2024
1 parent b4e821b commit 87b2abf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions backend/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,17 +515,12 @@ def post(self, request, format=None):
content_type = ContentType.objects.get(app_label="accounts", model="user")
perms = Permission.objects.filter(
content_type=content_type, codename__endswith="_admin"
).exclude(codename="penn_clubs_admin")
)
for perm in perms:
perm.user_set.clear()
penn_clubs_admin_permission = Permission.objects.get(
codename="penn_clubs_admin"
)
users_to_reset = User.objects.filter(
Q(is_superuser=True) | Q(is_staff=True)
).exclude(
Q(user_permissions=penn_clubs_admin_permission) | Q(is_superuser=True)
)
users_to_reset = User.objects.filter(Q(is_staff=True)).exclude(
Q(is_superuser=True)
) # Superusers retain permissions across time
users_to_reset.update(is_superuser=False, is_staff=False)

try:
Expand Down

0 comments on commit 87b2abf

Please sign in to comment.