2023-07-24 03:52:25 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2021-09-09 06:00:50 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
|
|
|
|
class TerminalSettingSerializer(serializers.Serializer):
|
2022-11-04 06:22:38 +00:00
|
|
|
PREFIX_TITLE = _('Terminal')
|
|
|
|
|
2021-09-09 06:00:50 +00:00
|
|
|
SORT_BY_CHOICES = (
|
2022-08-11 07:45:03 +00:00
|
|
|
('name', _('Hostname')),
|
2021-09-09 06:00:50 +00:00
|
|
|
('ip', _('IP'))
|
|
|
|
)
|
|
|
|
|
|
|
|
PAGE_SIZE_CHOICES = (
|
|
|
|
('all', _('All')),
|
|
|
|
('auto', _('Auto')),
|
|
|
|
('10', '10'),
|
|
|
|
('15', '15'),
|
|
|
|
('25', '25'),
|
|
|
|
('50', '50'),
|
|
|
|
)
|
2023-08-15 05:45:44 +00:00
|
|
|
SECURITY_SERVICE_ACCOUNT_REGISTRATION = serializers.BooleanField(
|
|
|
|
required=True, label=_('Enable terminal register'),
|
|
|
|
help_text=_(
|
|
|
|
"Allow terminal register, after all terminal setup, you should disable this for security"
|
|
|
|
)
|
|
|
|
)
|
2021-09-09 06:00:50 +00:00
|
|
|
TERMINAL_PASSWORD_AUTH = serializers.BooleanField(required=False, label=_('Password auth'))
|
|
|
|
TERMINAL_PUBLIC_KEY_AUTH = serializers.BooleanField(
|
|
|
|
required=False, label=_('Public key auth'),
|
|
|
|
help_text=_('Tips: If use other auth method, like AD/LDAP, you should disable this to '
|
|
|
|
'avoid being able to log in after deleting')
|
|
|
|
)
|
2022-03-25 06:45:08 +00:00
|
|
|
TERMINAL_ASSET_LIST_SORT_BY = serializers.ChoiceField(
|
|
|
|
SORT_BY_CHOICES, required=False, label=_('List sort by')
|
|
|
|
)
|
|
|
|
TERMINAL_ASSET_LIST_PAGE_SIZE = serializers.ChoiceField(
|
|
|
|
PAGE_SIZE_CHOICES, required=False, label=_('List page size')
|
|
|
|
)
|
|
|
|
TERMINAL_MAGNUS_ENABLED = serializers.BooleanField(label=_("Enable database proxy"))
|
2022-06-06 10:04:11 +00:00
|
|
|
TERMINAL_RAZOR_ENABLED = serializers.BooleanField(label=_("Enable Razor"))
|
2022-04-27 14:56:34 +00:00
|
|
|
TERMINAL_KOKO_SSH_ENABLED = serializers.BooleanField(label=_("Enable SSH Client"))
|