mirror of https://github.com/jumpserver/jumpserver
Merge pull request #3157 from jumpserver/v52_perms
[Update] 修复创建授权规则授权节点时,系统用户不自动推送的问题pull/3158/head
commit
57eed7fab6
|
@ -57,16 +57,16 @@ def on_system_user_update(sender, instance=None, created=True, **kwargs):
|
|||
push_system_user_to_assets.delay(instance, assets)
|
||||
|
||||
|
||||
# @receiver(m2m_changed, sender=SystemUser.nodes.through)
|
||||
# def on_system_user_nodes_change(sender, instance=None, **kwargs):
|
||||
# if instance and kwargs["action"] == "post_add":
|
||||
# logger.info("System user `{}` nodes update signal received".format(instance))
|
||||
# assets = set()
|
||||
# nodes = kwargs['model'].objects.filter(pk__in=kwargs['pk_set'])
|
||||
# for node in nodes:
|
||||
# assets.update(set(node.get_all_assets()))
|
||||
# instance.assets.add(*tuple(assets))
|
||||
#
|
||||
@receiver(m2m_changed, sender=SystemUser.nodes.through)
|
||||
def on_system_user_nodes_change(sender, instance=None, **kwargs):
|
||||
if instance and kwargs["action"] == "post_add":
|
||||
logger.info("System user `{}` nodes update signal received".format(instance))
|
||||
assets = set()
|
||||
nodes = kwargs['model'].objects.filter(pk__in=kwargs['pk_set'])
|
||||
for node in nodes:
|
||||
assets.update(set(node.get_all_assets()))
|
||||
instance.assets.add(*tuple(assets))
|
||||
|
||||
|
||||
@receiver(m2m_changed, sender=SystemUser.assets.through)
|
||||
def on_system_user_assets_change(sender, instance=None, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue