mirror of https://github.com/jumpserver/jumpserver
parent
f0cbd77310
commit
3aeadc2f03
|
@ -113,7 +113,7 @@ def on_asset_permission_user_groups_changed(sender, instance, action, pk_set, re
|
|||
def on_node_asset_change(action, instance, reverse, pk_set, **kwargs):
|
||||
if not need_rebuild_mapping_node(action):
|
||||
return
|
||||
print("Asset node changed: ", action)
|
||||
|
||||
if reverse:
|
||||
asset_ids = pk_set
|
||||
node_ids = [instance.id]
|
||||
|
|
|
@ -9,7 +9,7 @@ from rest_framework.utils.encoders import JSONEncoder
|
|||
from assets.const import AllTypes
|
||||
from assets.models import FavoriteAsset, Asset, Node
|
||||
from common.utils.common import timeit, get_logger
|
||||
from orgs.utils import current_org, tmp_to_root_org
|
||||
from orgs.utils import current_org
|
||||
from perms.models import PermNode, UserAssetGrantedTreeNodeRelation, AssetPermission
|
||||
from .permission import AssetPermissionUtil
|
||||
|
||||
|
@ -112,7 +112,6 @@ class UserPermAssetUtil(AssetPermissionPermAssetUtil):
|
|||
favor_ids = FavoriteAsset.objects.filter(user=self.user).values_list('asset_id', flat=True)
|
||||
favor_ids = set(favor_ids)
|
||||
|
||||
with tmp_to_root_org():
|
||||
valid_ids = self.get_all_assets() \
|
||||
.filter(id__in=favor_ids) \
|
||||
.values_list('id', flat=True)
|
||||
|
|
|
@ -84,6 +84,7 @@ class UserPermTreeRefreshUtil(_UserPermTreeCacheMixin):
|
|||
logger.info("Delay refresh user orgs: {} {}".format(self.user, [o.name for o in to_refresh_orgs]))
|
||||
sync = True if settings.ASSET_SIZE == 'small' else False
|
||||
refresh_user_orgs_perm_tree.apply(sync=sync, user_orgs=((self.user, tuple(to_refresh_orgs)),))
|
||||
with tmp_to_root_org():
|
||||
refresh_user_favorite_assets.apply(sync=sync, users=(self.user,))
|
||||
|
||||
@timeit
|
||||
|
|
Loading…
Reference in New Issue