mirror of https://github.com/jumpserver/jumpserver
fix: windows 平台默认不开启 console
parent
ebdd67d0f4
commit
891d9d36b0
|
@ -39,7 +39,7 @@ class Protocol(ChoicesMixin, models.TextChoices):
|
||||||
'port': 3389,
|
'port': 3389,
|
||||||
'secret_types': ['password'],
|
'secret_types': ['password'],
|
||||||
'setting': {
|
'setting': {
|
||||||
'console': True,
|
'console': False,
|
||||||
'security': 'any',
|
'security': 'any',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Generated by Django 3.2.17 on 2023-03-15 09:41
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def set_windows_platform_non_console(apps, schema_editor):
|
||||||
|
Platform = apps.get_model('assets', 'Platform')
|
||||||
|
names = ['Windows', 'Windows-RDP', 'Windows-TLS', 'RemoteAppHost']
|
||||||
|
windows = Platform.objects.filter(name__in=names)
|
||||||
|
if not windows:
|
||||||
|
return
|
||||||
|
|
||||||
|
for p in windows:
|
||||||
|
rdp = p.protocols.filter(name='rdp').first()
|
||||||
|
if not rdp:
|
||||||
|
continue
|
||||||
|
rdp.setting['console'] = False
|
||||||
|
rdp.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('assets', '0109_alter_asset_options'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(set_windows_platform_non_console)
|
||||||
|
]
|
|
@ -11,7 +11,7 @@ __all__ = ['Platform', 'PlatformProtocol', 'PlatformAutomation']
|
||||||
|
|
||||||
class PlatformProtocol(models.Model):
|
class PlatformProtocol(models.Model):
|
||||||
SETTING_ATTRS = {
|
SETTING_ATTRS = {
|
||||||
'console': True,
|
'console': False,
|
||||||
'security': 'any,tls,rdp',
|
'security': 'any,tls,rdp',
|
||||||
'sftp_enabled': True,
|
'sftp_enabled': True,
|
||||||
'sftp_home': '/tmp'
|
'sftp_home': '/tmp'
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from django.core import validators
|
|
||||||
|
|
||||||
from assets.const.web import FillType
|
from assets.const.web import FillType
|
||||||
from common.serializers import WritableNestedModelSerializer
|
from common.serializers import WritableNestedModelSerializer
|
||||||
|
@ -19,7 +18,7 @@ class ProtocolSettingSerializer(serializers.Serializer):
|
||||||
("nla", "NLA"),
|
("nla", "NLA"),
|
||||||
]
|
]
|
||||||
# RDP
|
# RDP
|
||||||
console = serializers.BooleanField(required=False)
|
console = serializers.BooleanField(required=False, default=False)
|
||||||
security = serializers.ChoiceField(choices=SECURITY_CHOICES, default="any")
|
security = serializers.ChoiceField(choices=SECURITY_CHOICES, default="any")
|
||||||
|
|
||||||
# SFTP
|
# SFTP
|
||||||
|
|
Loading…
Reference in New Issue