diff --git a/apps/audits/models.py b/apps/audits/models.py index 31471edbe..5b53d1c85 100644 --- a/apps/audits/models.py +++ b/apps/audits/models.py @@ -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: