[Update] 修改用户组详情显示授权资产的bug

pull/1365/head
ibuler 2018-05-26 21:53:50 +08:00
parent fc2a44621b
commit 0bc86543b5
2 changed files with 9 additions and 10 deletions

View File

@ -106,21 +106,19 @@ class AssetPermissionUtil:
return assets return assets
@classmethod @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)}} :return: {node: {asset: set(su1, su2)}}
""" """
nodes = defaultdict(dict) _assets = cls.get_user_group_assets(group)
_assets = cls.get_user_group_assets(user) tree = Tree()
for asset, _system_users in _assets.items(): for asset, _system_users in _assets.items():
_nodes = asset.get_nodes() _nodes = asset.get_nodes()
tree.add_nodes(_nodes)
for node in _nodes: for node in _nodes:
if asset in nodes[node]: tree.nodes[node][asset].update(_system_users)
nodes[node][asset].update(_system_users) return tree.nodes
else:
nodes[node][asset] = _system_users
return nodes
@classmethod @classmethod
def get_user_assets_direct(cls, user): def get_user_assets_direct(cls, user):

View File

@ -64,10 +64,11 @@
var zTree; var zTree;
var inited = false; var inited = false;
var url; var url;
var asset_table;
function initTable() { function initTable() {
if (inited){ if (inited){
return return asset_table
} else { } else {
inited = true; inited = true;
} }