From 06b310baf5750ac325ca770de528f343ea2f7671 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Thu, 14 Mar 2024 16:28:00 -0400 Subject: [PATCH] feat: remove usage of privileged group --- program/views.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/program/views.py b/program/views.py index 923d6f2f..2e187cf6 100644 --- a/program/views.py +++ b/program/views.py @@ -32,7 +32,6 @@ from rest_framework.exceptions import ValidationError from rest_framework.pagination import LimitOffsetPagination from rest_framework.response import Response -from django.conf import settings from django.contrib.auth.models import User from django.db import IntegrityError from django.http import Http404, HttpResponse, JsonResponse @@ -266,12 +265,12 @@ class APIUserViewSet( search_fields = ["username", "first_name", "last_name", "email"] def get_queryset(self): - """The queryset contains all the users if the requesting user is a superuser or member of - the privileged group, otherwise it only contains the requesting user.""" + """The queryset contains all the users if the requesting user is a superuser, otherwise it + only contains the requesting user.""" user = self.request.user - if user.is_superuser or user.groups.filter(name=settings.PRIVILEGED_GROUP).exists(): + if user.is_superuser: return User.objects.all() else: return User.objects.filter(pk=user.id) -- GitLab