jumpserver/apps/settings/serializers/cleaning.py

50 lines
1.9 KiB
Python
Raw Normal View History

from django.conf import settings
2023-07-24 03:52:25 +00:00
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
__all__ = ['CleaningSerializer']
MIN_VALUE = 180 if settings.LIMIT_SUPER_PRIV else 1
class CleaningSerializer(serializers.Serializer):
PREFIX_TITLE = _('Period clean')
LOGIN_LOG_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
2024-03-07 09:29:03 +00:00
label=_("Login log retention days (day)"),
)
TASK_LOG_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
2024-03-07 09:29:03 +00:00
label=_("Task log retention days (day)"),
)
OPERATE_LOG_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
2024-03-07 09:29:03 +00:00
label=_("Operate log retention days (day)"),
)
PASSWORD_CHANGE_LOG_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
label=_("password change log keep days (day)"),
)
FTP_LOG_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
2024-03-07 09:29:03 +00:00
label=_("FTP log retention days (day)"),
)
CLOUD_SYNC_TASK_EXECUTION_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
2024-03-07 09:29:03 +00:00
label=_("Cloud sync task history retention days (day)"),
)
JOB_EXECUTION_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
2024-03-07 09:29:03 +00:00
label=_("job execution retention days (day)"),
)
ACTIVITY_LOG_KEEP_DAYS = serializers.IntegerField(
min_value=MIN_VALUE, max_value=9999,
2024-03-07 09:29:03 +00:00
label=_("Activity log retention days (day)"),
)
TERMINAL_SESSION_KEEP_DURATION = serializers.IntegerField(
2024-03-07 09:29:03 +00:00
min_value=MIN_VALUE, max_value=99999, required=True, label=_('Session log retention days (day)'),
2023-07-24 03:52:25 +00:00
help_text=_(
'Session, record, command will be delete if more than duration, only in database, OSS will not be affected.')
)