diff --git a/apps/authentication/api/session.py b/apps/authentication/api/session.py index 37d4f82b5..eff7b1678 100644 --- a/apps/authentication/api/session.py +++ b/apps/authentication/api/session.py @@ -55,14 +55,14 @@ class UserSessionApi(generics.RetrieveDestroyAPIView): def retrieve(self, request, *args, **kwargs): if isinstance(request.user, AnonymousUser): - return Response(status=status.HTTP_200_OK) + return Response(status=status.HTTP_403_FORBIDDEN) UserSessionManager(request).connect() - return Response(status=status.HTTP_200_OK) + return Response(status=status.HTTP_200_OK, data={'ok': True}) def destroy(self, request, *args, **kwargs): if isinstance(request.user, AnonymousUser): - return Response(status=status.HTTP_200_OK) + return Response(status=status.HTTP_403_FORBIDDEN) UserSessionManager(request).disconnect() - return Response(status=status.HTTP_204_NO_CONTENT) + return Response(status=status.HTTP_200_OK, data={'ok': True}) diff --git a/apps/common/api/common.py b/apps/common/api/common.py index 988e85361..76d925743 100644 --- a/apps/common/api/common.py +++ b/apps/common/api/common.py @@ -97,7 +97,7 @@ class ResourcesIDCacheApi(APIView): class CountryListApi(APIView): - permission_classes = (AllowAny,) + permission_classes = (IsValidUser,) def get(self, request, *args, **kwargs): return Response(COUNTRY_CALLING_CODES) diff --git a/apps/common/management/commands/check_api.py b/apps/common/management/commands/check_api.py index 5dff77a9d..f8de10f08 100644 --- a/apps/common/management/commands/check_api.py +++ b/apps/common/management/commands/check_api.py @@ -34,6 +34,10 @@ def parse_to_url(url): url = url.replace('(?P[a-z0-9]+)', '') url = url.replace('((?P[/.]{36})/)?', uid + '/') url = url.replace('(?P[/.]+)', uid) + url = url.replace('(?P