mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
501 B
19 lines
501 B
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
from django.db.models.signals import post_save, post_delete
|
|
from django.dispatch import receiver
|
|
|
|
from common.utils import get_logger
|
|
from .models import NodePermission
|
|
|
|
|
|
logger = get_logger(__file__)
|
|
|
|
|
|
@receiver(post_save, sender=NodePermission, dispatch_uid="my_unique_identifier")
|
|
def on_asset_permission_create_or_update(sender, instance=None, **kwargs):
|
|
if instance and instance.node and instance.system_user:
|
|
instance.system_user.nodes.add(instance.node)
|
|
|