|
@@ -2,6 +2,8 @@ from django.contrib.auth.models import User, Group
|
|
|
from rest_framework import viewsets
|
|
|
from rest_framework import permissions
|
|
|
from .serializers import UserSerializer, GroupSerializer
|
|
|
+from rest_framework.views import APIView
|
|
|
+from rest_framework_api_key.permissions import HasAPIKey
|
|
|
|
|
|
|
|
|
class UserViewSet(viewsets.ModelViewSet):
|
|
@@ -10,7 +12,7 @@ class UserViewSet(viewsets.ModelViewSet):
|
|
|
"""
|
|
|
queryset = User.objects.all().order_by('-date_joined')
|
|
|
serializer_class = UserSerializer
|
|
|
- permission_classes = [permissions.IsAuthenticated]
|
|
|
+ permission_classes = [HasAPIKey]
|
|
|
|
|
|
|
|
|
class GroupViewSet(viewsets.ModelViewSet):
|
|
@@ -19,4 +21,4 @@ class GroupViewSet(viewsets.ModelViewSet):
|
|
|
"""
|
|
|
queryset = Group.objects.all()
|
|
|
serializer_class = GroupSerializer
|
|
|
- permission_classes = [permissions.IsAuthenticated]
|
|
|
+ permission_classes = [HasAPIKey]
|