2021-03-09 09:41:43 +00:00
|
|
|
# Copyright (C) 2018-2021 by BDE ENS Paris-Saclay
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from rest_framework.generics import RetrieveAPIView
|
|
|
|
|
2021-03-09 09:57:35 +00:00
|
|
|
from .serializers import OAuthSerializer
|
2021-03-09 09:41:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UserInformationView(RetrieveAPIView):
|
2021-03-09 09:57:35 +00:00
|
|
|
"""
|
|
|
|
These fields are give to OAuth authenticators.
|
|
|
|
"""
|
|
|
|
serializer_class = OAuthSerializer
|
2021-03-09 09:41:43 +00:00
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return User.objects.filter(pk=self.request.user.pk)
|
|
|
|
|
|
|
|
def get_object(self):
|
|
|
|
return self.request.user
|