From 89de111acc61fd161a16f6b9f4b89122b79ac7c7 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 7 Mar 2022 20:09:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=BF=87=E6=BB=A4=20(#7759)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng626 <1304903146@qq.com> --- apps/users/models/user.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/users/models/user.py b/apps/users/models/user.py index b0c8c3009..38020d917 100644 --- a/apps/users/models/user.py +++ b/apps/users/models/user.py @@ -336,16 +336,19 @@ class RoleMixin: return RoleBinding.get_role_users(org_admin) @classmethod - def get_nature_users(cls): - return cls.objects.filter(is_service_account=False) + def get_nature_users(cls, queryset=None): + if not queryset: + return cls.objects.filter(is_service_account=False) + return queryset.filter(is_service_account=False) @classmethod def get_org_users(cls, org=None): - queryset = cls.get_nature_users() + queryset = None if org is None: org = current_org if not org.is_root(): queryset = current_org.get_members() + queryset = cls.get_nature_users(queryset) return queryset def get_all_permissions(self):