mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-09 20:00:13 +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:
parent
b97cb9d264
commit
335e6f4b6f
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user