Merge pull request #3395 from jumpserver/dev_loginlog

[Update] 登录日志导出按照组织进行过滤
pull/3397/head
BaiJiangJie 2019-10-29 12:30:56 +08:00 committed by GitHub
commit c29381e657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from orgs.mixins.models import OrgModelMixin
from orgs.utils import current_org
__all__ = [
'FTPLog', 'OperateLog', 'PasswordChangeLog', 'UserLoginLog',
@ -104,6 +105,9 @@ class UserLoginLog(models.Model):
Q(city__contains=keyword) |
Q(username__contains=keyword)
)
if not current_org.is_root():
username_list = current_org.get_org_members().values_list('username', flat=True)
login_logs = login_logs.filter(username__in=username_list)
return login_logs
class Meta: