mirror of https://github.com/jumpserver/jumpserver
parent
60399fae29
commit
68707085fa
|
@ -124,6 +124,8 @@ TASK_LOG_KEEP_DAYS = CONFIG.TASK_LOG_KEEP_DAYS
|
||||||
OPERATE_LOG_KEEP_DAYS = CONFIG.OPERATE_LOG_KEEP_DAYS
|
OPERATE_LOG_KEEP_DAYS = CONFIG.OPERATE_LOG_KEEP_DAYS
|
||||||
ACTIVITY_LOG_KEEP_DAYS = CONFIG.ACTIVITY_LOG_KEEP_DAYS
|
ACTIVITY_LOG_KEEP_DAYS = CONFIG.ACTIVITY_LOG_KEEP_DAYS
|
||||||
FTP_LOG_KEEP_DAYS = CONFIG.FTP_LOG_KEEP_DAYS
|
FTP_LOG_KEEP_DAYS = CONFIG.FTP_LOG_KEEP_DAYS
|
||||||
|
CLOUD_SYNC_TASK_EXECUTION_KEEP_DAYS = CONFIG.CLOUD_SYNC_TASK_EXECUTION_KEEP_DAYS
|
||||||
|
|
||||||
ORG_CHANGE_TO_URL = CONFIG.ORG_CHANGE_TO_URL
|
ORG_CHANGE_TO_URL = CONFIG.ORG_CHANGE_TO_URL
|
||||||
WINDOWS_SKIP_ALL_MANUAL_PASSWORD = CONFIG.WINDOWS_SKIP_ALL_MANUAL_PASSWORD
|
WINDOWS_SKIP_ALL_MANUAL_PASSWORD = CONFIG.WINDOWS_SKIP_ALL_MANUAL_PASSWORD
|
||||||
|
|
||||||
|
@ -159,8 +161,6 @@ SECURITY_SESSION_SHARE = CONFIG.SECURITY_SESSION_SHARE
|
||||||
LOGIN_REDIRECT_TO_BACKEND = CONFIG.LOGIN_REDIRECT_TO_BACKEND
|
LOGIN_REDIRECT_TO_BACKEND = CONFIG.LOGIN_REDIRECT_TO_BACKEND
|
||||||
LOGIN_REDIRECT_MSG_ENABLED = CONFIG.LOGIN_REDIRECT_MSG_ENABLED
|
LOGIN_REDIRECT_MSG_ENABLED = CONFIG.LOGIN_REDIRECT_MSG_ENABLED
|
||||||
|
|
||||||
CLOUD_SYNC_TASK_EXECUTION_KEEP_DAYS = CONFIG.CLOUD_SYNC_TASK_EXECUTION_KEEP_DAYS
|
|
||||||
|
|
||||||
TERMINAL_RAZOR_ENABLED = CONFIG.TERMINAL_RAZOR_ENABLED
|
TERMINAL_RAZOR_ENABLED = CONFIG.TERMINAL_RAZOR_ENABLED
|
||||||
TERMINAL_OMNIDB_ENABLED = CONFIG.TERMINAL_OMNIDB_ENABLED
|
TERMINAL_OMNIDB_ENABLED = CONFIG.TERMINAL_OMNIDB_ENABLED
|
||||||
TERMINAL_MAGNUS_ENABLED = CONFIG.TERMINAL_MAGNUS_ENABLED
|
TERMINAL_MAGNUS_ENABLED = CONFIG.TERMINAL_MAGNUS_ENABLED
|
||||||
|
@ -204,3 +204,14 @@ MAX_LIMIT_PER_PAGE = CONFIG.MAX_LIMIT_PER_PAGE
|
||||||
# Magnus DB Port
|
# Magnus DB Port
|
||||||
MAGNUS_ORACLE_PORTS = CONFIG.MAGNUS_ORACLE_PORTS
|
MAGNUS_ORACLE_PORTS = CONFIG.MAGNUS_ORACLE_PORTS
|
||||||
LIMIT_SUPER_PRIV = CONFIG.LIMIT_SUPER_PRIV
|
LIMIT_SUPER_PRIV = CONFIG.LIMIT_SUPER_PRIV
|
||||||
|
|
||||||
|
LOG_NAMES = [
|
||||||
|
'LOGIN_LOG_KEEP_DAYS', 'TASK_LOG_KEEP_DAYS',
|
||||||
|
'OPERATE_LOG_KEEP_DAYS', 'FTP_LOG_KEEP_DAYS',
|
||||||
|
'CLOUD_SYNC_TASK_EXECUTION_KEEP_DAYS',
|
||||||
|
'ACTIVITY_LOG_KEEP_DAYS', 'TERMINAL_SESSION_KEEP_DURATION'
|
||||||
|
]
|
||||||
|
if LIMIT_SUPER_PRIV:
|
||||||
|
for name in LOG_NAMES:
|
||||||
|
if globals()[name] < 180:
|
||||||
|
globals()[name] = 180
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
from rest_framework.serializers import ValidationError
|
||||||
|
|
||||||
__all__ = ['CleaningSerializer']
|
__all__ = ['CleaningSerializer']
|
||||||
|
|
||||||
|
@ -27,12 +29,27 @@ class CleaningSerializer(serializers.Serializer):
|
||||||
min_value=1, max_value=9999,
|
min_value=1, max_value=9999,
|
||||||
label=_("Cloud sync record keep days (day)"),
|
label=_("Cloud sync record keep days (day)"),
|
||||||
)
|
)
|
||||||
|
ACTIVITY_LOG_KEEP_DAYS = serializers.IntegerField(
|
||||||
|
min_value=1, max_value=9999,
|
||||||
|
label=_("Activity log keep days (day)"),
|
||||||
|
)
|
||||||
TERMINAL_SESSION_KEEP_DURATION = serializers.IntegerField(
|
TERMINAL_SESSION_KEEP_DURATION = serializers.IntegerField(
|
||||||
min_value=1, max_value=99999, required=True, label=_('Session keep duration (day)'),
|
min_value=1, max_value=99999, required=True, label=_('Session keep duration (day)'),
|
||||||
help_text=_(
|
help_text=_(
|
||||||
'Session, record, command will be delete if more than duration, only in database, OSS will not be affected.')
|
'Session, record, command will be delete if more than duration, only in database, OSS will not be affected.')
|
||||||
)
|
)
|
||||||
ACTIVITY_LOG_KEEP_DAYS = serializers.IntegerField(
|
MIN_DAYS_THRESHOLD = 180
|
||||||
min_value=1, max_value=9999,
|
|
||||||
label=_("Activity log keep days (day)"),
|
def validate(self, attrs):
|
||||||
)
|
attrs = super().validate(attrs)
|
||||||
|
if not settings.LIMIT_SUPER_PRIV:
|
||||||
|
return attrs
|
||||||
|
|
||||||
|
error_names = [
|
||||||
|
name for name in settings.LOG_NAMES
|
||||||
|
if attrs.get(name, 0) < self.MIN_DAYS_THRESHOLD
|
||||||
|
]
|
||||||
|
if error_names:
|
||||||
|
error_message = _('must be greater than {} days.').format(self.MIN_DAYS_THRESHOLD)
|
||||||
|
raise ValidationError({name: error_message for name in error_names})
|
||||||
|
return attrs
|
||||||
|
|
Loading…
Reference in New Issue