mirror of https://github.com/jumpserver/jumpserver
feat: 修复获取用户授权的资产账号列表
parent
79a21bbc08
commit
881c0a6042
|
@ -78,7 +78,7 @@ class AssetPermissionQuerySet(models.QuerySet):
|
||||||
return self.filter(q)
|
return self.filter(q)
|
||||||
|
|
||||||
def filter_by_accounts(self, accounts):
|
def filter_by_accounts(self, accounts):
|
||||||
q = Q(accounts__contains=accounts) | \
|
q = Q(accounts__contains=list(accounts)) | \
|
||||||
Q(accounts__contains=AssetPermission.SpecialAccount.ALL.value)
|
Q(accounts__contains=AssetPermission.SpecialAccount.ALL.value)
|
||||||
return self.filter(q)
|
return self.filter(q)
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ class AssetPermission(OrgModelMixin):
|
||||||
# set account actions
|
# set account actions
|
||||||
account_names = accounts.values_list('username', flat=True)
|
account_names = accounts.values_list('username', flat=True)
|
||||||
perms = perms.filter_by_accounts(account_names)
|
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')
|
account_names_actions = perms.values_list('accounts', 'actions')
|
||||||
for account_names, actions in account_names_actions:
|
for account_names, actions in account_names_actions:
|
||||||
for account_name in account_names:
|
for account_name in account_names:
|
||||||
|
|
|
@ -647,7 +647,7 @@ class UserGrantedNodesQueryUtils(UserGrantedUtilsBase):
|
||||||
def get_whole_tree_nodes(self, with_special=True):
|
def get_whole_tree_nodes(self, with_special=True):
|
||||||
"""
|
"""
|
||||||
这里的 granted nodes, 是整棵树需要的node,推算出来的也算
|
这里的 granted nodes, 是整棵树需要的node,推算出来的也算
|
||||||
:param user:
|
:param with_special:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
nodes = PermNode.objects.filter(
|
nodes = PermNode.objects.filter(
|
||||||
|
|
Loading…
Reference in New Issue