core: fix anonymous user being included in User API
This commit is contained in:
		@ -9,10 +9,7 @@ from django.utils.translation import gettext as _
 | 
			
		||||
from django.views.generic import UpdateView
 | 
			
		||||
from guardian.mixins import PermissionRequiredMixin
 | 
			
		||||
 | 
			
		||||
from authentik.admin.views.utils import (
 | 
			
		||||
    BackSuccessUrlMixin,
 | 
			
		||||
    DeleteMessageView,
 | 
			
		||||
)
 | 
			
		||||
from authentik.admin.views.utils import BackSuccessUrlMixin, DeleteMessageView
 | 
			
		||||
from authentik.core.forms.applications import ApplicationForm
 | 
			
		||||
from authentik.core.models import Application
 | 
			
		||||
from authentik.lib.views import CreateAssignPermView
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,6 @@
 | 
			
		||||
"""User API Views"""
 | 
			
		||||
from drf_yasg2.utils import swagger_auto_schema
 | 
			
		||||
from guardian.utils import get_anonymous_user
 | 
			
		||||
from rest_framework.decorators import action
 | 
			
		||||
from rest_framework.request import Request
 | 
			
		||||
from rest_framework.response import Response
 | 
			
		||||
@ -33,7 +34,7 @@ class UserSerializer(ModelSerializer):
 | 
			
		||||
class UserViewSet(ModelViewSet):
 | 
			
		||||
    """User Viewset"""
 | 
			
		||||
 | 
			
		||||
    queryset = User.objects.all()
 | 
			
		||||
    queryset = User.objects.all().exclude(pk=get_anonymous_user().pk)
 | 
			
		||||
    serializer_class = UserSerializer
 | 
			
		||||
 | 
			
		||||
    @swagger_auto_schema(responses={200: UserSerializer(many=False)})
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user