Merge pull request #236 from astagi/feature/me

Add users me endpoint
remotes/origin/enhancement/email-actions
Jesús Espino 2015-02-03 13:34:44 +01:00
commit f4856f95ee
2 changed files with 10 additions and 0 deletions

View File

@ -264,6 +264,15 @@ class UsersViewSet(ModelCrudViewSet):
return Response(status=status.HTTP_204_NO_CONTENT) return Response(status=status.HTTP_204_NO_CONTENT)
@list_route(methods=["GET"])
def me(self, request, pk=None):
"""
Get me.
"""
self.check_permissions(request, "me", None)
user_data = serializers.UserSerializer(request.user).data
return Response(user_data, status=status.HTTP_200_OK)
@list_route(methods=["POST"]) @list_route(methods=["POST"])
def cancel(self, request, pk=None): def cancel(self, request, pk=None):
""" """

View File

@ -35,6 +35,7 @@ class UserPermission(TaigaResourcePermission):
change_password_from_recovery_perms = AllowAny() change_password_from_recovery_perms = AllowAny()
change_password_perms = IsAuthenticated() change_password_perms = IsAuthenticated()
change_avatar_perms = IsAuthenticated() change_avatar_perms = IsAuthenticated()
me_perms = IsAuthenticated()
remove_avatar_perms = IsAuthenticated() remove_avatar_perms = IsAuthenticated()
starred_perms = AllowAny() starred_perms = AllowAny()
change_email_perms = IsTheSameUser() change_email_perms = IsTheSameUser()