Skip to content

Commit

Permalink
mypermissions: propagate is_superuser to response (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtrembecky authored Dec 21, 2024
1 parent 5fa0fa5 commit a7f75e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions personal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ def myprofile(self, request):
@action(methods=['get'], detail=False, permission_classes=[IsAuthenticated])
def mypermissions(self, request):
is_staff = request.user.is_staff
is_superuser = request.user.is_superuser
competition_set = set()
for group in request.user.groups.all():
for competition in group.competition_permissions.all():
competition_set.add(competition.pk)
return Response({
'is_staff': is_staff,
'is_superuser': is_superuser,
'competition_permissions': competition_set,
}, status=status.HTTP_200_OK)

0 comments on commit a7f75e2

Please sign in to comment.