mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-05 01:19:29 +00:00
add is_superuser, is_staff, and groups to /api/login (#764)
* add is_superuser, is_staff, and groups to /api/login * fix linting
This commit is contained in:
@@ -740,7 +740,15 @@ class LoginApiView(ObtainAuthToken):
|
|||||||
|
|
||||||
print(f"returning token for user with id {user.pk}")
|
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):
|
class SnapshotApiListView(ApiBaseView):
|
||||||
|
|||||||
Reference in New Issue
Block a user