From a7c514f8d81df3a6602136f76e5f8e27c064fbdc Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 8 Apr 2025 18:59:52 +0800 Subject: [PATCH] perf: rename some workd --- apps/accounts/serializers/account/base.py | 2 +- apps/accounts/serializers/account/virtual.py | 2 +- apps/assets/serializers/asset/common.py | 2 +- apps/common/const/common.py | 2 +- apps/settings/serializers/terminal.py | 4 ++-- apps/settings/utils/ldap.py | 6 +++--- apps/users/migrations/0001_initial.py | 2 +- apps/users/models/user/_source.py | 4 ++-- apps/users/serializers/user.py | 2 +- config_example.yml | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/accounts/serializers/account/base.py b/apps/accounts/serializers/account/base.py index 4270a1bb4..a6eacd83b 100644 --- a/apps/accounts/serializers/account/base.py +++ b/apps/accounts/serializers/account/base.py @@ -87,7 +87,7 @@ class BaseAccountSerializer( "username": { "help_text": _( "* If no username is required for authentication, enter null. " - "For DS accounts, use the format username@domain." + "For AD accounts, use the format username@domain." ) }, } diff --git a/apps/accounts/serializers/account/virtual.py b/apps/accounts/serializers/account/virtual.py index 5f6ea493a..a1d107b20 100644 --- a/apps/accounts/serializers/account/virtual.py +++ b/apps/accounts/serializers/account/virtual.py @@ -21,7 +21,7 @@ class VirtualAccountSerializer(serializers.ModelSerializer): 'username': {'label': _('Username')}, 'secret_from_login': { 'help_text': _( - 'Current only support login from DS/LDAP. Secret priority: ' + 'Current only support login from AD/LDAP. Secret priority: ' 'Same account in asset secret > Login secret > Manual input.
' 'For security, please set config CACHE_LOGIN_PASSWORD_ENABLED to true' ) diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 57642fda5..d41970c0c 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -148,7 +148,7 @@ class AssetSerializer(BulkOrgResourceModelSerializer, ResourceLabelsMixin, Writa accounts = AssetAccountSerializer(many=True, required=False, allow_null=True, write_only=True, label=_('Accounts')) nodes_display = NodeDisplaySerializer(read_only=False, required=False, label=_("Node path")) platform = ObjectRelatedField(queryset=Platform.objects, required=True, label=_('Platform'), - attrs=('id', 'name', 'type', 'ad_id')) + attrs=('id', 'name', 'type')) accounts_amount = serializers.IntegerField(read_only=True, label=_('Accounts amount')) _accounts = None diff --git a/apps/common/const/common.py b/apps/common/const/common.py index 8374f0016..ab149fef5 100644 --- a/apps/common/const/common.py +++ b/apps/common/const/common.py @@ -8,7 +8,7 @@ FILE_END_GUARD = ">>> Content End <<<" celery_task_pre_key = "CELERY_" KEY_CACHE_RESOURCE_IDS = "RESOURCE_IDS_{}" -# DS User AccountDisable +# AD User AccountDisable # https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties LDAP_AD_ACCOUNT_DISABLE = 2 UUID_PATTERN = re.compile(r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}') diff --git a/apps/settings/serializers/terminal.py b/apps/settings/serializers/terminal.py index d672bf0bc..5d51425a4 100644 --- a/apps/settings/serializers/terminal.py +++ b/apps/settings/serializers/terminal.py @@ -39,8 +39,8 @@ class TerminalSettingSerializer(serializers.Serializer): help_text=_( '* Allow users to log in to the KoKo component via Public key authentication' '
' - 'If third-party authentication services, such as DS/LDAP, are enabled, you should ' - 'disable this option to prevent users from logging in after being deleted from the DS/LDAP server' + 'If third-party authentication services, such as AD/LDAP, are enabled, you should ' + 'disable this option to prevent users from logging in after being deleted from the AD/LDAP server' ) ) TERMINAL_ASSET_LIST_SORT_BY = serializers.ChoiceField( diff --git a/apps/settings/utils/ldap.py b/apps/settings/utils/ldap.py index 9df5df2c9..24311adab 100644 --- a/apps/settings/utils/ldap.py +++ b/apps/settings/utils/ldap.py @@ -197,7 +197,7 @@ class LDAPServerUtil(object): value = is_true(value) if attr == 'groups' and mapping.lower() == 'memberof': - # DS: {'groups': 'memberOf'} + # AD: {'groups': 'memberOf'} if isinstance(value, str) and value: value = [value] if not isinstance(value, list): @@ -366,7 +366,7 @@ class LDAPSyncUtil(object): class LDAPImportUtil(object): - user_group_name_prefix = 'DS ' + user_group_name_prefix = 'AD ' def __init__(self, category=User.Source.ldap.value, is_sync_all=True): self.category = category @@ -399,7 +399,7 @@ class LDAPImportUtil(object): continue if not isinstance(group, str): continue - # get group name for DS, Such as: CN=Users,CN=Builtin,DC=jms,DC=com + # get group name for AD, Such as: CN=Users,CN=Builtin,DC=jms,DC=com group_name = group.split(',')[0].split('=')[-1] group_name = f'{self.user_group_name_prefix}{group_name}'.strip() group_names.append(group_name) diff --git a/apps/users/migrations/0001_initial.py b/apps/users/migrations/0001_initial.py index 11b76779c..5b47304b2 100644 --- a/apps/users/migrations/0001_initial.py +++ b/apps/users/migrations/0001_initial.py @@ -81,7 +81,7 @@ class Migration(migrations.Migration): models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date password last updated')), ('need_update_password', models.BooleanField(default=False, verbose_name='Need update password')), ('source', models.CharField( - choices=[('local', 'Local'), ('ldap', 'LDAP/DS'), ('ldap_ha', 'LDAP/DS (HA)'), ('openid', 'OpenID'), + choices=[('local', 'Local'), ('ldap', 'LDAP/AD'), ('ldap_ha', 'LDAP/AD (HA)'), ('openid', 'OpenID'), ('radius', 'Radius'), ('cas', 'CAS'), ('saml2', 'SAML2'), ('oauth2', 'OAuth2'), ('wecom', 'WeCom'), ('dingtalk', 'DingTalk'), ('feishu', 'FeiShu'), ('lark', 'Lark'), ('slack', 'Slack'), ('custom', 'Custom')], default='local', max_length=30, diff --git a/apps/users/models/user/_source.py b/apps/users/models/user/_source.py index adb25c410..e7e0dd21f 100644 --- a/apps/users/models/user/_source.py +++ b/apps/users/models/user/_source.py @@ -9,8 +9,8 @@ from django.utils.translation import gettext_lazy as _ class Source(models.TextChoices): local = "local", _("Local") - ldap = "ldap", "LDAP/DS" - ldap_ha = "ldap_ha", "LDAP/DS (HA)" + ldap = "ldap", "LDAP/AD" + ldap_ha = "ldap_ha", "LDAP/AD (HA)" openid = "openid", "OpenID" radius = "radius", "Radius" cas = "cas", "CAS" diff --git a/apps/users/serializers/user.py b/apps/users/serializers/user.py index 255b1799b..e494234c9 100644 --- a/apps/users/serializers/user.py +++ b/apps/users/serializers/user.py @@ -247,7 +247,7 @@ class UserSerializer( }, "source": { "help_text": _( - "User source identifies where the user was created, which could be DS or other sources." + "User source identifies where the user was created, which could be AD or other sources." "There are security settings that can restrict users to log in to the system only from the sources." ), }, diff --git a/config_example.yml b/config_example.yml index 8afa73458..989995e59 100644 --- a/config_example.yml +++ b/config_example.yml @@ -53,7 +53,7 @@ REDIS_PORT: 6379 # REDIS_DB_CELERY: 3 # REDIS_DB_CACHE: 4 -# LDAP/DS settings +# LDAP/AD settings # LDAP 搜索分页数量 # AUTH_LDAP_SEARCH_PAGED_SIZE: 1000 #