mirror of https://github.com/jumpserver/jumpserver
Dev (#4791)
* fix(xpack): 修复last login太长的问题 (#4786) Co-authored-by: ibuler <ibuler@qq.com> * perf: 更新密码中也发送邮件 (#4789) Co-authored-by: ibuler <ibuler@qq.com> * fix(terminal): 修复获取螺旋的异步api * fix(terminal): 修复有的录像存储有问题的导致下载录像的bug * fix(orgs): 修复组织添加用户bug * perf(requirements): 修改jms-storage==0.0.34 (#4797) Co-authored-by: Bai <bugatti_it@163.com> Co-authored-by: fit2bot <68588906+fit2bot@users.noreply.github.com> Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: Bai <bugatti_it@163.com>pull/4809/head
parent
475c0e4187
commit
e3dd03f4c7
|
@ -92,7 +92,7 @@ def add_asset_users(assets, results):
|
|||
for username, data in users.items():
|
||||
defaults = {'asset': asset, 'username': username, 'present': True}
|
||||
if data.get("ip"):
|
||||
defaults["ip_last_login"] = data["ip"]
|
||||
defaults["ip_last_login"] = data["ip"][:32]
|
||||
if data.get("date"):
|
||||
defaults["date_last_login"] = data["date"]
|
||||
GatheredUser.objects.update_or_create(
|
||||
|
|
|
@ -230,8 +230,14 @@ def _none2list(*args):
|
|||
return ([] if v is None else v for v in args)
|
||||
|
||||
|
||||
def _users2pks(users, admins, auditors):
|
||||
return [user.pk for user in chain(users, admins, auditors) if hasattr(user, 'pk')]
|
||||
def _users2pks_if_need(users, admins, auditors):
|
||||
pks = []
|
||||
for user in chain(users, admins, auditors):
|
||||
if hasattr(user, 'pk'):
|
||||
pks.append(user.pk)
|
||||
else:
|
||||
pks.append(user)
|
||||
return pks
|
||||
|
||||
|
||||
class UserRoleMapper(dict):
|
||||
|
@ -271,7 +277,7 @@ class OrgMemeberManager(models.Manager):
|
|||
users, admins, auditors = _none2list(users, admins, auditors)
|
||||
|
||||
send = partial(signals.m2m_changed.send, sender=self.model, instance=org, reverse=False,
|
||||
model=User, pk_set=_users2pks(users, admins, auditors), using=self.db)
|
||||
model=User, pk_set=_users2pks_if_need(users, admins, auditors), using=self.db)
|
||||
|
||||
send(action="pre_remove")
|
||||
self.filter(org_id=org.id).filter(
|
||||
|
@ -302,7 +308,7 @@ class OrgMemeberManager(models.Manager):
|
|||
oms_add.append(self.model(org_id=org.id, user_id=_user, role=_role))
|
||||
|
||||
send = partial(signals.m2m_changed.send, sender=self.model, instance=org, reverse=False,
|
||||
model=User, pk_set=_users2pks(users, admins, auditors), using=self.db)
|
||||
model=User, pk_set=_users2pks_if_need(users, admins, auditors), using=self.db)
|
||||
|
||||
send(action='pre_add')
|
||||
self.bulk_create(oms_add, ignore_conflicts=True)
|
||||
|
|
|
@ -155,7 +155,6 @@ class SessionReplayViewSet(AsyncApiMixin, viewsets.ViewSet):
|
|||
return data
|
||||
|
||||
def is_need_async(self):
|
||||
return False
|
||||
if self.action != 'retrieve':
|
||||
return False
|
||||
return True
|
||||
|
|
|
@ -10,6 +10,7 @@ from common.permissions import (
|
|||
)
|
||||
from .. import serializers
|
||||
from ..models import User
|
||||
from ..utils import send_reset_password_success_mail
|
||||
from .mixins import UserQuerysetMixin
|
||||
|
||||
__all__ = [
|
||||
|
@ -85,3 +86,7 @@ class UserPublicKeyApi(generics.RetrieveUpdateAPIView):
|
|||
|
||||
def get_object(self):
|
||||
return self.request.user
|
||||
|
||||
def perform_update(self, serializer):
|
||||
super().perform_update(serializer)
|
||||
send_reset_password_success_mail(self.request, self.get_object())
|
||||
|
|
|
@ -61,7 +61,7 @@ pytz==2018.3
|
|||
PyYAML==5.1
|
||||
redis==3.2.0
|
||||
requests==2.22.0
|
||||
jms-storage==0.0.31
|
||||
jms-storage==0.0.34
|
||||
s3transfer==0.3.3
|
||||
simplejson==3.13.2
|
||||
six==1.11.0
|
||||
|
|
Loading…
Reference in New Issue