perf: 优化 xpack license 检查 (#11885)

Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
fit2bot
2023-10-18 14:10:24 +08:00
committed by GitHub
parent f088bbce12
commit d3a283232f
10 changed files with 24 additions and 39 deletions

View File

@@ -5,7 +5,6 @@ from rest_framework.permissions import AllowAny
from authentication.permissions import IsValidUserOrConnectionToken
from common.utils import get_logger, lazyproperty
from common.utils.timezone import local_now
from jumpserver.utils import has_valid_xpack_license, get_xpack_license_info
from .. import serializers
from ..utils import get_interface_setting_or_default
@@ -36,8 +35,8 @@ class PublicSettingApi(OpenPublicSettingApi):
def get_object(self):
values = super().get_object()
values.update({
"XPACK_LICENSE_IS_VALID": has_valid_xpack_license(),
"XPACK_LICENSE_INFO": get_xpack_license_info(),
"XPACK_LICENSE_IS_VALID": settings.XPACK_LICENSE_IS_VALID,
"XPACK_LICENSE_INFO": settings.XPACK_LICENSE_INFO,
"PASSWORD_RULE": {
'SECURITY_PASSWORD_MIN_LENGTH': settings.SECURITY_PASSWORD_MIN_LENGTH,
'SECURITY_ADMIN_USER_PASSWORD_MIN_LENGTH': settings.SECURITY_ADMIN_USER_PASSWORD_MIN_LENGTH,