2019-09-19 09:27:49 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
|
|
|
from celery import shared_task
|
|
|
|
|
2020-12-22 03:38:31 +00:00
|
|
|
from orgs.utils import tmp_to_root_org
|
|
|
|
|
2019-09-19 09:27:49 +00:00
|
|
|
__all__ = ['add_nodes_assets_to_system_users']
|
|
|
|
|
|
|
|
|
|
|
|
@shared_task
|
2020-12-22 03:38:31 +00:00
|
|
|
@tmp_to_root_org()
|
2019-09-19 09:27:49 +00:00
|
|
|
def add_nodes_assets_to_system_users(nodes_keys, system_users):
|
|
|
|
from ..models import Node
|
|
|
|
assets = Node.get_nodes_all_assets(nodes_keys).values_list('id', flat=True)
|
|
|
|
for system_user in system_users:
|
|
|
|
system_user.assets.add(*tuple(assets))
|