mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-22 20:09:54 +00:00
perf: 优化org获取逻辑 - 采用redis订阅机制实现orgs_mapping数据的维护;删除get_org_by_id等方法;
perf: 优化get_instance接口
This commit is contained in:
@@ -7,8 +7,7 @@ from django.core.exceptions import ValidationError
|
||||
|
||||
from common.utils import get_logger
|
||||
from ..utils import (
|
||||
set_current_org, get_current_org, current_org,
|
||||
filter_org_queryset, get_org_by_id, get_org_name_by_id
|
||||
set_current_org, get_current_org, current_org, filter_org_queryset
|
||||
)
|
||||
from ..models import Organization
|
||||
|
||||
@@ -59,11 +58,11 @@ class OrgModelMixin(models.Model):
|
||||
|
||||
@property
|
||||
def org(self):
|
||||
return get_org_by_id(self.org_id)
|
||||
return Organization.get_instance(self.org_id)
|
||||
|
||||
@property
|
||||
def org_name(self):
|
||||
return get_org_name_by_id(self.org_id)
|
||||
return self.org.name
|
||||
|
||||
@property
|
||||
def fullname(self, attr=None):
|
||||
|
Reference in New Issue
Block a user