mirror of https://github.com/jumpserver/jumpserver
feat: 支持 MongoDB 数据库的纳管 (#7631)
parent
0dbf035146
commit
ad2cb233d7
|
@ -17,11 +17,12 @@ class AppCategory(models.TextChoices):
|
||||||
class AppType(models.TextChoices):
|
class AppType(models.TextChoices):
|
||||||
# db category
|
# db category
|
||||||
mysql = 'mysql', 'MySQL'
|
mysql = 'mysql', 'MySQL'
|
||||||
redis = 'redis', 'Redis'
|
|
||||||
oracle = 'oracle', 'Oracle'
|
oracle = 'oracle', 'Oracle'
|
||||||
pgsql = 'postgresql', 'PostgreSQL'
|
pgsql = 'postgresql', 'PostgreSQL'
|
||||||
mariadb = 'mariadb', 'MariaDB'
|
mariadb = 'mariadb', 'MariaDB'
|
||||||
sqlserver = 'sqlserver', 'SQLServer'
|
sqlserver = 'sqlserver', 'SQLServer'
|
||||||
|
redis = 'redis', 'Redis'
|
||||||
|
mongodb = 'mongodb', 'MongoDB'
|
||||||
|
|
||||||
# remote-app category
|
# remote-app category
|
||||||
chrome = 'chrome', 'Chrome'
|
chrome = 'chrome', 'Chrome'
|
||||||
|
@ -36,7 +37,7 @@ class AppType(models.TextChoices):
|
||||||
def category_types_mapper(cls):
|
def category_types_mapper(cls):
|
||||||
return {
|
return {
|
||||||
AppCategory.db: [
|
AppCategory.db: [
|
||||||
cls.mysql, cls.oracle, cls.redis, cls.pgsql, cls.mariadb, cls.sqlserver
|
cls.mysql, cls.oracle, cls.pgsql, cls.mariadb, cls.sqlserver, cls.redis, cls.mongodb
|
||||||
],
|
],
|
||||||
AppCategory.remote_app: [cls.chrome, cls.mysql_workbench, cls.vmware_client, cls.custom],
|
AppCategory.remote_app: [cls.chrome, cls.mysql_workbench, cls.vmware_client, cls.custom],
|
||||||
AppCategory.cloud: [cls.k8s]
|
AppCategory.cloud: [cls.k8s]
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
from .mysql import *
|
from .mysql import *
|
||||||
from .redis import *
|
|
||||||
from .mariadb import *
|
from .mariadb import *
|
||||||
from .oracle import *
|
from .oracle import *
|
||||||
from .pgsql import *
|
from .pgsql import *
|
||||||
from .sqlserver import *
|
from .sqlserver import *
|
||||||
|
from .redis import *
|
||||||
|
from .mongodb import *
|
||||||
|
|
||||||
from .chrome import *
|
from .chrome import *
|
||||||
from .mysql_workbench import *
|
from .mysql_workbench import *
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from ..application_category import DBSerializer
|
||||||
|
|
||||||
|
__all__ = ['MongoDBSerializer']
|
||||||
|
|
||||||
|
|
||||||
|
class MongoDBSerializer(DBSerializer):
|
||||||
|
port = serializers.IntegerField(default=27017, label=_('Port'), allow_null=True)
|
||||||
|
|
|
@ -25,11 +25,12 @@ category_serializer_classes_mapping = {
|
||||||
type_serializer_classes_mapping = {
|
type_serializer_classes_mapping = {
|
||||||
# db
|
# db
|
||||||
const.AppType.mysql.value: application_type.MySQLSerializer,
|
const.AppType.mysql.value: application_type.MySQLSerializer,
|
||||||
const.AppType.redis.value: application_type.RedisSerializer,
|
|
||||||
const.AppType.mariadb.value: application_type.MariaDBSerializer,
|
const.AppType.mariadb.value: application_type.MariaDBSerializer,
|
||||||
const.AppType.oracle.value: application_type.OracleSerializer,
|
const.AppType.oracle.value: application_type.OracleSerializer,
|
||||||
const.AppType.pgsql.value: application_type.PostgreSerializer,
|
const.AppType.pgsql.value: application_type.PostgreSerializer,
|
||||||
const.AppType.sqlserver.value: application_type.SQLServerSerializer,
|
const.AppType.sqlserver.value: application_type.SQLServerSerializer,
|
||||||
|
const.AppType.redis.value: application_type.RedisSerializer,
|
||||||
|
const.AppType.mongodb.value: application_type.MongoDBSerializer,
|
||||||
# cloud
|
# cloud
|
||||||
const.AppType.k8s.value: application_type.K8SSerializer
|
const.AppType.k8s.value: application_type.K8SSerializer
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,12 @@ class ProtocolMixin:
|
||||||
telnet = 'telnet', 'Telnet'
|
telnet = 'telnet', 'Telnet'
|
||||||
vnc = 'vnc', 'VNC'
|
vnc = 'vnc', 'VNC'
|
||||||
mysql = 'mysql', 'MySQL'
|
mysql = 'mysql', 'MySQL'
|
||||||
redis = 'redis', 'Redis'
|
|
||||||
oracle = 'oracle', 'Oracle'
|
oracle = 'oracle', 'Oracle'
|
||||||
mariadb = 'mariadb', 'MariaDB'
|
mariadb = 'mariadb', 'MariaDB'
|
||||||
postgresql = 'postgresql', 'PostgreSQL'
|
postgresql = 'postgresql', 'PostgreSQL'
|
||||||
sqlserver = 'sqlserver', 'SQLServer'
|
sqlserver = 'sqlserver', 'SQLServer'
|
||||||
|
redis = 'redis', 'Redis'
|
||||||
|
mongodb = 'mongodb', 'MongoDB'
|
||||||
k8s = 'k8s', 'K8S'
|
k8s = 'k8s', 'K8S'
|
||||||
|
|
||||||
SUPPORT_PUSH_PROTOCOLS = [Protocol.ssh, Protocol.rdp]
|
SUPPORT_PUSH_PROTOCOLS = [Protocol.ssh, Protocol.rdp]
|
||||||
|
@ -44,8 +45,9 @@ class ProtocolMixin:
|
||||||
Protocol.rdp
|
Protocol.rdp
|
||||||
]
|
]
|
||||||
APPLICATION_CATEGORY_DB_PROTOCOLS = [
|
APPLICATION_CATEGORY_DB_PROTOCOLS = [
|
||||||
Protocol.mysql, Protocol.redis, Protocol.oracle,
|
Protocol.mysql, Protocol.mariadb, Protocol.oracle,
|
||||||
Protocol.mariadb, Protocol.postgresql, Protocol.sqlserver
|
Protocol.postgresql, Protocol.sqlserver,
|
||||||
|
Protocol.redis, Protocol.mongodb
|
||||||
]
|
]
|
||||||
APPLICATION_CATEGORY_CLOUD_PROTOCOLS = [
|
APPLICATION_CATEGORY_CLOUD_PROTOCOLS = [
|
||||||
Protocol.k8s
|
Protocol.k8s
|
||||||
|
|
|
@ -29,11 +29,12 @@ class Session(OrgModelMixin):
|
||||||
VNC = 'vnc', 'vnc'
|
VNC = 'vnc', 'vnc'
|
||||||
TELNET = 'telnet', 'telnet'
|
TELNET = 'telnet', 'telnet'
|
||||||
MYSQL = 'mysql', 'mysql'
|
MYSQL = 'mysql', 'mysql'
|
||||||
REDIS = 'redis', 'redis'
|
|
||||||
ORACLE = 'oracle', 'oracle'
|
ORACLE = 'oracle', 'oracle'
|
||||||
MARIADB = 'mariadb', 'mariadb'
|
MARIADB = 'mariadb', 'mariadb'
|
||||||
SQLSERVER = 'sqlserver', 'sqlserver'
|
SQLSERVER = 'sqlserver', 'sqlserver'
|
||||||
POSTGRESQL = 'postgresql', 'postgresql'
|
POSTGRESQL = 'postgresql', 'postgresql'
|
||||||
|
REDIS = 'redis', 'redis'
|
||||||
|
MONGODB = 'mongodb', 'MongoDB'
|
||||||
K8S = 'k8s', 'kubernetes'
|
K8S = 'k8s', 'kubernetes'
|
||||||
|
|
||||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||||||
|
@ -145,8 +146,9 @@ class Session(OrgModelMixin):
|
||||||
@property
|
@property
|
||||||
def db_protocols(self):
|
def db_protocols(self):
|
||||||
_PROTOCOL = self.PROTOCOL
|
_PROTOCOL = self.PROTOCOL
|
||||||
return [_PROTOCOL.MYSQL, _PROTOCOL.MARIADB, _PROTOCOL.REDIS,
|
return [_PROTOCOL.MYSQL, _PROTOCOL.MARIADB, _PROTOCOL.ORACLE,
|
||||||
_PROTOCOL.ORACLE, _PROTOCOL.POSTGRESQL, _PROTOCOL.SQLSERVER]
|
_PROTOCOL.POSTGRESQL, _PROTOCOL.SQLSERVER,
|
||||||
|
_PROTOCOL.REDIS, _PROTOCOL.MONGODB]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def can_terminate(self):
|
def can_terminate(self):
|
||||||
|
|
Loading…
Reference in New Issue