feat(session + db): 会话搜索添加登录来源选项

This commit is contained in:
Bai
2020-07-15 17:15:34 +08:00
committed by 老广
parent c0f3a1f64a
commit 4e933fc1ca
5 changed files with 25 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ class SessionViewSet(OrgBulkModelViewSet):
permission_classes = (IsOrgAdminOrAppUser, )
filter_fields = [
"user", "asset", "system_user", "remote_addr",
"protocol", "terminal", "is_finished",
"protocol", "terminal", "is_finished", 'login_from',
]
date_range_filter_fields = [
('date_start', ('date_from', 'date_to'))

View File

@@ -0,0 +1,18 @@
# Generated by Django 2.2.10 on 2020-07-15 09:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terminal', '0023_command_risk_level'),
]
operations = [
migrations.AlterField(
model_name='session',
name='login_from',
field=models.CharField(choices=[('ST', 'SSH Terminal'), ('WT', 'Web Terminal')], default='ST', max_length=2, verbose_name='Login from'),
),
]

View File

@@ -188,7 +188,7 @@ class Session(OrgModelMixin):
asset_id = models.CharField(blank=True, default='', max_length=36, db_index=True)
system_user = models.CharField(max_length=128, verbose_name=_("System user"), db_index=True)
system_user_id = models.CharField(blank=True, default='', max_length=36, db_index=True)
login_from = models.CharField(max_length=2, choices=LOGIN_FROM_CHOICES, default="ST")
login_from = models.CharField(max_length=2, choices=LOGIN_FROM_CHOICES, default="ST", verbose_name=_("Login from"))
remote_addr = models.CharField(max_length=128, verbose_name=_("Remote addr"), blank=True, null=True)
is_success = models.BooleanField(default=True, db_index=True)
is_finished = models.BooleanField(default=False, db_index=True)