Skip to content

Commit

Permalink
Changes to be committed:
Browse files Browse the repository at this point in the history
	modified:   webApp/Backend/requirements.yml
	modified:   webApp/Backend/sensor/__pycache__/__init__.cpython-311.pyc
	modified:   webApp/Backend/sensor/__pycache__/admin.cpython-311.pyc
	modified:   webApp/Backend/sensor/__pycache__/apps.cpython-311.pyc
	modified:   webApp/Backend/sensor/__pycache__/models.cpython-311.pyc
	modified:   webApp/Backend/sensor/__pycache__/serializer.cpython-311.pyc
	modified:   webApp/Backend/sensor/__pycache__/urls.cpython-311.pyc
	modified:   webApp/Backend/sensor/__pycache__/views.cpython-311.pyc
	modified:   webApp/Backend/sensor/migrations/__pycache__/0001_initial.cpython-311.pyc
	modified:   webApp/Backend/sensor/migrations/__pycache__/__init__.cpython-311.pyc
	modified:   webApp/Backend/sensor/views.py
	modified:   webApp/Backend/server/__pycache__/__init__.cpython-311.pyc
	modified:   webApp/Backend/server/__pycache__/settings.cpython-311.pyc
	modified:   webApp/Backend/server/__pycache__/urls.cpython-311.pyc
	modified:   webApp/Backend/server/__pycache__/wsgi.cpython-311.pyc
	modified:   webApp/Backend/server/settings.py
  • Loading branch information
Florian Rohr committed Jun 19, 2023
1 parent cd5c928 commit f0cf50f
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion webApp/Backend/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ paho-mqtt
psycopg2-binary
gunicorn
whitenoise
django-cors-headers
django-cors-headers
rest_framework_simplejwt
Binary file modified webApp/Backend/sensor/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/sensor/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/sensor/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/sensor/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/sensor/__pycache__/serializer.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/sensor/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/sensor/__pycache__/views.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 9 additions & 5 deletions webApp/Backend/sensor/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
from .models import SensorData, User
from .serializer import SensorSerializer, SignInSerializer, UserSerializer

from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout

from .serializer import MyTokenObtainPairSerializer, RegisterSerializer
from rest_framework.permissions import AllowAny
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework_simplejwt.views import TokenObtainPairView
from rest_framework.decorators import api_view

# Create your views here.

@csrf_exempt
def test_connection(request):
return HttpResponse("Connection successful")

Expand All @@ -35,6 +33,7 @@ class SensorViewset(viewsets.ModelViewSet):
List all sensor data
"""

permission_classes = [IsAuthenticated]
queryset = SensorData.objects.all()
serializer_class = SensorSerializer

Expand All @@ -44,6 +43,7 @@ class UserViewset(viewsets.ModelViewSet):
List all container data
"""

permission_classes = [IsAuthenticated]
queryset = User.objects.all()
serializer_class = UserSerializer

Expand All @@ -53,6 +53,7 @@ class ContainerViewset(viewsets.ModelViewSet):
List all container data
"""

permission_classes = [IsAuthenticated]
queryset = Container.objects.all()
serializer_class = ContainerSerializer

Expand All @@ -63,6 +64,7 @@ class ContainerLocation(APIView):
Retrieve container location
"""

permission_classes = [IsAuthenticated]
def post(self, request):
"""
Return the latest GPS sensor data for a container
Expand All @@ -80,6 +82,7 @@ class SensorByType(APIView):
Retrieve sensor data by type and/or container
"""

permission_classes = [IsAuthenticated]
def post(self, request):
"""
Return the sensor data by type and/or container
Expand All @@ -100,6 +103,7 @@ class ContainerByContent(APIView):
Retrieve container data by content
"""

permission_classes = [IsAuthenticated]
def post(self, request):
"""
Return the container data by content
Expand Down
Binary file modified webApp/Backend/server/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/server/__pycache__/settings.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/server/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file modified webApp/Backend/server/__pycache__/wsgi.cpython-311.pyc
Binary file not shown.
12 changes: 8 additions & 4 deletions webApp/Backend/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,21 @@
]

REST_FRAMEWORK = {
# 'DEFAULT_PERMISSION_CLASSES': (
# 'rest_framework.permissions.IsAuthenticated',
# ),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
# 'rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
'rest_framework_simplejwt.authentication.JWTAuthentication',
),
}

SIMPLE_JWT = {
'AUTH_HEADER_TYPES': ('Bearer',),
}

AUTH_USER_MODEL = 'sensor.User'


Expand Down

0 comments on commit f0cf50f

Please sign in to comment.