diff --git a/taiga/users/api.py b/taiga/users/api.py index 6afd5674..b634a962 100644 --- a/taiga/users/api.py +++ b/taiga/users/api.py @@ -264,6 +264,15 @@ class UsersViewSet(ModelCrudViewSet): return Response(status=status.HTTP_204_NO_CONTENT) + @list_route(methods=["GET"]) + def me(self, request, pk=None): + """ + Get me. + """ + self.check_permissions(request, "me", None) + user_data = serializers.UserSerializer(request.user).data + return Response(user_data, status=status.HTTP_200_OK) + @list_route(methods=["POST"]) def cancel(self, request, pk=None): """ diff --git a/taiga/users/permissions.py b/taiga/users/permissions.py index c067fa19..5b7a8f27 100644 --- a/taiga/users/permissions.py +++ b/taiga/users/permissions.py @@ -35,6 +35,7 @@ class UserPermission(TaigaResourcePermission): change_password_from_recovery_perms = AllowAny() change_password_perms = IsAuthenticated() change_avatar_perms = IsAuthenticated() + me_perms = IsAuthenticated() remove_avatar_perms = IsAuthenticated() starred_perms = AllowAny() change_email_perms = IsTheSameUser()