add manual account override for when unauthenticated users call the auth endpoint.

This commit is contained in:
DJ Gillespie 2024-03-05 14:27:20 -07:00
parent 6ec9065f8e
commit 0c98606234

View File

@ -98,6 +98,9 @@ class ConnectionViewSet(viewsets.ModelViewSet):
user = request.user
# Filter out any accounts with the right id, but the given user
# is not an owner or admin on that account.
if request.user.is_anonymous():
accounts = (Account.objects.filter(pk=1))
else:
accounts = (Account.objects.filter(pk=account_id, owner=user) |
Account.objects.filter(pk=account_id,
admin_users__in=[user]))