From 94e60e180e0febcd7806fb6a7996e314603f716c Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 9 Mar 2022 11:17:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=88=B0=E6=98=AF=E5=85=A8=E5=B1=80=E7=94=A8=E6=88=B7?= =?UTF-8?q?bug=20(#7776)?= 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/users/models/user.py b/apps/users/models/user.py index fec7311b7..600672847 100644 --- a/apps/users/models/user.py +++ b/apps/users/models/user.py @@ -346,20 +346,23 @@ class RoleMixin: org_admin = Role.BuiltinRole.org_admin.get_role() return RoleBinding.get_role_users(org_admin) - @classmethod - def get_nature_users(cls, queryset=None): - if not queryset: - return cls.objects.filter(is_service_account=False) + @staticmethod + def filter_not_service_account(queryset): return queryset.filter(is_service_account=False) + @classmethod + def get_nature_users(cls): + queryset = cls.objects.all() + return cls.filter_not_service_account(queryset) + @classmethod def get_org_users(cls, org=None): - queryset = None + queryset = cls.objects.all() if org is None: org = current_org if not org.is_root(): queryset = current_org.get_members() - queryset = cls.get_nature_users(queryset) + queryset = cls.filter_not_service_account(queryset) return queryset def get_all_permissions(self):