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.
jumpserver/apps/terminal/signal_handlers/virtualapp.py

25 lines
688 B

from django.db.models.signals import post_save
from django.dispatch import receiver
from common.decorators import on_transaction_commit
from ..models import AppProvider, VirtualApp
@receiver(post_save, sender=AppProvider)
@on_transaction_commit
def on_virtual_host_create(sender, instance, created=False, **kwargs):
if not created:
return
apps = VirtualApp.objects.all()
instance.apps.set(apps)
@receiver(post_save, sender=VirtualApp)
def on_virtual_app_create(sender, instance, created=False, **kwargs):
if not created:
return
providers = AppProvider.objects.all()
if len(providers) == 0:
return
instance.providers.set(providers)