mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
# ~*~ coding: utf-8 ~*~
|
|
#
|
|
|
|
import logging
|
|
|
|
from rest_framework import generics
|
|
|
|
from .serializers import UserSerializer, UserGroupSerializer, UserAttributeSerializer, UserGroupEditSerializer
|
|
from .models import User, UserGroup
|
|
|
|
|
|
logger = logging.getLogger('jumpserver.users.api')
|
|
|
|
|
|
class UserListAddApi(generics.ListCreateAPIView):
|
|
queryset = User.objects.all()
|
|
serializer_class = UserSerializer
|
|
|
|
|
|
class UserDetailDeleteUpdateApi(generics.RetrieveUpdateDestroyAPIView):
|
|
queryset = User.objects.all()
|
|
serializer_class = UserSerializer
|
|
|
|
def delete(self, request, *args, **kwargs):
|
|
print(self.request.data)
|
|
return super(UserDetailDeleteUpdateApi, self).delete(request, *args, **kwargs)
|
|
|
|
# def get(self, request, *args, **kwargs):
|
|
# print("hello world")
|
|
# print(request.user)
|
|
# return super(UserDetailDeleteUpdateApi, self).get(request, *args, **kwargs)
|
|
|
|
|
|
class UserGroupListAddApi(generics.ListCreateAPIView):
|
|
queryset = UserGroup.objects.all()
|
|
serializer_class = UserGroupSerializer
|
|
|
|
|
|
class UserGroupDetailDeleteUpdateApi(generics.RetrieveUpdateDestroyAPIView):
|
|
queryset = UserGroup.objects.all()
|
|
serializer_class = UserGroupSerializer
|
|
|
|
|
|
class UserAttributeApi(generics.RetrieveUpdateDestroyAPIView):
|
|
queryset = User.objects.all()
|
|
serializer_class = UserAttributeSerializer
|
|
|
|
|
|
class UserGroupEditApi(generics.RetrieveUpdateAPIView):
|
|
queryset = User.objects.all()
|
|
serializer_class = UserGroupEditSerializer
|