From 881c0a604276363f74871de8cd90b62767ff3ece Mon Sep 17 00:00:00 2001 From: "Jiangjie.Bai" Date: Fri, 30 Sep 2022 16:08:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=88=E6=9D=83=E7=9A=84=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/perms/models/asset_permission.py | 4 ++-- apps/perms/utils/user_permission.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/perms/models/asset_permission.py b/apps/perms/models/asset_permission.py index 67df0bb26..f6203841d 100644 --- a/apps/perms/models/asset_permission.py +++ b/apps/perms/models/asset_permission.py @@ -78,7 +78,7 @@ class AssetPermissionQuerySet(models.QuerySet): return self.filter(q) def filter_by_accounts(self, accounts): - q = Q(accounts__contains=accounts) | \ + q = Q(accounts__contains=list(accounts)) | \ Q(accounts__contains=AssetPermission.SpecialAccount.ALL.value) return self.filter(q) @@ -238,7 +238,7 @@ class AssetPermission(OrgModelMixin): # set account actions account_names = accounts.values_list('username', flat=True) perms = perms.filter_by_accounts(account_names) - account_names_actions_map = defaultdict(set) + account_names_actions_map = defaultdict(int) account_names_actions = perms.values_list('accounts', 'actions') for account_names, actions in account_names_actions: for account_name in account_names: diff --git a/apps/perms/utils/user_permission.py b/apps/perms/utils/user_permission.py index 4546e81a0..81a2b9a10 100644 --- a/apps/perms/utils/user_permission.py +++ b/apps/perms/utils/user_permission.py @@ -647,7 +647,7 @@ class UserGrantedNodesQueryUtils(UserGrantedUtilsBase): def get_whole_tree_nodes(self, with_special=True): """ 这里的 granted nodes, 是整棵树需要的node,推算出来的也算 - :param user: + :param with_special: :return: """ nodes = PermNode.objects.filter(