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

Refactor permissions.py from IAM app #4336

Merged
merged 11 commits into from
Feb 26, 2022
14 changes: 7 additions & 7 deletions cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def get_serializer_class(self):
def get_queryset(self):
queryset = super().get_queryset()
if self.action == 'list':
perm = ProjectPermission('list', self.request, self)
perm = ProjectPermission.create_scope_list(self.request)
queryset = perm.filter(queryset)
return queryset

Expand Down Expand Up @@ -571,7 +571,7 @@ class TaskViewSet(UploadMixin, viewsets.ModelViewSet):
def get_queryset(self):
queryset = super().get_queryset()
if self.action == 'list':
perm = TaskPermission('list', self.request, self)
perm = TaskPermission.create_scope_list(self.request)
queryset = perm.filter(queryset)

return queryset
Expand Down Expand Up @@ -949,7 +949,7 @@ def get_queryset(self):
queryset = super().get_queryset()

if self.action == 'list':
perm = JobPermission.create_list(self.request)
perm = JobPermission.create_scope_list(self.request)
queryset = perm.filter(queryset)

return queryset
Expand Down Expand Up @@ -1113,7 +1113,7 @@ class IssueViewSet(viewsets.ModelViewSet):
def get_queryset(self):
queryset = super().get_queryset()
if self.action == 'list':
perm = IssuePermission.create_list(self.request)
perm = IssuePermission.create_scope_list(self.request)
queryset = perm.filter(queryset)

return queryset
Expand Down Expand Up @@ -1183,7 +1183,7 @@ class CommentViewSet(viewsets.ModelViewSet):
def get_queryset(self):
queryset = super().get_queryset()
if self.action == 'list':
perm = CommentPermission.create_list(self.request)
perm = CommentPermission.create_scope_list(self.request)
queryset = perm.filter(queryset)

return queryset
Expand Down Expand Up @@ -1240,7 +1240,7 @@ class UserViewSet(viewsets.GenericViewSet, mixins.ListModelMixin,
def get_queryset(self):
queryset = super().get_queryset()
if self.action == 'list':
perm = UserPermission(self.request, self)
perm = UserPermission.create_scope_list(self.request)
queryset = perm.filter(queryset)

return queryset
Expand Down Expand Up @@ -1319,7 +1319,7 @@ def get_serializer_class(self):
def get_queryset(self):
queryset = super().get_queryset()
if self.action == 'list':
perm = CloudStoragePermission(self.request, self)
perm = CloudStoragePermission.create_scope_list(self.request)
queryset = perm.filter(queryset)

provider_type = self.request.query_params.get('provider_type', None)
Expand Down
Loading