Skip to content

Commit

Permalink
[fix] Disable put for UserAPI the right way (#1515)
Browse files Browse the repository at this point in the history
  • Loading branch information
triklozoid committed Sep 23, 2021
1 parent eb75e18 commit 397736f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion label_studio/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class UserAPI(viewsets.ModelViewSet):
PATCH=all_permissions.organizations_change,
DELETE=all_permissions.organizations_change,
)
http_method_names = ['get', 'post', 'head', 'patch', 'delete']

def get_queryset(self):
return User.objects.filter(organizations=self.request.user.active_organization)
Expand All @@ -91,7 +92,7 @@ def avatar(self, request, pk):
return Response(status=204)

def update(self, request, *args, **kwargs):
raise MethodNotAllowed('PUT')
return super(UserAPI, self).update(request, *args, **kwargs)

def list(self, request, *args, **kwargs):
return super(UserAPI, self).list(request, *args, **kwargs)
Expand Down

0 comments on commit 397736f

Please sign in to comment.