Skip to content

Commit

Permalink
Restrict permissions for notification
Browse files Browse the repository at this point in the history
  • Loading branch information
atarkowska committed Aug 22, 2018
1 parent a9c91dc commit 7f49583
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions emgapi/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from django.middleware import csrf
from django.http import HttpResponse
from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.decorators.csrf import csrf_protect

from django_filters.rest_framework import DjangoFilterBackend

Expand Down Expand Up @@ -112,11 +111,10 @@ def myaccounts(self, request, pk=None):
serializer = self.get_serializer(submitter, many=True)
return Response(serializer.data)

@csrf_protect
@list_route(
methods=['get', 'post', ],
serializer_class=ena_serializers.NotifySerializer,
permission_classes=[permissions.AllowAny]
permission_classes=[permissions.IsAuthenticated, emg_perms.IsSelf]
)
def notify(self, request, pk=None):
serializer = self.get_serializer(data=request.data)
Expand All @@ -135,11 +133,10 @@ def notify(self, request, pk=None):
)
return Response(serializer.errors)

@csrf_protect
@list_route(
methods=['get', 'post', ],
serializer_class=ena_serializers.EmailSerializer,
permission_classes=[permissions.AllowAny]
permission_classes=[permissions.IsAuthenticated, emg_perms.IsSelf]
)
def sendemail(self, request, pk=None):
serializer = self.get_serializer(data=request.data)
Expand Down

0 comments on commit 7f49583

Please sign in to comment.