mirror of https://github.com/jumpserver/jumpserver
Merge branch 'dev' of https://github.com/jumpserver/jumpserver into dev
commit
afa515d570
|
@ -65,7 +65,7 @@ class AssetByNodeFilterBackend(filters.BaseFilterBackend):
|
||||||
|
|
||||||
|
|
||||||
class LabelFilterBackend(filters.BaseFilterBackend):
|
class LabelFilterBackend(filters.BaseFilterBackend):
|
||||||
sep = '#'
|
sep = ':'
|
||||||
query_arg = 'label'
|
query_arg = 'label'
|
||||||
|
|
||||||
def get_schema_fields(self, view):
|
def get_schema_fields(self, view):
|
||||||
|
@ -84,6 +84,8 @@ class LabelFilterBackend(filters.BaseFilterBackend):
|
||||||
|
|
||||||
q = None
|
q = None
|
||||||
for kv in labels_query:
|
for kv in labels_query:
|
||||||
|
if '#' in kv:
|
||||||
|
self.sep = '#'
|
||||||
if self.sep not in kv:
|
if self.sep not in kv:
|
||||||
continue
|
continue
|
||||||
key, value = kv.strip().split(self.sep)[:2]
|
key, value = kv.strip().split(self.sep)[:2]
|
||||||
|
|
|
@ -87,6 +87,7 @@ if settings.DEBUG:
|
||||||
|
|
||||||
# 兼容之前的
|
# 兼容之前的
|
||||||
old_app_pattern = '|'.join(apps)
|
old_app_pattern = '|'.join(apps)
|
||||||
|
old_app_pattern = r'^{}'.format(old_app_pattern)
|
||||||
urlpatterns += [re_path(old_app_pattern, views.redirect_old_apps_view)]
|
urlpatterns += [re_path(old_app_pattern, views.redirect_old_apps_view)]
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: JumpServer 0.3.3\n"
|
"Project-Id-Version: JumpServer 0.3.3\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2020-06-15 20:30+0800\n"
|
"POT-Creation-Date: 2020-06-16 11:02+0800\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
||||||
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
||||||
|
@ -2720,6 +2720,14 @@ msgstr "角色只能为 {}"
|
||||||
msgid "Password does not match security rules"
|
msgid "Password does not match security rules"
|
||||||
msgstr "密码不满足安全规则"
|
msgstr "密码不满足安全规则"
|
||||||
|
|
||||||
|
#: users/serializers/user.py:274
|
||||||
|
msgid "The old password is incorrect"
|
||||||
|
msgstr "旧密码错误"
|
||||||
|
|
||||||
|
#: users/serializers/user.py:288
|
||||||
|
msgid "The newly set password is inconsistent"
|
||||||
|
msgstr "两次密码不一致"
|
||||||
|
|
||||||
#: users/serializers_v2/user.py:36
|
#: users/serializers_v2/user.py:36
|
||||||
msgid "name not unique"
|
msgid "name not unique"
|
||||||
msgstr "名称重复"
|
msgstr "名称重复"
|
||||||
|
|
|
@ -275,7 +275,14 @@ class PublicSettingApi(generics.RetrieveAPIView):
|
||||||
"LOGIN_CONFIRM_ENABLE": settings.LOGIN_CONFIRM_ENABLE,
|
"LOGIN_CONFIRM_ENABLE": settings.LOGIN_CONFIRM_ENABLE,
|
||||||
"SECURITY_VIEW_AUTH_NEED_MFA": settings.SECURITY_VIEW_AUTH_NEED_MFA,
|
"SECURITY_VIEW_AUTH_NEED_MFA": settings.SECURITY_VIEW_AUTH_NEED_MFA,
|
||||||
"SECURITY_MFA_VERIFY_TTL": settings.SECURITY_MFA_VERIFY_TTL,
|
"SECURITY_MFA_VERIFY_TTL": settings.SECURITY_MFA_VERIFY_TTL,
|
||||||
"LOGO_URLS": settings.LOGO_URLS
|
"LOGO_URLS": settings.LOGO_URLS,
|
||||||
|
"PASSWORD_RULE": {
|
||||||
|
'SECURITY_PASSWORD_MIN_LENGTH': settings.SECURITY_PASSWORD_MIN_LENGTH,
|
||||||
|
'SECURITY_PASSWORD_UPPER_CASE': settings.SECURITY_PASSWORD_UPPER_CASE,
|
||||||
|
'SECURITY_PASSWORD_LOWER_CASE': settings.SECURITY_PASSWORD_LOWER_CASE,
|
||||||
|
'SECURITY_PASSWORD_NUMBER': settings.SECURITY_PASSWORD_NUMBER,
|
||||||
|
'SECURITY_PASSWORD_SPECIAL_CHAR': settings.SECURITY_PASSWORD_SPECIAL_CHAR,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return instance
|
return instance
|
||||||
|
|
|
@ -26,7 +26,8 @@ class CommandQueryMixin:
|
||||||
command_store = get_command_storage()
|
command_store = get_command_storage()
|
||||||
permission_classes = [IsOrgAdminOrAppUser | IsOrgAuditor]
|
permission_classes = [IsOrgAdminOrAppUser | IsOrgAuditor]
|
||||||
filter_fields = [
|
filter_fields = [
|
||||||
"asset", "system_user", "user", "session",
|
"asset", "system_user", "user", "session", "risk_level",
|
||||||
|
"input"
|
||||||
]
|
]
|
||||||
default_days_ago = 5
|
default_days_ago = 5
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ class TerminalViewSet(viewsets.ModelViewSet):
|
||||||
queryset = Terminal.objects.filter(is_deleted=False)
|
queryset = Terminal.objects.filter(is_deleted=False)
|
||||||
serializer_class = serializers.TerminalSerializer
|
serializer_class = serializers.TerminalSerializer
|
||||||
permission_classes = (IsSuperUser,)
|
permission_classes = (IsSuperUser,)
|
||||||
|
filter_fields = ['name', 'remote_addr']
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
name = request.data.get('name')
|
name = request.data.get('name')
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
# ~*~ coding: utf-8 ~*~
|
# ~*~ coding: utf-8 ~*~
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
from .models import AbstractSessionCommand
|
||||||
|
|
||||||
|
|
||||||
class SessionCommandSerializer(serializers.Serializer):
|
class SessionCommandSerializer(serializers.Serializer):
|
||||||
"""使用这个类作为基础Command Log Serializer类, 用来序列化"""
|
"""使用这个类作为基础Command Log Serializer类, 用来序列化"""
|
||||||
|
|
||||||
id = serializers.UUIDField(read_only=True)
|
id = serializers.UUIDField(read_only=True)
|
||||||
user = serializers.CharField(max_length=64)
|
user = serializers.CharField(max_length=64, label=_("User"))
|
||||||
asset = serializers.CharField(max_length=128)
|
asset = serializers.CharField(max_length=128, label=_("Asset"))
|
||||||
system_user = serializers.CharField(max_length=64)
|
system_user = serializers.CharField(max_length=64, label=_("System user"))
|
||||||
input = serializers.CharField(max_length=128)
|
input = serializers.CharField(max_length=128, label=_("Command"))
|
||||||
output = serializers.CharField(max_length=1024, allow_blank=True)
|
output = serializers.CharField(max_length=1024, allow_blank=True, label=_("Output"))
|
||||||
session = serializers.CharField(max_length=36)
|
session = serializers.CharField(max_length=36, label=_("Session"))
|
||||||
risk_level = serializers.IntegerField(required=False)
|
risk_level = serializers.ChoiceField(required=False, label=_("Risk level"), choices=AbstractSessionCommand.RISK_LEVEL_CHOICES)
|
||||||
|
risk_level_display = serializers.SerializerMethodField()
|
||||||
org_id = serializers.CharField(max_length=36, required=False, default='', allow_null=True, allow_blank=True)
|
org_id = serializers.CharField(max_length=36, required=False, default='', allow_null=True, allow_blank=True)
|
||||||
timestamp = serializers.IntegerField()
|
timestamp = serializers.IntegerField()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_risk_level_display(obj):
|
||||||
|
risk_mapper = dict(AbstractSessionCommand.RISK_LEVEL_CHOICES)
|
||||||
|
return risk_mapper.get(obj.risk_level)
|
||||||
|
|
|
@ -23,7 +23,8 @@ class TicketSerializer(serializers.ModelSerializer):
|
||||||
]
|
]
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
'status': {'label': _('Status')},
|
'status': {'label': _('Status')},
|
||||||
'action': {'label': _('Action')}
|
'action': {'label': _('Action')},
|
||||||
|
'user_display': {'label': _('User')}
|
||||||
}
|
}
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
|
|
|
@ -271,7 +271,7 @@ class UserUpdatePasswordSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
def validate_old_password(self, value):
|
def validate_old_password(self, value):
|
||||||
if not self.instance.check_password(value):
|
if not self.instance.check_password(value):
|
||||||
msg = 'The old password is incorrect'
|
msg = _('The old password is incorrect')
|
||||||
raise serializers.ValidationError(msg)
|
raise serializers.ValidationError(msg)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ class UserUpdatePasswordSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
def validate_new_password_again(self, value):
|
def validate_new_password_again(self, value):
|
||||||
if value != self.initial_data.get('new_password', ''):
|
if value != self.initial_data.get('new_password', ''):
|
||||||
msg = 'The newly set password is inconsistent'
|
msg = _('The newly set password is inconsistent')
|
||||||
raise serializers.ValidationError(msg)
|
raise serializers.ValidationError(msg)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ coreapi==2.3.3
|
||||||
coreschema==0.0.4
|
coreschema==0.0.4
|
||||||
cryptography==2.8
|
cryptography==2.8
|
||||||
decorator==4.1.2
|
decorator==4.1.2
|
||||||
Django==2.2.10
|
Django==2.2.13
|
||||||
django-auth-ldap==1.7.0
|
django-auth-ldap==1.7.0
|
||||||
django-bootstrap3==9.1.0
|
django-bootstrap3==9.1.0
|
||||||
django-celery-beat==1.4.0
|
django-celery-beat==1.4.0
|
||||||
|
|
Loading…
Reference in New Issue