Compare commits

...

10 Commits
dev ... v2.23.2

Author SHA1 Message Date
ibuler
bb5b390d1d perf: 修复 middleware 导致的内存增长 2022-06-25 10:34:39 +08:00
Jiangjie.Bai
16c01733f1 fix: 修改 private_key 的序列类长度为 16384 2022-06-24 19:24:40 +08:00
feng626
b1b63445db fix: 修复confirm接口刚登录时可以跳过权限访问资源 2022-06-23 16:51:46 +08:00
Jiangjie.Bai
fca15eae7f fix: 修复post方法调用AuthBook接口时500的问题 2022-06-22 17:10:20 +08:00
ibuler
2c63b56f62 perf: 修改 redis scan counter 2022-06-20 19:39:29 +08:00
Jiangjie.Bai
ea5e56b33e fix: 修复es类型的命令存储更新忽略证书字段不成功的问题 2022-06-20 14:47:10 +08:00
ibuler
e4819ffe11 pref: 去掉 django-redis-cache 依赖 2022-06-20 14:12:22 +08:00
Eric
c34302325f fix:修复es日期索引忽略证书的问题 2022-06-20 14:06:35 +08:00
Jiangjie.Bai
3b5ee06535 Merge pull request #8430 from jumpserver/pr@v2.23@fix_ticketaction
fix: 修复工单自定义搜索时500的问题
2022-06-17 15:25:03 +08:00
Jiangjie.Bai
8e5edfd179 fix: 修复工单自定义搜索时500的问题 2022-06-17 07:22:15 +00:00
8 changed files with 18 additions and 7 deletions

View File

@@ -53,7 +53,15 @@ class AccountSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
return attrs
def get_protocols(self, v):
return v.protocols.replace(' ', ', ')
""" protocols 是 queryset 中返回的Post 创建成功后返回序列化时没有这个字段 """
if hasattr(v, 'protocols'):
protocols = v.protocols
elif hasattr(v, 'asset') and v.asset:
protocols = v.asset.protocols
else:
protocols = ''
protocols = protocols.replace(' ', ', ')
return protocols
@classmethod
def setup_eager_loading(cls, queryset):

View File

@@ -13,7 +13,7 @@ from .utils import validate_password_for_ansible
class AuthSerializer(serializers.ModelSerializer):
password = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=1024, label=_('Password'))
private_key = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=4096, label=_('Private key'))
private_key = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=16384, label=_('Private key'))
def gen_keys(self, private_key=None, password=None):
if private_key is None:
@@ -38,7 +38,7 @@ class AuthSerializerMixin(serializers.ModelSerializer):
validators=[validate_password_for_ansible]
)
private_key = EncryptedField(
label=_('SSH private key'), required=False, allow_blank=True, allow_null=True, max_length=4096
label=_('SSH private key'), required=False, allow_blank=True, allow_null=True, max_length=16384
)
passphrase = serializers.CharField(
allow_blank=True, allow_null=True, required=False, max_length=512,

View File

@@ -277,7 +277,6 @@ def on_user_auth_success(sender, user, request, login_type=None, **kwargs):
check_different_city_login_if_need(user, request)
data = generate_data(user.username, request, login_type=login_type)
request.session['login_time'] = data['datetime'].strftime("%Y-%m-%d %H:%M:%S")
request.session["MFA_VERIFY_TIME"] = int(time.time())
data.update({'mfa': int(user.mfa_enabled), 'status': True})
write_login_log(**data)

View File

@@ -46,6 +46,8 @@ class SessionCookieMiddleware(MiddlewareMixin):
@staticmethod
def set_cookie_public_key(request, response):
if request.path.startswith('/api'):
return
pub_key_name = settings.SESSION_RSA_PUBLIC_KEY_NAME
public_key = request.session.get(pub_key_name)
cookie_key = request.COOKIES.get(pub_key_name)

View File

@@ -153,3 +153,5 @@ ANSIBLE_LOG_DIR = os.path.join(PROJECT_DIR, 'data', 'ansible')
REDIS_HOST = CONFIG.REDIS_HOST
REDIS_PORT = CONFIG.REDIS_PORT
REDIS_PASSWORD = CONFIG.REDIS_PASSWORD
DJANGO_REDIS_SCAN_ITERSIZE = 1000

View File

@@ -1,5 +1,6 @@
from __future__ import unicode_literals
import copy
import os
from importlib import import_module
@@ -77,7 +78,7 @@ class CommandStorage(CommonStorageModelMixin, CommonModelMixin):
def config(self):
config = self.meta
config.update({'TYPE': self.type})
return config
return copy.deepcopy(config)
@property
def valid_config(self):

View File

@@ -27,7 +27,7 @@ class TicketViewSet(CommonApiMixin, viewsets.ModelViewSet):
}
filterset_class = TicketFilter
search_fields = [
'title', 'action', 'type', 'status', 'applicant_display'
'title', 'type', 'status', 'applicant_display'
]
ordering_fields = (
'title', 'applicant_display', 'status', 'state', 'action_display',

View File

@@ -21,7 +21,6 @@ django-celery-beat==2.2.1
django-filter==2.4.0
django-formtools==2.2
django-ranged-response==0.2.0
django-redis-cache==2.1.1
django-rest-swagger==2.2.0
django-simple-captcha==0.5.13
django-timezone-field==4.1.0