diff --git a/apps/orgs/models.py b/apps/orgs/models.py index ca43ea8eb..d6abe1f00 100644 --- a/apps/orgs/models.py +++ b/apps/orgs/models.py @@ -68,14 +68,10 @@ class Organization(models.Model): def get_org_users(self, include_app=False): from users.models import User - if self.is_default(): - users = User.objects.filter(orgs__isnull=True) - elif not self.is_real(): - users = User.objects.all() - elif self.is_root(): - users = User.objects.all() - else: + if self.is_real(): users = self.users.all() + else: + users = User.objects.all() if not include_app: users = users.exclude(role=User.ROLE_APP) return users diff --git a/apps/users/api/user.py b/apps/users/api/user.py index c01f5b1d3..583a8c557 100644 --- a/apps/users/api/user.py +++ b/apps/users/api/user.py @@ -38,10 +38,7 @@ class UserViewSet(IDInFilterMixin, BulkModelViewSet): pagination_class = LimitOffsetPagination def get_queryset(self): - queryset = super().get_queryset() - if current_org.is_real() or current_org.is_default(): - org_users = current_org.get_org_users() - queryset = queryset.filter(id__in=org_users) + queryset = current_org.get_org_users() return queryset def get_permissions(self):