diff --git a/authentik/events/api/notification.py b/authentik/events/api/notification.py index 70066ae0e..df012cf67 100644 --- a/authentik/events/api/notification.py +++ b/authentik/events/api/notification.py @@ -50,4 +50,4 @@ class NotificationViewSet( def get_queryset(self): user = self.request.user if self.request else get_anonymous_user() - return Notification.objects.filter(user=user) + return Notification.objects.filter(user=user.pk) diff --git a/authentik/providers/oauth2/api/tokens.py b/authentik/providers/oauth2/api/tokens.py index f7e2ea3f2..fb00a044b 100644 --- a/authentik/providers/oauth2/api/tokens.py +++ b/authentik/providers/oauth2/api/tokens.py @@ -42,7 +42,7 @@ class AuthorizationCodeViewSet( user = self.request.user if self.request else get_anonymous_user() if user.is_superuser: return super().get_queryset() - return super().get_queryset().filter(user=user) + return super().get_queryset().filter(user=user.pk) class RefreshTokenViewSet( @@ -62,4 +62,4 @@ class RefreshTokenViewSet( user = self.request.user if self.request else get_anonymous_user() if user.is_superuser: return super().get_queryset() - return super().get_queryset().filter(user=user) + return super().get_queryset().filter(user=user.pk) diff --git a/authentik/sources/oauth/api/source_connection.py b/authentik/sources/oauth/api/source_connection.py index 763608150..e602ca96e 100644 --- a/authentik/sources/oauth/api/source_connection.py +++ b/authentik/sources/oauth/api/source_connection.py @@ -30,4 +30,4 @@ class UserOAuthSourceConnectionViewSet(ModelViewSet): user = self.request.user if self.request else get_anonymous_user() if user.is_superuser: return super().get_queryset() - return super().get_queryset().filter(user=user) + return super().get_queryset().filter(user=user.pk) diff --git a/authentik/stages/authenticator_static/api.py b/authentik/stages/authenticator_static/api.py index a7eeaee88..4b59964fa 100644 --- a/authentik/stages/authenticator_static/api.py +++ b/authentik/stages/authenticator_static/api.py @@ -46,7 +46,7 @@ class StaticDeviceViewSet(ModelViewSet): def get_queryset(self): user = self.request.user if self.request else get_anonymous_user() - return StaticDevice.objects.filter(user=user) + return StaticDevice.objects.filter(user=user.pk) class StaticAdminDeviceViewSet(ReadOnlyModelViewSet): diff --git a/authentik/stages/authenticator_totp/api.py b/authentik/stages/authenticator_totp/api.py index f6aa67e57..3b2cbde03 100644 --- a/authentik/stages/authenticator_totp/api.py +++ b/authentik/stages/authenticator_totp/api.py @@ -49,7 +49,7 @@ class TOTPDeviceViewSet(ModelViewSet): def get_queryset(self): user = self.request.user if self.request else get_anonymous_user() - return TOTPDevice.objects.filter(user=user) + return TOTPDevice.objects.filter(user=user.pk) class TOTPAdminDeviceViewSet(ReadOnlyModelViewSet): diff --git a/authentik/stages/authenticator_webauthn/api.py b/authentik/stages/authenticator_webauthn/api.py index 2ea373efe..0ecb08b28 100644 --- a/authentik/stages/authenticator_webauthn/api.py +++ b/authentik/stages/authenticator_webauthn/api.py @@ -48,7 +48,7 @@ class WebAuthnDeviceViewSet(ModelViewSet): def get_queryset(self): user = self.request.user if self.request else get_anonymous_user() - return WebAuthnDevice.objects.filter(user=user) + return WebAuthnDevice.objects.filter(user=user.pk) class WebAuthnAdminDeviceViewSet(ReadOnlyModelViewSet): diff --git a/authentik/stages/consent/api.py b/authentik/stages/consent/api.py index ffe600f3b..501b4f008 100644 --- a/authentik/stages/consent/api.py +++ b/authentik/stages/consent/api.py @@ -54,4 +54,4 @@ class UserConsentViewSet( user = self.request.user if self.request else get_anonymous_user() if user.is_superuser: return super().get_queryset() - return super().get_queryset().filter(user=user) + return super().get_queryset().filter(user=user.pk)