mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-06 18:00:57 +00:00
Perf (#2929)
* [Update] 优化性能 * [Update] 修改assets * [Update] 优化处理 * [Update] Youhua * [Update] 修改ungroup * [Update] 修改perms的api地址,去掉sysuser adminuser的可连接性 * [Update] 修改perms urls兼容 * [Update] 修改分类 * [Update] 修改信号 * [Update] 优化获取授权资产 * [Update] 添加注释 (#2928) * [update] 去掉nodes 的部分字段 * [Update] 删除不用的代码 * [Update] 拆分users * [Update] 修改用户的属性
This commit is contained in:
@@ -6,6 +6,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.utils import date_expired_default, set_or_append_attr_bulk
|
||||
from orgs.mixins import OrgModelMixin
|
||||
from assets.models import Asset, SystemUser, Node
|
||||
|
||||
from .base import BasePermission
|
||||
|
||||
@@ -85,7 +86,11 @@ class AssetPermission(BasePermission):
|
||||
|
||||
@classmethod
|
||||
def get_queryset_with_prefetch(cls):
|
||||
return cls.objects.all().valid().prefetch_related('nodes', 'assets', 'system_users')
|
||||
return cls.objects.all().valid().prefetch_related(
|
||||
models.Prefetch('nodes', queryset=Node.objects.all().only('key')),
|
||||
models.Prefetch('assets', queryset=Asset.objects.all().only('id')),
|
||||
models.Prefetch('system_users', queryset=SystemUser.objects.all().only('id'))
|
||||
)
|
||||
|
||||
def get_all_assets(self):
|
||||
assets = set(self.assets.all())
|
||||
|
Reference in New Issue
Block a user