mirror of https://github.com/jumpserver/jumpserver
Merge branch 'dev' of http://github.com/jumpserver/jumpserver into pr@master@feat_support_redis_ssl_connect_magnus
commit
c098172ed4
|
@ -58,36 +58,43 @@ class Protocol(ChoicesMixin, models.TextChoices):
|
|||
return {
|
||||
cls.mysql: {
|
||||
'port': 3306,
|
||||
'setting': {},
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
'setting': {
|
||||
}
|
||||
},
|
||||
cls.mariadb: {
|
||||
'port': 3306,
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
},
|
||||
cls.postgresql: {
|
||||
'port': 5432,
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
},
|
||||
cls.oracle: {
|
||||
'port': 1521,
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
},
|
||||
cls.sqlserver: {
|
||||
'port': 1433,
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
},
|
||||
cls.clickhouse: {
|
||||
'port': 9000,
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
},
|
||||
cls.mongodb: {
|
||||
'port': 27017,
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
},
|
||||
cls.redis: {
|
||||
'port': 6379,
|
||||
'required': True,
|
||||
'secret_types': ['password'],
|
||||
},
|
||||
}
|
||||
|
@ -97,6 +104,7 @@ class Protocol(ChoicesMixin, models.TextChoices):
|
|||
return {
|
||||
cls.k8s: {
|
||||
'port': 443,
|
||||
'required': True,
|
||||
'secret_types': ['token'],
|
||||
},
|
||||
cls.http: {
|
||||
|
|
|
@ -302,8 +302,8 @@ class AllTypes(ChoicesMixin):
|
|||
protocols_data = [p for p in protocols_data if p['name'] in _protocols]
|
||||
for p in protocols_data:
|
||||
setting = _protocols_setting.get(p['name'], {})
|
||||
p['required'] = setting.pop('required', False)
|
||||
p['default'] = setting.pop('default', False)
|
||||
p['required'] = p.pop('required', False)
|
||||
p['default'] = p.pop('default', False)
|
||||
p['setting'] = {**setting, **p.get('setting', {})}
|
||||
|
||||
platform_data = {
|
||||
|
|
|
@ -13,7 +13,7 @@ __all__ = ['DomainSerializer', 'DomainWithGatewaySerializer']
|
|||
|
||||
class DomainSerializer(BulkOrgResourceModelSerializer):
|
||||
gateways = ObjectRelatedField(
|
||||
many=True, required=False, queryset=Asset.objects, label=_('Gateway')
|
||||
many=True, required=False, label=_('Gateway'), read_only=True,
|
||||
)
|
||||
assets = ObjectRelatedField(
|
||||
many=True, required=False, queryset=Asset.objects, label=_('Asset')
|
||||
|
|
|
@ -31,6 +31,7 @@ system_user_perms = (
|
|||
_auditor_perms = (
|
||||
('rbac', 'menupermission', 'view', 'audit'),
|
||||
('audits', '*', '*', '*'),
|
||||
('ops', 'jobauditlog', '*', '*'),
|
||||
('terminal', 'commandstorage', 'view', 'commandstorage'),
|
||||
('terminal', 'sessionreplay', 'view,download', 'sessionreplay'),
|
||||
('terminal', 'session', '*', '*'),
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 5.6 KiB |
|
@ -87,6 +87,7 @@ class DownloadUploadMixin:
|
|||
class AppletViewSet(DownloadUploadMixin, JMSBulkModelViewSet):
|
||||
queryset = Applet.objects.all()
|
||||
serializer_class = serializers.AppletSerializer
|
||||
filterset_fields = ['name', 'version', 'builtin', 'is_active']
|
||||
search_fields = ['name', 'display_name', 'author']
|
||||
rbac_perms = {
|
||||
'upload': 'terminal.add_applet',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
## Navicat Premium
|
||||
|
||||
- 需要先手动导入License激活
|
||||
|
|
|
@ -11,6 +11,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
from rest_framework.serializers import ValidationError
|
||||
|
||||
from common.db.models import JMSBaseModel
|
||||
from common.utils import lazyproperty
|
||||
|
||||
__all__ = ['Applet', 'AppletPublication']
|
||||
|
||||
|
@ -48,6 +49,14 @@ class Applet(JMSBaseModel):
|
|||
else:
|
||||
return default_storage.path('applets/{}'.format(self.name))
|
||||
|
||||
@lazyproperty
|
||||
def readme(self):
|
||||
readme_file = os.path.join(self.path, 'README.md')
|
||||
if os.path.isfile(readme_file):
|
||||
with open(readme_file, 'r') as f:
|
||||
return f.read()
|
||||
return ''
|
||||
|
||||
@property
|
||||
def manifest(self):
|
||||
path = os.path.join(self.path, 'manifest.yml')
|
||||
|
|
|
@ -114,6 +114,13 @@ class AppletHostDeployment(JMSBaseModel):
|
|||
ordering = ('-date_start',)
|
||||
|
||||
def start(self, **kwargs):
|
||||
# 重新初始化部署,applet host 关联的终端需要删除
|
||||
# 否则 tinker 会因终端注册名称相同,造成冲突,执行任务失败
|
||||
if self.host.terminal:
|
||||
terminal = self.host.terminal
|
||||
self.host.terminal = None
|
||||
self.host.save()
|
||||
terminal.delete()
|
||||
from ...automations.deploy_applet_host import DeployAppletHostManager
|
||||
manager = DeployAppletHostManager(self)
|
||||
manager.run(**kwargs)
|
||||
|
|
|
@ -31,7 +31,7 @@ class AppletSerializer(serializers.ModelSerializer):
|
|||
model = Applet
|
||||
fields_mini = ['id', 'name', 'display_name', 'is_active']
|
||||
read_only_fields = [
|
||||
'icon', 'date_created', 'date_updated',
|
||||
'icon', 'readme', 'date_created', 'date_updated',
|
||||
]
|
||||
fields = fields_mini + [
|
||||
'version', 'author', 'type', 'protocols',
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from rest_framework import serializers
|
||||
|
||||
from common.utils import validate_ssh_public_key
|
||||
from common.serializers.fields import EncryptedField
|
||||
from common.serializers.fields import EncryptedField, LabeledChoiceField
|
||||
from ..models import User
|
||||
|
||||
from .user import UserSerializer
|
||||
|
@ -123,7 +123,7 @@ class UserProfileSerializer(UserSerializer):
|
|||
public_key_hash_md5 = serializers.CharField(
|
||||
source='get_public_key_hash_md5', required=False, read_only=True, max_length=128
|
||||
)
|
||||
mfa_level = serializers.ChoiceField(choices=MFA_LEVEL_CHOICES, label=_('MFA'), required=False)
|
||||
mfa_level = LabeledChoiceField(choices=MFA_LEVEL_CHOICES, label=_("MFA"), required=False)
|
||||
guide_url = serializers.SerializerMethodField()
|
||||
receive_backends = serializers.ListField(child=serializers.CharField(), read_only=True)
|
||||
console_orgs = UserOrgSerializer(many=True, read_only=True)
|
||||
|
|
Loading…
Reference in New Issue