*/api: fix lookups per user
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
08451c15f4
commit
e674f03064
|
@ -50,4 +50,4 @@ class NotificationViewSet(
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
user = self.request.user if self.request else get_anonymous_user()
|
||||||
return Notification.objects.filter(user=user)
|
return Notification.objects.filter(user=user.pk)
|
||||||
|
|
|
@ -42,7 +42,7 @@ class AuthorizationCodeViewSet(
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
user = self.request.user if self.request else get_anonymous_user()
|
||||||
if user.is_superuser:
|
if user.is_superuser:
|
||||||
return super().get_queryset()
|
return super().get_queryset()
|
||||||
return super().get_queryset().filter(user=user)
|
return super().get_queryset().filter(user=user.pk)
|
||||||
|
|
||||||
|
|
||||||
class RefreshTokenViewSet(
|
class RefreshTokenViewSet(
|
||||||
|
@ -62,4 +62,4 @@ class RefreshTokenViewSet(
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
user = self.request.user if self.request else get_anonymous_user()
|
||||||
if user.is_superuser:
|
if user.is_superuser:
|
||||||
return super().get_queryset()
|
return super().get_queryset()
|
||||||
return super().get_queryset().filter(user=user)
|
return super().get_queryset().filter(user=user.pk)
|
||||||
|
|
|
@ -30,4 +30,4 @@ class UserOAuthSourceConnectionViewSet(ModelViewSet):
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
user = self.request.user if self.request else get_anonymous_user()
|
||||||
if user.is_superuser:
|
if user.is_superuser:
|
||||||
return super().get_queryset()
|
return super().get_queryset()
|
||||||
return super().get_queryset().filter(user=user)
|
return super().get_queryset().filter(user=user.pk)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class StaticDeviceViewSet(ModelViewSet):
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
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):
|
class StaticAdminDeviceViewSet(ReadOnlyModelViewSet):
|
||||||
|
|
|
@ -49,7 +49,7 @@ class TOTPDeviceViewSet(ModelViewSet):
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
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):
|
class TOTPAdminDeviceViewSet(ReadOnlyModelViewSet):
|
||||||
|
|
|
@ -48,7 +48,7 @@ class WebAuthnDeviceViewSet(ModelViewSet):
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
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):
|
class WebAuthnAdminDeviceViewSet(ReadOnlyModelViewSet):
|
||||||
|
|
|
@ -54,4 +54,4 @@ class UserConsentViewSet(
|
||||||
user = self.request.user if self.request else get_anonymous_user()
|
user = self.request.user if self.request else get_anonymous_user()
|
||||||
if user.is_superuser:
|
if user.is_superuser:
|
||||||
return super().get_queryset()
|
return super().get_queryset()
|
||||||
return super().get_queryset().filter(user=user)
|
return super().get_queryset().filter(user=user.pk)
|
||||||
|
|
Reference in a new issue