Skip to content

Commit

Permalink
Change user API permissions (#1508)
Browse files Browse the repository at this point in the history
Co-authored-by: nik <nik@heartex.net>
  • Loading branch information
niklub and nik committed Sep 22, 2021
1 parent cb9f7c2 commit d8be6cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions label_studio/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from rest_framework import generics
from rest_framework.permissions import IsAuthenticated

from core.permissions import all_permissions
from core.permissions import all_permissions, ViewClassPermission
from users.models import User
from users.serializers import UserSerializer
from users.functions import check_avatar
Expand Down Expand Up @@ -64,7 +64,13 @@
))
class UserAPI(viewsets.ModelViewSet):
serializer_class = UserSerializer
permission_required = all_permissions.organizations_view
permission_required = ViewClassPermission(
GET=all_permissions.organizations_view,
PUT=all_permissions.organizations_change,
POST=all_permissions.organizations_change,
PATCH=all_permissions.organizations_change,
DELETE=all_permissions.organizations_change,
)

def get_queryset(self):
return User.objects.filter(organizations=self.request.user.active_organization)
Expand Down

0 comments on commit d8be6cf

Please sign in to comment.