-
Notifications
You must be signed in to change notification settings - Fork 329
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
Raise forbidden error if un authenticated users load email api. #1548
Conversation
galaxy/api/views/email.py
Outdated
class UserEmailList(base_views.SubListAPIView): | ||
model = EmailAddress | ||
serializer_class = serializers.EmailSerializer | ||
parent_model = User | ||
relationship = 'emailaddress_set' | ||
|
||
def get_queryset(self): | ||
deny_anonymous_users(self.request.user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be handled in access.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely get_queryset()
is not the best place for checking user permissions.
Please use permission_classes = (IsAuthenticated,)
galaxy/api/views/email.py
Outdated
class UserEmailList(base_views.SubListAPIView): | ||
model = EmailAddress | ||
serializer_class = serializers.EmailSerializer | ||
parent_model = User | ||
relationship = 'emailaddress_set' | ||
|
||
def get_queryset(self): | ||
deny_anonymous_users(self.request.user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely get_queryset()
is not the best place for checking user permissions.
Please use permission_classes = (IsAuthenticated,)
fixes: #1522