Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise forbidden error if un authenticated users load email api. #1548

Merged
merged 2 commits into from
Feb 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions galaxy/api/views/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from rest_framework.response import Response

from rest_framework.permissions import IsAuthenticated

__all__ = [
'UserEmailList',
'EmailList',
Expand All @@ -29,6 +31,7 @@ class UserEmailList(base_views.SubListAPIView):
serializer_class = serializers.EmailSerializer
parent_model = User
relationship = 'emailaddress_set'
permission_classes = (IsAuthenticated,)

def get_queryset(self):
user_id = self.kwargs.get(self.lookup_field)
Expand All @@ -42,6 +45,7 @@ def get_queryset(self):
class EmailList(base_views.ListCreateAPIView):
model = EmailAddress
serializer_class = serializers.EmailSerializer
permission_classes = (IsAuthenticated,)

def get_queryset(self):
qs = super(EmailList, self).get_queryset()
Expand All @@ -53,6 +57,7 @@ def get_queryset(self):
class EmailDetail(base_views.RetrieveUpdateDestroyAPIView):
model = EmailAddress
serializer_class = serializers.EmailSerializer
permission_classes = (IsAuthenticated,)

def get_object(self, qs=None):
obj = super(EmailDetail, self).get_object()
Expand Down