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 = (
|
2024-02-27 08:43:44 +00:00
|
|
|
('name', _('Name')),
|
|
|
|
('ip', _('Address'))
|
2021-09-09 06:00:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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(
|
2024-02-27 08:43:44 +00:00
|
|
|
required=True, label=_('Terminal registration'),
|
2023-08-15 05:45:44 +00:00
|
|
|
help_text=_(
|
|
|
|
"Allow terminal register, after all terminal setup, you should disable this for security"
|
|
|
|
)
|
|
|
|
)
|
2024-02-27 08:43:44 +00:00
|
|
|
TERMINAL_PASSWORD_AUTH = serializers.BooleanField(required=False, label=_("Password auth"))
|
2021-09-09 06:00:50 +00:00
|
|
|
TERMINAL_PUBLIC_KEY_AUTH = serializers.BooleanField(
|
2024-02-28 09:32:29 +00:00
|
|
|
required=False, label=_("Public key auth"),
|
2024-02-27 08:43:44 +00:00
|
|
|
help_text=_('Information: If use other auth method, like AD/LDAP, you should disable this to '
|
2021-09-09 06:00:50 +00:00
|
|
|
'avoid being able to log in after deleting')
|
|
|
|
)
|
2022-03-25 06:45:08 +00:00
|
|
|
TERMINAL_ASSET_LIST_SORT_BY = serializers.ChoiceField(
|
2024-02-27 08:43:44 +00:00
|
|
|
SORT_BY_CHOICES, required=False, label=_('Asset list sorting')
|
2022-03-25 06:45:08 +00:00
|
|
|
)
|
|
|
|
TERMINAL_ASSET_LIST_PAGE_SIZE = serializers.ChoiceField(
|
2024-02-27 08:43:44 +00:00
|
|
|
PAGE_SIZE_CHOICES, required=False, label=_('Asset list page size')
|
2022-03-25 06:45:08 +00:00
|
|
|
)
|
2024-02-27 08:43:44 +00:00
|
|
|
TERMINAL_MAGNUS_ENABLED = serializers.BooleanField(label="Magnus")
|
|
|
|
TERMINAL_RAZOR_ENABLED = serializers.BooleanField(label="Razor")
|
|
|
|
TERMINAL_KOKO_SSH_ENABLED = serializers.BooleanField(label="Koko")
|