pull/4107/head
Bai 2020-06-16 15:04:38 +08:00
commit afa515d570
11 changed files with 44 additions and 15 deletions

View File

@ -65,7 +65,7 @@ class AssetByNodeFilterBackend(filters.BaseFilterBackend):
class LabelFilterBackend(filters.BaseFilterBackend):
sep = '#'
sep = ':'
query_arg = 'label'
def get_schema_fields(self, view):
@ -84,6 +84,8 @@ class LabelFilterBackend(filters.BaseFilterBackend):
q = None
for kv in labels_query:
if '#' in kv:
self.sep = '#'
if self.sep not in kv:
continue
key, value = kv.strip().split(self.sep)[:2]

View File

@ -87,6 +87,7 @@ if settings.DEBUG:
# 兼容之前的
old_app_pattern = '|'.join(apps)
old_app_pattern = r'^{}'.format(old_app_pattern)
urlpatterns += [re_path(old_app_pattern, views.redirect_old_apps_view)]

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\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"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -2720,6 +2720,14 @@ msgstr "角色只能为 {}"
msgid "Password does not match security rules"
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
msgid "name not unique"
msgstr "名称重复"

View File

@ -275,7 +275,14 @@ class PublicSettingApi(generics.RetrieveAPIView):
"LOGIN_CONFIRM_ENABLE": settings.LOGIN_CONFIRM_ENABLE,
"SECURITY_VIEW_AUTH_NEED_MFA": settings.SECURITY_VIEW_AUTH_NEED_MFA,
"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

View File

@ -26,7 +26,8 @@ class CommandQueryMixin:
command_store = get_command_storage()
permission_classes = [IsOrgAdminOrAppUser | IsOrgAuditor]
filter_fields = [
"asset", "system_user", "user", "session",
"asset", "system_user", "user", "session", "risk_level",
"input"
]
default_days_ago = 5

View File

@ -27,6 +27,7 @@ class TerminalViewSet(viewsets.ModelViewSet):
queryset = Terminal.objects.filter(is_deleted=False)
serializer_class = serializers.TerminalSerializer
permission_classes = (IsSuperUser,)
filter_fields = ['name', 'remote_addr']
def create(self, request, *args, **kwargs):
name = request.data.get('name')

View File

@ -1,18 +1,26 @@
# ~*~ coding: utf-8 ~*~
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from .models import AbstractSessionCommand
class SessionCommandSerializer(serializers.Serializer):
"""使用这个类作为基础Command Log Serializer类, 用来序列化"""
id = serializers.UUIDField(read_only=True)
user = serializers.CharField(max_length=64)
asset = serializers.CharField(max_length=128)
system_user = serializers.CharField(max_length=64)
input = serializers.CharField(max_length=128)
output = serializers.CharField(max_length=1024, allow_blank=True)
session = serializers.CharField(max_length=36)
risk_level = serializers.IntegerField(required=False)
user = serializers.CharField(max_length=64, label=_("User"))
asset = serializers.CharField(max_length=128, label=_("Asset"))
system_user = serializers.CharField(max_length=64, label=_("System user"))
input = serializers.CharField(max_length=128, label=_("Command"))
output = serializers.CharField(max_length=1024, allow_blank=True, label=_("Output"))
session = serializers.CharField(max_length=36, label=_("Session"))
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)
timestamp = serializers.IntegerField()
@staticmethod
def get_risk_level_display(obj):
risk_mapper = dict(AbstractSessionCommand.RISK_LEVEL_CHOICES)
return risk_mapper.get(obj.risk_level)

View File

@ -23,7 +23,8 @@ class TicketSerializer(serializers.ModelSerializer):
]
extra_kwargs = {
'status': {'label': _('Status')},
'action': {'label': _('Action')}
'action': {'label': _('Action')},
'user_display': {'label': _('User')}
}
def create(self, validated_data):

View File

@ -271,7 +271,7 @@ class UserUpdatePasswordSerializer(serializers.ModelSerializer):
def validate_old_password(self, value):
if not self.instance.check_password(value):
msg = 'The old password is incorrect'
msg = _('The old password is incorrect')
raise serializers.ValidationError(msg)
return value
@ -285,7 +285,7 @@ class UserUpdatePasswordSerializer(serializers.ModelSerializer):
def validate_new_password_again(self, value):
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)
return value

View File

@ -14,7 +14,7 @@ coreapi==2.3.3
coreschema==0.0.4
cryptography==2.8
decorator==4.1.2
Django==2.2.10
Django==2.2.13
django-auth-ldap==1.7.0
django-bootstrap3==9.1.0
django-celery-beat==1.4.0