filter out agents from user management
@@ -12,6 +12,7 @@ from rest_framework.response import Response
from rest_framework import status
from .models import User
+from agents.models import Agent
from .serializers import UserSerializer, TOTPSetupSerializer
@@ -57,9 +58,11 @@ class LoginView(KnoxLoginView):
else:
return Response("bad credentials", status=status.HTTP_400_BAD_REQUEST)
+
class GetAddUsers(APIView):
def get(self, request):
- users = User.objects.all()
+ agents = Agent.objects.values_list("agent_id", flat=True)
+ users = User.objects.exclude(username__in=agents)
return Response(UserSerializer(users, many=True).data)
@@ -79,6 +82,7 @@ class GetAddUsers(APIView):
return Response("ok")
+
class GetUpdateDeleteUser(APIView):
def get(self, request, pk):
user = get_object_or_404(User, pk=pk)
@@ -99,6 +103,7 @@ class GetUpdateDeleteUser(APIView):
return Response("ok")
+
class UserActions(APIView):
# reset password
