From 335e6f4b6faec24a538bdb805e9a578a8d1c021b Mon Sep 17 00:00:00 2001 From: kralverde <80051564+kralverde@users.noreply.github.com> Date: Wed, 17 Jul 2024 09:57:45 -0400 Subject: [PATCH] add is_superuser, is_staff, and groups to /api/login (#764) * add is_superuser, is_staff, and groups to /api/login * fix linting --- tubearchivist/api/views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tubearchivist/api/views.py b/tubearchivist/api/views.py index 7ae37340..5d231da5 100644 --- a/tubearchivist/api/views.py +++ b/tubearchivist/api/views.py @@ -740,7 +740,15 @@ class LoginApiView(ObtainAuthToken): print(f"returning token for user with id {user.pk}") - return Response({"token": token.key, "user_id": user.pk}) + return Response( + { + "token": token.key, + "user_id": user.pk, + "is_superuser": user.is_superuser, + "is_staff": user.is_staff, + "user_groups": [group.name for group in user.groups.all()], + } + ) class SnapshotApiListView(ApiBaseView):