mirror of https://github.com/jumpserver/jumpserver
update bug
parent
c1a74aebc5
commit
72ad4b44ce
|
@ -263,7 +263,6 @@ REST_FRAMEWORK = {
|
||||||
# Use Django's standard `django.contrib.auth` permissions,
|
# Use Django's standard `django.contrib.auth` permissions,
|
||||||
# or allow read-only access for unauthenticated users.
|
# or allow read-only access for unauthenticated users.
|
||||||
'DEFAULT_PERMISSION_CLASSES': (
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
# 'rest_framework.permissions.IsAuthenticated',
|
|
||||||
'users.backends.IsValidUser',
|
'users.backends.IsValidUser',
|
||||||
),
|
),
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
@ -273,6 +272,7 @@ REST_FRAMEWORK = {
|
||||||
'rest_framework.authentication.BasicAuthentication',
|
'rest_framework.authentication.BasicAuthentication',
|
||||||
'rest_framework.authentication.SessionAuthentication',
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
),
|
),
|
||||||
|
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Custom User Auth model
|
# Custom User Auth model
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
|
from rest_framework import filters
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -11,6 +12,7 @@ from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework_bulk import ListBulkCreateUpdateDestroyAPIView, BulkModelViewSet
|
from rest_framework_bulk import ListBulkCreateUpdateDestroyAPIView, BulkModelViewSet
|
||||||
from rest_framework import authentication
|
from rest_framework import authentication
|
||||||
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
|
|
||||||
from common.mixins import BulkDeleteApiMixin
|
from common.mixins import BulkDeleteApiMixin
|
||||||
from common.utils import get_logger
|
from common.utils import get_logger
|
||||||
|
@ -28,9 +30,9 @@ class UserViewSet(BulkModelViewSet):
|
||||||
queryset = User.objects.all()
|
queryset = User.objects.all()
|
||||||
serializer_class = serializers.UserSerializer
|
serializer_class = serializers.UserSerializer
|
||||||
permission_classes = (IsSuperUser,)
|
permission_classes = (IsSuperUser,)
|
||||||
|
filter_backends = (DjangoFilterBackend,)
|
||||||
def allow_bulk_destroy(self, qs, filtered):
|
# filter_fields = ('username', 'email', 'name', 'id')
|
||||||
return qs is not filtered
|
ordering_fields = ('username', 'email')
|
||||||
|
|
||||||
|
|
||||||
class UserUpdateGroupApi(generics.RetrieveUpdateAPIView):
|
class UserUpdateGroupApi(generics.RetrieveUpdateAPIView):
|
||||||
|
|
|
@ -15,4 +15,5 @@ paramiko==2.0.2
|
||||||
django-redis-cache==1.7.1
|
django-redis-cache==1.7.1
|
||||||
requests==2.11.1
|
requests==2.11.1
|
||||||
itsdangerous==0.24
|
itsdangerous==0.24
|
||||||
unicodecsv==0.14.1
|
unicodecsv==0.14.1
|
||||||
|
django-filter==1.0.0
|
||||||
|
|
Loading…
Reference in New Issue