mirror of https://github.com/jumpserver/jumpserver
parent
93932f1904
commit
003feb1aed
|
@ -26,9 +26,8 @@ from common.signals import django_ready
|
||||||
from common.utils import get_request_ip, get_logger, get_syslogger
|
from common.utils import get_request_ip, get_logger, get_syslogger
|
||||||
from common.utils.encode import data_to_json
|
from common.utils.encode import data_to_json
|
||||||
from jumpserver.utils import current_request
|
from jumpserver.utils import current_request
|
||||||
from terminal.backends.command.serializers import SessionCommandSerializer
|
|
||||||
from terminal.models import Session, Command
|
from terminal.models import Session, Command
|
||||||
from terminal.serializers import SessionSerializer
|
from terminal.serializers import SessionSerializer, SessionCommandSerializer
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from users.signals import post_user_change_password
|
from users.signals import post_user_change_password
|
||||||
from . import models, serializers
|
from . import models, serializers
|
||||||
|
|
|
@ -11,11 +11,12 @@ from terminal.filters import CommandFilter
|
||||||
from orgs.utils import current_org
|
from orgs.utils import current_org
|
||||||
from common.api import JMSBulkModelViewSet
|
from common.api import JMSBulkModelViewSet
|
||||||
from common.utils import get_logger
|
from common.utils import get_logger
|
||||||
from terminal.backends.command.serializers import InsecureCommandAlertSerializer
|
from terminal.serializers import (
|
||||||
|
SessionCommandSerializer, InsecureCommandAlertSerializer
|
||||||
|
)
|
||||||
from terminal.exceptions import StorageInvalid
|
from terminal.exceptions import StorageInvalid
|
||||||
from terminal.backends import (
|
from terminal.backends import (
|
||||||
get_command_storage, get_multi_command_storage,
|
get_command_storage, get_multi_command_storage
|
||||||
SessionCommandSerializer,
|
|
||||||
)
|
)
|
||||||
from terminal.notifications import CommandAlertMessage
|
from terminal.notifications import CommandAlertMessage
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ from django.conf import settings
|
||||||
from django.utils.functional import LazyObject
|
from django.utils.functional import LazyObject
|
||||||
|
|
||||||
from common.utils import get_logger
|
from common.utils import get_logger
|
||||||
from .command.serializers import SessionCommandSerializer
|
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__file__)
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
from .terminal import *
|
from .applet import *
|
||||||
|
from .command import *
|
||||||
from .session import *
|
from .session import *
|
||||||
from .storage import *
|
from .storage import *
|
||||||
from .sharing import *
|
from .sharing import *
|
||||||
|
from .terminal import *
|
||||||
from .endpoint import *
|
from .endpoint import *
|
||||||
from .applet import *
|
|
||||||
from .applet_host import *
|
from .applet_host import *
|
||||||
|
|
|
@ -3,18 +3,20 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from common.utils import pretty_string
|
from common.utils import pretty_string
|
||||||
from .models import AbstractSessionCommand
|
from common.serializers.fields import LabeledChoiceField
|
||||||
|
from terminal.backends.command.models import AbstractSessionCommand
|
||||||
|
|
||||||
__all__ = ['SessionCommandSerializer', 'InsecureCommandAlertSerializer']
|
__all__ = ['SessionCommandSerializer', 'InsecureCommandAlertSerializer']
|
||||||
|
|
||||||
|
|
||||||
class SimpleSessionCommandSerializer(serializers.Serializer):
|
class SimpleSessionCommandSerializer(serializers.Serializer):
|
||||||
|
|
||||||
""" 简单Session命令序列类, 用来提取公共字段 """
|
""" 简单Session命令序列类, 用来提取公共字段 """
|
||||||
user = serializers.CharField(label=_("User")) # 限制 64 字符,见 validate_user
|
user = serializers.CharField(label=_("User")) # 限制 64 字符,见 validate_user
|
||||||
asset = serializers.CharField(max_length=128, label=_("Asset"))
|
asset = serializers.CharField(max_length=128, label=_("Asset"))
|
||||||
input = serializers.CharField(max_length=2048, label=_("Command"))
|
input = serializers.CharField(max_length=2048, label=_("Command"))
|
||||||
session = serializers.CharField(max_length=36, label=_("Session ID"))
|
session = serializers.CharField(max_length=36, label=_("Session ID"))
|
||||||
risk_level = serializers.ChoiceField(
|
risk_level = LabeledChoiceField(
|
||||||
required=False, label=_("Risk level"), choices=AbstractSessionCommand.RISK_LEVEL_CHOICES
|
required=False, label=_("Risk level"), choices=AbstractSessionCommand.RISK_LEVEL_CHOICES
|
||||||
)
|
)
|
||||||
org_id = serializers.CharField(
|
org_id = serializers.CharField(
|
Loading…
Reference in New Issue