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
457 B
19 lines
457 B
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
from celery import shared_task
|
|
|
|
from orgs.utils import tmp_to_root_org
|
|
|
|
__all__ = ['add_nodes_assets_to_system_users']
|
|
|
|
|
|
@shared_task
|
|
@tmp_to_root_org()
|
|
def add_nodes_assets_to_system_users(nodes_keys, system_users):
|
|
from ..models import Node
|
|
nodes = Node.objects.filter(key__in=nodes_keys)
|
|
assets = Node.get_nodes_all_assets(*nodes)
|
|
for system_user in system_users:
|
|
system_user.assets.add(*tuple(assets))
|