mirror of https://github.com/jumpserver/jumpserver
				
				
				
			
						commit
						f4457ff1e2
					
				|  | @ -76,14 +76,9 @@ class TreeService(Tree): | |||
|             ancestor_ids.pop(0) | ||||
|         return ancestor_ids | ||||
| 
 | ||||
|     def ancestors(self, nid, with_self=False, deep=False, with_assets=True): | ||||
|     def ancestors(self, nid, with_self=False, deep=False): | ||||
|         ancestor_ids = self.ancestors_ids(nid, with_self=with_self) | ||||
|         ancestors = [self.get_node(i, deep=deep) for i in ancestor_ids] | ||||
|         if with_assets: | ||||
|             return ancestors | ||||
|         for n in ancestors: | ||||
|             n.data['assets'] = set() | ||||
|             n.data['all_assets'] = None | ||||
|         return ancestors | ||||
| 
 | ||||
|     def get_node_full_tag(self, nid): | ||||
|  | @ -108,6 +103,7 @@ class TreeService(Tree): | |||
|         node = super().get_node(nid) | ||||
|         if deep: | ||||
|             node = self.copy_node(node) | ||||
|             node.data = {} | ||||
|         return node | ||||
| 
 | ||||
|     def parent(self, nid, deep=False): | ||||
|  |  | |||
|  | @ -18,6 +18,8 @@ from django.urls import reverse_lazy | |||
| 
 | ||||
| BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||||
| PROJECT_DIR = os.path.dirname(BASE_DIR) | ||||
| XPACK_DIR = os.path.join(BASE_DIR, 'xpack') | ||||
| HAS_XPACK = os.path.isdir(XPACK_DIR) | ||||
| 
 | ||||
| 
 | ||||
| def import_string(dotted_path): | ||||
|  | @ -190,7 +192,7 @@ class Config(dict): | |||
|         'TASK_LOG_KEEP_DAYS': 10, | ||||
|         'ASSETS_PERM_CACHE_TIME': 3600 * 24, | ||||
|         'SECURITY_MFA_VERIFY_TTL': 3600, | ||||
|         'ASSETS_PERM_CACHE_ENABLE': False, | ||||
|         'ASSETS_PERM_CACHE_ENABLE': HAS_XPACK, | ||||
|         'SYSLOG_ADDR': '',  # '192.168.0.1:514' | ||||
|         'SYSLOG_FACILITY': 'user', | ||||
|         'SYSLOG_SOCKTYPE': 2, | ||||
|  |  | |||
|  | @ -1,14 +1,7 @@ | |||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.conf import settings | ||||
| from django.apps import AppConfig | ||||
| 
 | ||||
| 
 | ||||
| class PermsConfig(AppConfig): | ||||
|     name = 'perms' | ||||
| 
 | ||||
|     def ready(self): | ||||
|         from . import signals_handler | ||||
|         if not settings.XPACK_ENABLED: | ||||
|             settings.ASSETS_PERM_CACHE_ENABLE = False | ||||
|         return super().ready() | ||||
|  |  | |||
|  | @ -301,7 +301,6 @@ class AssetPermissionUtil(AssetPermissionUtilCacheMixin): | |||
|                 continue | ||||
|             ancestors = self.full_tree.ancestors( | ||||
|                 child.identifier, with_self=False, deep=True, | ||||
|                 with_assets=False, | ||||
|             ) | ||||
|             if not ancestors: | ||||
|                 continue | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 老广
						老广