Unverified Commit 57eed7fa authored by BaiJiangJie's avatar BaiJiangJie Committed by GitHub

Merge pull request #3157 from jumpserver/v52_perms

[Update] 修复创建授权规则授权节点时,系统用户不自动推送的问题
parents f47f8a66 fb940507
...@@ -57,16 +57,16 @@ def on_system_user_update(sender, instance=None, created=True, **kwargs): ...@@ -57,16 +57,16 @@ def on_system_user_update(sender, instance=None, created=True, **kwargs):
push_system_user_to_assets.delay(instance, assets) push_system_user_to_assets.delay(instance, assets)
# @receiver(m2m_changed, sender=SystemUser.nodes.through) @receiver(m2m_changed, sender=SystemUser.nodes.through)
# def on_system_user_nodes_change(sender, instance=None, **kwargs): def on_system_user_nodes_change(sender, instance=None, **kwargs):
# if instance and kwargs["action"] == "post_add": if instance and kwargs["action"] == "post_add":
# logger.info("System user `{}` nodes update signal received".format(instance)) logger.info("System user `{}` nodes update signal received".format(instance))
# assets = set() assets = set()
# nodes = kwargs['model'].objects.filter(pk__in=kwargs['pk_set']) nodes = kwargs['model'].objects.filter(pk__in=kwargs['pk_set'])
# for node in nodes: for node in nodes:
# assets.update(set(node.get_all_assets())) assets.update(set(node.get_all_assets()))
# instance.assets.add(*tuple(assets)) instance.assets.add(*tuple(assets))
#
@receiver(m2m_changed, sender=SystemUser.assets.through) @receiver(m2m_changed, sender=SystemUser.assets.through)
def on_system_user_assets_change(sender, instance=None, **kwargs): def on_system_user_assets_change(sender, instance=None, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment