mirror of https://github.com/jumpserver/jumpserver
perf: 修改 org name
parent
8fe511cec6
commit
9f103a88d6
|
@ -63,21 +63,21 @@ def digest_sql_query():
|
||||||
path = current_request.get_full_path()
|
path = current_request.get_full_path()
|
||||||
|
|
||||||
print(">>>. [{}] {}".format(method, path))
|
print(">>>. [{}] {}".format(method, path))
|
||||||
for table_name, queries in table_queries.items():
|
# for table_name, queries in table_queries.items():
|
||||||
if table_name.startswith('rbac_') or table_name.startswith('auth_permission'):
|
# if table_name.startswith('rbac_') or table_name.startswith('auth_permission'):
|
||||||
continue
|
# continue
|
||||||
|
#
|
||||||
for query in queries:
|
# for query in queries:
|
||||||
sql = query['sql']
|
# sql = query['sql']
|
||||||
print(" # {}: {}".format(query['time'], sql[:1000]))
|
# print(" # {}: {}".format(query['time'], sql[:1000]))
|
||||||
if len(queries) < 3:
|
# if len(queries) < 3:
|
||||||
continue
|
# continue
|
||||||
print("- Table: {}".format(table_name))
|
# print("- Table: {}".format(table_name))
|
||||||
for i, query in enumerate(queries, 1):
|
# for i, query in enumerate(queries, 1):
|
||||||
sql = query['sql']
|
# sql = query['sql']
|
||||||
if not sql or not sql.startswith('SELECT'):
|
# if not sql or not sql.startswith('SELECT'):
|
||||||
continue
|
# continue
|
||||||
print('\t{}.[{}s] {}'.format(i, round(float(query['time']), 2), sql[:1000]))
|
# print('\t{}.[{}s] {}'.format(i, round(float(query['time']), 2), sql[:1000]))
|
||||||
|
|
||||||
# logger.debug(">>> [{}] {}".format(method, path))
|
# logger.debug(">>> [{}] {}".format(method, path))
|
||||||
for name, counter in counters:
|
for name, counter in counters:
|
||||||
|
|
|
@ -317,7 +317,7 @@
|
||||||
"CreateNode": "Create node",
|
"CreateNode": "Create node",
|
||||||
"CreatePlaybook": "Create playbook",
|
"CreatePlaybook": "Create playbook",
|
||||||
"CreateReplayStorage": "Create object storage",
|
"CreateReplayStorage": "Create object storage",
|
||||||
"CreateSuccessMsg": "Import successful, total: {count}",
|
"CreateSuccessMsg": "Successfully created !",
|
||||||
"CreateUserSetting": "User creation",
|
"CreateUserSetting": "User creation",
|
||||||
"Created": "Created",
|
"Created": "Created",
|
||||||
"CreatedBy": "Creator",
|
"CreatedBy": "Creator",
|
||||||
|
@ -377,8 +377,9 @@
|
||||||
"DeleteOrgTitle": "Please ensure the following information within the organization has been deleted",
|
"DeleteOrgTitle": "Please ensure the following information within the organization has been deleted",
|
||||||
"DeleteReleasedAssets": "Delete released assets",
|
"DeleteReleasedAssets": "Delete released assets",
|
||||||
"DeleteSelected": "Delete selected",
|
"DeleteSelected": "Delete selected",
|
||||||
"DeleteSuccess": "Delete successfully",
|
"DeleteSuccess": "Successfully deleted",
|
||||||
"DeleteSuccessMsg": "Delete successful",
|
"DeleteSuccessMsg": "Successfully deleted",
|
||||||
|
"ActivateSuccessMsg": "Successful activated",
|
||||||
"DeleteWarningMsg": "Are you sure you want to delete",
|
"DeleteWarningMsg": "Are you sure you want to delete",
|
||||||
"Deploy": "Deployment",
|
"Deploy": "Deployment",
|
||||||
"Description": "Description",
|
"Description": "Description",
|
||||||
|
@ -412,7 +413,7 @@
|
||||||
"Empty": "Empty",
|
"Empty": "Empty",
|
||||||
"Enable": "Enable",
|
"Enable": "Enable",
|
||||||
"EnableKoKoSSHHelpText": "When switched on, connecting to the asset will display ssh client pull-up method",
|
"EnableKoKoSSHHelpText": "When switched on, connecting to the asset will display ssh client pull-up method",
|
||||||
"Endpoint": "Service endpoint",
|
"Endpoint": "Service endpoints",
|
||||||
"EndpointListHelpMessage": "The service endpoint is the address (port) for users to access the service. when users connect to assets, they choose service endpoints based on endpoint rules and asset labels, using them as access points to establish connections and achieve distributed connections to assets",
|
"EndpointListHelpMessage": "The service endpoint is the address (port) for users to access the service. when users connect to assets, they choose service endpoints based on endpoint rules and asset labels, using them as access points to establish connections and achieve distributed connections to assets",
|
||||||
"EndpointRule": "Endpoint rules",
|
"EndpointRule": "Endpoint rules",
|
||||||
"EndpointRuleListHelpMessage": "For the server endpoint selection strategy, there are currently two options:<br>1、specify the endpoint according to the endpoint rule (current page);<br>2、choose the endpoint through asset labels, with the fixed label name being 'endpoint' and the value being the name of the endpoint.<br>the tag matching method is preferred for both methods, as the ip range may conflict, and the tag method exists as a supplement to the rules.",
|
"EndpointRuleListHelpMessage": "For the server endpoint selection strategy, there are currently two options:<br>1、specify the endpoint according to the endpoint rule (current page);<br>2、choose the endpoint through asset labels, with the fixed label name being 'endpoint' and the value being the name of the endpoint.<br>the tag matching method is preferred for both methods, as the ip range may conflict, and the tag method exists as a supplement to the rules.",
|
||||||
|
@ -552,6 +553,11 @@
|
||||||
"InputEmailAddress": "Please enter the correct email address",
|
"InputEmailAddress": "Please enter the correct email address",
|
||||||
"InputMessage": "Enter message...",
|
"InputMessage": "Enter message...",
|
||||||
"InputPhone": "Phone number",
|
"InputPhone": "Phone number",
|
||||||
|
"MIN_LENGTH_ERROR": "Passwords must be at least {0} characters.",
|
||||||
|
"UPPER_CASE_REQUIRED": "Must contain uppercase letters",
|
||||||
|
"LOWER_CASE_REQUIRED": "Must contain lowercase letters",
|
||||||
|
"NUMBER_REQUIRED": "Must contain numbers",
|
||||||
|
"SPECIAL_CHAR_REQUIRED": "Must contain special characters",
|
||||||
"InstanceAddress": "Instance address",
|
"InstanceAddress": "Instance address",
|
||||||
"InstanceName": "Instance name",
|
"InstanceName": "Instance name",
|
||||||
"InstancePlatformName": "Instance platform name",
|
"InstancePlatformName": "Instance platform name",
|
||||||
|
@ -721,7 +727,7 @@
|
||||||
"ObjectNotFoundOrDeletedMsg": "No corresponding resources found or it has been deleted.",
|
"ObjectNotFoundOrDeletedMsg": "No corresponding resources found or it has been deleted.",
|
||||||
"Offline": "Offline",
|
"Offline": "Offline",
|
||||||
"OfflineSelected": "Offline selected",
|
"OfflineSelected": "Offline selected",
|
||||||
"OfflineSuccessMsg": "Offline successfully",
|
"OfflineSuccessMsg": "Successfully offline",
|
||||||
"OfflineUpload": "Offline upload",
|
"OfflineUpload": "Offline upload",
|
||||||
"OldPassword": "Old password",
|
"OldPassword": "Old password",
|
||||||
"OldSSHKey": "Old ssh public key",
|
"OldSSHKey": "Old ssh public key",
|
||||||
|
@ -957,7 +963,7 @@
|
||||||
"Saturday": "Sat",
|
"Saturday": "Sat",
|
||||||
"Save": "Save",
|
"Save": "Save",
|
||||||
"SaveAdhoc": "Save command",
|
"SaveAdhoc": "Save command",
|
||||||
"SaveAndAddAnother": "Save & continue",
|
"SaveAndAddAnother": "Save & Continue",
|
||||||
"SaveCommand": "Save command",
|
"SaveCommand": "Save command",
|
||||||
"SaveCommandSuccess": "Command saved successfully",
|
"SaveCommandSuccess": "Command saved successfully",
|
||||||
"SaveSetting": "Synchronization settings",
|
"SaveSetting": "Synchronization settings",
|
||||||
|
@ -1199,7 +1205,7 @@
|
||||||
"UpdateSSHKey": "Change ssh public key",
|
"UpdateSSHKey": "Change ssh public key",
|
||||||
"NewSSHKey": "New SSH Key",
|
"NewSSHKey": "New SSH Key",
|
||||||
"UpdateSelected": "Update selected",
|
"UpdateSelected": "Update selected",
|
||||||
"UpdateSuccessMsg": "Update successful",
|
"UpdateSuccessMsg": "Successfully updated !",
|
||||||
"Updated": "Updated",
|
"Updated": "Updated",
|
||||||
"Upload": "Upload",
|
"Upload": "Upload",
|
||||||
"UploadCsvLth10MHelpText": "Only csv/xlsx can be uploaded, and no more than 10m",
|
"UploadCsvLth10MHelpText": "Only csv/xlsx can be uploaded, and no more than 10m",
|
||||||
|
@ -1213,7 +1219,7 @@
|
||||||
"UseProtocol": "User agreement",
|
"UseProtocol": "User agreement",
|
||||||
"UseSSL": "Use ssl/tls",
|
"UseSSL": "Use ssl/tls",
|
||||||
"User": "User",
|
"User": "User",
|
||||||
"UserAclLists": "Login acls",
|
"UserAclLists": "Login ACLs",
|
||||||
"UserAssetActivity": "User/asset activity",
|
"UserAssetActivity": "User/asset activity",
|
||||||
"UserCreate": "Create user",
|
"UserCreate": "Create user",
|
||||||
"UserData": "User",
|
"UserData": "User",
|
||||||
|
|
|
@ -367,6 +367,7 @@
|
||||||
"Download": "下载",
|
"Download": "下载",
|
||||||
"DownloadCenter": "下载中心",
|
"DownloadCenter": "下载中心",
|
||||||
"DownloadFTPFileTip": "当前动作不记录文件,或者文件大小超过阈值(默认100M),或者还未保存到对应存储中",
|
"DownloadFTPFileTip": "当前动作不记录文件,或者文件大小超过阈值(默认100M),或者还未保存到对应存储中",
|
||||||
|
"MinLengthError": "密码最少有 {0} 位",
|
||||||
"DownloadImportTemplateMsg": "下载创建模板",
|
"DownloadImportTemplateMsg": "下载创建模板",
|
||||||
"DownloadReplay": "下载录像",
|
"DownloadReplay": "下载录像",
|
||||||
"DownloadUpdateTemplateMsg": "下载更新模板",
|
"DownloadUpdateTemplateMsg": "下载更新模板",
|
||||||
|
@ -1228,5 +1229,4 @@
|
||||||
"AccessKeys": "访问密钥",
|
"AccessKeys": "访问密钥",
|
||||||
"InformationModification": "信息更改",
|
"InformationModification": "信息更改",
|
||||||
"Phone": "手机"
|
"Phone": "手机"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ default_id = '00000000-0000-0000-0000-000000000002'
|
||||||
|
|
||||||
def add_default_org(apps, schema_editor):
|
def add_default_org(apps, schema_editor):
|
||||||
org_cls = apps.get_model('orgs', 'Organization')
|
org_cls = apps.get_model('orgs', 'Organization')
|
||||||
defaults = {'name': 'Default', 'id': default_id}
|
defaults = {'name': 'DEFAULT', 'id': default_id, 'builtin': True}
|
||||||
org_cls.objects.get_or_create(defaults=defaults, id=default_id)
|
org_cls.objects.get_or_create(defaults=defaults, id=default_id)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,10 +20,6 @@ def update_builtin_org(apps, schema_editor):
|
||||||
name='SYSTEM', builtin=True
|
name='SYSTEM', builtin=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# 更新 Default
|
|
||||||
org_model.objects.filter(name='DEFAULT').update(builtin=True)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
@ -42,12 +41,15 @@ def default_org_roles():
|
||||||
class RolesSerializerMixin(serializers.Serializer):
|
class RolesSerializerMixin(serializers.Serializer):
|
||||||
system_roles = ObjectRelatedField(
|
system_roles = ObjectRelatedField(
|
||||||
queryset=Role.system_roles, attrs=('id', 'display_name'),
|
queryset=Role.system_roles, attrs=('id', 'display_name'),
|
||||||
label=_("System roles"), many=True, default=default_system_roles
|
label=_("System roles"), many=True, default=default_system_roles,
|
||||||
|
help_text=_("System roles are roles at the system level, and they will take effect across all organizations")
|
||||||
)
|
)
|
||||||
org_roles = ObjectRelatedField(
|
org_roles = ObjectRelatedField(
|
||||||
queryset=Role.org_roles, attrs=('id', 'display_name', 'name'),
|
queryset=Role.org_roles, attrs=('id', 'display_name', 'name'),
|
||||||
label=_("Org roles"), many=True, required=False,
|
label=_("Org roles"), many=True, required=False,
|
||||||
default=default_org_roles
|
default=default_org_roles,
|
||||||
|
help_text=_(
|
||||||
|
"Org roles are roles at the organization level, and they will only take effect within current organization")
|
||||||
)
|
)
|
||||||
orgs_roles = serializers.JSONField(read_only=True, label=_("Organizations and roles"))
|
orgs_roles = serializers.JSONField(read_only=True, label=_("Organizations and roles"))
|
||||||
|
|
||||||
|
@ -189,6 +191,10 @@ class UserSerializer(RolesSerializerMixin, ResourceLabelsMixin, CommonBulkModelS
|
||||||
'mfa_level': {'label': _("MFA level")},
|
'mfa_level': {'label': _("MFA level")},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.update_source_choices()
|
||||||
|
|
||||||
def get_fields(self):
|
def get_fields(self):
|
||||||
fields = super().get_fields()
|
fields = super().get_fields()
|
||||||
self.pop_fields_if_need(fields)
|
self.pop_fields_if_need(fields)
|
||||||
|
@ -200,6 +206,15 @@ class UserSerializer(RolesSerializerMixin, ResourceLabelsMixin, CommonBulkModelS
|
||||||
for f in self.Meta.fields_only_root_org:
|
for f in self.Meta.fields_only_root_org:
|
||||||
fields.pop(f, None)
|
fields.pop(f, None)
|
||||||
|
|
||||||
|
def update_source_choices(self):
|
||||||
|
source = self.fields.get("source")
|
||||||
|
if not source:
|
||||||
|
return
|
||||||
|
open_source = ['local', 'ldap', 'cas']
|
||||||
|
# if not settings.XPACK_ENABLED:
|
||||||
|
choices = {k: v for k, v in source.choices.items() if k in open_source}
|
||||||
|
source.choices = list(choices.items())
|
||||||
|
|
||||||
def validate_password(self, password):
|
def validate_password(self, password):
|
||||||
password_strategy = self.initial_data.get("password_strategy")
|
password_strategy = self.initial_data.get("password_strategy")
|
||||||
if self.instance is None and password_strategy != PasswordStrategy.custom:
|
if self.instance is None and password_strategy != PasswordStrategy.custom:
|
||||||
|
|
Loading…
Reference in New Issue