perf: rename some workd

This commit is contained in:
ibuler 2025-04-08 18:59:52 +08:00 committed by 老广
parent 75ea0079a2
commit a7c514f8d8
10 changed files with 14 additions and 14 deletions

View File

@ -87,7 +87,7 @@ class BaseAccountSerializer(
"username": { "username": {
"help_text": _( "help_text": _(
"* If no username is required for authentication, enter null. " "* 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."
) )
}, },
} }

View File

@ -21,7 +21,7 @@ class VirtualAccountSerializer(serializers.ModelSerializer):
'username': {'label': _('Username')}, 'username': {'label': _('Username')},
'secret_from_login': { 'secret_from_login': {
'help_text': _( '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. <br/ >' 'Same account in asset secret > Login secret > Manual input. <br/ >'
'For security, please set config CACHE_LOGIN_PASSWORD_ENABLED to true' 'For security, please set config CACHE_LOGIN_PASSWORD_ENABLED to true'
) )

View File

@ -148,7 +148,7 @@ class AssetSerializer(BulkOrgResourceModelSerializer, ResourceLabelsMixin, Writa
accounts = AssetAccountSerializer(many=True, required=False, allow_null=True, write_only=True, label=_('Accounts')) 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")) nodes_display = NodeDisplaySerializer(read_only=False, required=False, label=_("Node path"))
platform = ObjectRelatedField(queryset=Platform.objects, required=True, label=_('Platform'), 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_amount = serializers.IntegerField(read_only=True, label=_('Accounts amount'))
_accounts = None _accounts = None

View File

@ -8,7 +8,7 @@ FILE_END_GUARD = ">>> Content End <<<"
celery_task_pre_key = "CELERY_" celery_task_pre_key = "CELERY_"
KEY_CACHE_RESOURCE_IDS = "RESOURCE_IDS_{}" 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 # https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties
LDAP_AD_ACCOUNT_DISABLE = 2 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}') 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}')

View File

@ -39,8 +39,8 @@ class TerminalSettingSerializer(serializers.Serializer):
help_text=_( help_text=_(
'* Allow users to log in to the KoKo component via Public key authentication' '* Allow users to log in to the KoKo component via Public key authentication'
'<br/>' '<br/>'
'If third-party authentication services, such as DS/LDAP, are enabled, you should ' '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 DS/LDAP server' 'disable this option to prevent users from logging in after being deleted from the AD/LDAP server'
) )
) )
TERMINAL_ASSET_LIST_SORT_BY = serializers.ChoiceField( TERMINAL_ASSET_LIST_SORT_BY = serializers.ChoiceField(

View File

@ -197,7 +197,7 @@ class LDAPServerUtil(object):
value = is_true(value) value = is_true(value)
if attr == 'groups' and mapping.lower() == 'memberof': if attr == 'groups' and mapping.lower() == 'memberof':
# DS: {'groups': 'memberOf'} # AD: {'groups': 'memberOf'}
if isinstance(value, str) and value: if isinstance(value, str) and value:
value = [value] value = [value]
if not isinstance(value, list): if not isinstance(value, list):
@ -366,7 +366,7 @@ class LDAPSyncUtil(object):
class LDAPImportUtil(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): def __init__(self, category=User.Source.ldap.value, is_sync_all=True):
self.category = category self.category = category
@ -399,7 +399,7 @@ class LDAPImportUtil(object):
continue continue
if not isinstance(group, str): if not isinstance(group, str):
continue 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 = group.split(',')[0].split('=')[-1]
group_name = f'{self.user_group_name_prefix}{group_name}'.strip() group_name = f'{self.user_group_name_prefix}{group_name}'.strip()
group_names.append(group_name) group_names.append(group_name)

View File

@ -81,7 +81,7 @@ class Migration(migrations.Migration):
models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date password last updated')), 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')), ('need_update_password', models.BooleanField(default=False, verbose_name='Need update password')),
('source', models.CharField( ('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'), ('radius', 'Radius'), ('cas', 'CAS'), ('saml2', 'SAML2'), ('oauth2', 'OAuth2'),
('wecom', 'WeCom'), ('dingtalk', 'DingTalk'), ('feishu', 'FeiShu'), ('lark', 'Lark'), ('wecom', 'WeCom'), ('dingtalk', 'DingTalk'), ('feishu', 'FeiShu'), ('lark', 'Lark'),
('slack', 'Slack'), ('custom', 'Custom')], default='local', max_length=30, ('slack', 'Slack'), ('custom', 'Custom')], default='local', max_length=30,

View File

@ -9,8 +9,8 @@ from django.utils.translation import gettext_lazy as _
class Source(models.TextChoices): class Source(models.TextChoices):
local = "local", _("Local") local = "local", _("Local")
ldap = "ldap", "LDAP/DS" ldap = "ldap", "LDAP/AD"
ldap_ha = "ldap_ha", "LDAP/DS (HA)" ldap_ha = "ldap_ha", "LDAP/AD (HA)"
openid = "openid", "OpenID" openid = "openid", "OpenID"
radius = "radius", "Radius" radius = "radius", "Radius"
cas = "cas", "CAS" cas = "cas", "CAS"

View File

@ -247,7 +247,7 @@ class UserSerializer(
}, },
"source": { "source": {
"help_text": _( "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." "There are security settings that can restrict users to log in to the system only from the sources."
), ),
}, },

View File

@ -53,7 +53,7 @@ REDIS_PORT: 6379
# REDIS_DB_CELERY: 3 # REDIS_DB_CELERY: 3
# REDIS_DB_CACHE: 4 # REDIS_DB_CACHE: 4
# LDAP/DS settings # LDAP/AD settings
# LDAP 搜索分页数量 # LDAP 搜索分页数量
# AUTH_LDAP_SEARCH_PAGED_SIZE: 1000 # AUTH_LDAP_SEARCH_PAGED_SIZE: 1000
# #