diff --git a/apps/perms/utils.py b/apps/perms/utils.py index d45f0f3d7..e23a88b27 100644 --- a/apps/perms/utils.py +++ b/apps/perms/utils.py @@ -106,21 +106,19 @@ class AssetPermissionUtil: return assets @classmethod - def get_user_group_nodes_with_assets(cls, user): + def get_user_group_nodes_with_assets(cls, group): """ - :param user: + :param group: :return: {node: {asset: set(su1, su2)}} """ - nodes = defaultdict(dict) - _assets = cls.get_user_group_assets(user) + _assets = cls.get_user_group_assets(group) + tree = Tree() for asset, _system_users in _assets.items(): _nodes = asset.get_nodes() + tree.add_nodes(_nodes) for node in _nodes: - if asset in nodes[node]: - nodes[node][asset].update(_system_users) - else: - nodes[node][asset] = _system_users - return nodes + tree.nodes[node][asset].update(_system_users) + return tree.nodes @classmethod def get_user_assets_direct(cls, user): diff --git a/apps/users/templates/users/user_group_granted_asset.html b/apps/users/templates/users/user_group_granted_asset.html index c1d56a701..1692e06a2 100644 --- a/apps/users/templates/users/user_group_granted_asset.html +++ b/apps/users/templates/users/user_group_granted_asset.html @@ -64,10 +64,11 @@ var zTree; var inited = false; var url; +var asset_table; function initTable() { if (inited){ - return + return asset_table } else { inited = true; }