gateway_placeholder/gateway/api/IsSuperUser/view.py

15 lines
435 B
Python
Raw Normal View History

2024-11-30 05:30:54 +00:00
from rest_framework.permissions import IsAuthenticated
from rest_framework.views import APIView
from rest_framework.response import Response
class CheckUserType(APIView):
permission_classes = [IsAuthenticated]
def get(self, request):
user = request.user
user_type = 'regular'
if user.is_superuser:
user_type = 'superuser'
return Response({'user_type': user_type})