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.
jumpserver/apps/users/api.py

50 lines
1.4 KiB

# ~*~ coding: utf-8 ~*~
8 years ago
#
import logging
from rest_framework import generics, mixins, status, permissions
from rest_framework.views import APIView
from rest_framework.response import Response
8 years ago
from .serializers import UserSerializer, UserGroupSerializer
from .models import User, UserGroup
8 years ago
logger = logging.getLogger('jumpserver.users.api')
class UserListAddApi(generics.ListCreateAPIView):
queryset = User.objects.all()
serializer_class = UserSerializer
8 years ago
# permission_classes = (
# permissions.DenyAll,
# )
class UserDetailDeleteUpdateApi(generics.RetrieveUpdateDestroyAPIView):
8 years ago
queryset = User.objects.all()
serializer_class = UserSerializer
8 years ago
def put(self, request, *args, **kwargs):
8 years ago
for k, v in request.META.items():
logger.debug("%s --> %s" % (k, v))
8 years ago
return super(UserDetailDeleteUpdateApi, self).put(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