mirror of https://github.com/jumpserver/jumpserver
[Update] 在线/历史/命令model添加org;修复命令记录保存org失败bug (#1584)
* [Update] 修复创建授权规则,显示org_name不是有效UUID的bug * [Update] 更新org之间隔离授权规则,解决QuerySet与Manager问题;修复创建用户,显示org_name不是有效UUID之bug; * [Update] 在线/历史/命令model添加org * [Bugfix] 修复命令记录,保存org不成功bugpull/1594/head
parent
36f1165d1b
commit
f17727deb9
|
@ -21,7 +21,7 @@ class CommandStore(CommandBase):
|
|||
user=command["user"], asset=command["asset"],
|
||||
system_user=command["system_user"], input=command["input"],
|
||||
output=command["output"], session=command["session"],
|
||||
timestamp=command["timestamp"]
|
||||
org_id=command["org_id"], timestamp=command["timestamp"]
|
||||
)
|
||||
|
||||
def bulk_save(self, commands):
|
||||
|
@ -33,7 +33,7 @@ class CommandStore(CommandBase):
|
|||
_commands.append(self.model(
|
||||
user=c["user"], asset=c["asset"], system_user=c["system_user"],
|
||||
input=c["input"], output=c["output"], session=c["session"],
|
||||
timestamp=c["timestamp"]
|
||||
org_id=c["org_id"], timestamp=c["timestamp"]
|
||||
))
|
||||
return self.model.objects.bulk_create(_commands)
|
||||
|
||||
|
|
|
@ -4,8 +4,10 @@ import uuid
|
|||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from orgs.mixins import OrgModelMixin
|
||||
|
||||
class AbstractSessionCommand(models.Model):
|
||||
|
||||
class AbstractSessionCommand(OrgModelMixin):
|
||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||||
user = models.CharField(max_length=64, db_index=True, verbose_name=_("User"))
|
||||
asset = models.CharField(max_length=128, db_index=True, verbose_name=_("Asset"))
|
||||
|
|
|
@ -12,5 +12,6 @@ class SessionCommandSerializer(serializers.Serializer):
|
|||
input = serializers.CharField(max_length=128)
|
||||
output = serializers.CharField(max_length=1024, allow_blank=True)
|
||||
session = serializers.CharField(max_length=36)
|
||||
org_id = serializers.CharField(max_length=36)
|
||||
timestamp = serializers.IntegerField()
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.utils import timezone
|
|||
from django.conf import settings
|
||||
|
||||
from users.models import User
|
||||
from orgs.mixins import OrgModelMixin
|
||||
from .backends.command.models import AbstractSessionCommand
|
||||
|
||||
|
||||
|
@ -112,7 +113,7 @@ class Status(models.Model):
|
|||
return self.date_created.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
||||
class Session(models.Model):
|
||||
class Session(OrgModelMixin):
|
||||
LOGIN_FROM_CHOICES = (
|
||||
('ST', 'SSH Terminal'),
|
||||
('WT', 'Web Terminal'),
|
||||
|
|
Loading…
Reference in New Issue