Self hosted FLOSS fitness/workout, nutrition and weight tracker
Only allow access to the profile endpoint to logged in users
Roland Geidere1983b5a8af0
diff --git a/wger/core/api/views.py b/wger/core/api/views.pyindex f9ca701bf..f5b1861fe 100644--- a/wger/core/api/views.py+++ b/wger/core/api/views.py@@ -31,7 +31,7 @@ from rest_framework import (viewsets,)from rest_framework.decorators import action-from rest_framework.permissions import AllowAny+from rest_framework.permissions import AllowAny, IsAuthenticatedfrom rest_framework.response import Response# wger@@ -75,7 +75,7 @@ class UserProfileViewSet(viewsets.ModelViewSet):the profile, use a POST request with the new data, not a PATCH."""serializer_class = UserprofileSerializer- permission_classes = (WgerPermission, )+ permission_classes = (IsAuthenticated, WgerPermission, )def get_queryset(self):"""@@ -94,7 +94,6 @@ class UserProfileViewSet(viewsets.ModelViewSet):Customized list view, that returns only the current user's data"""queryset = self.get_queryset()- print(queryset.first())serializer = self.serializer_class(queryset.first(), many=False)return Response(serializer.data)