Merge pull request #9568 from jumpserver/pr@dev@fix_koko_ssh

fix: 修复 koko ssh 方式的连接开关
pull/9575/head
老广 2 years ago committed by GitHub
commit 8be25e1944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -214,6 +214,12 @@ class ConnectMethodUtil:
@classmethod
def get_filtered_protocols_connect_methods(cls, os):
methods = dict(cls.get_protocols_connect_methods(os))
methods = cls._filter_disable_components_connect_methods(methods)
methods = cls._filter_disable_protocols_connect_methods(methods)
return methods
@classmethod
def _filter_disable_components_connect_methods(cls, methods):
component_setting = {
'razor': 'TERMINAL_RAZOR_ENABLED',
'magnus': 'TERMINAL_MAGNUS_ENABLED',
@ -227,6 +233,15 @@ class ConnectMethodUtil:
methods[protocol] = filtered_methods
return methods
@classmethod
def _filter_disable_protocols_connect_methods(cls, methods):
# 过滤一些特殊的协议方式
if not getattr(settings, 'TERMINAL_KOKO_SSH_ENABLED'):
protocol = Protocol.ssh
methods[protocol] = [m for m in methods[protocol] if m['type'] != 'native']
return methods
@classmethod
def get_protocols_connect_methods(cls, os):
if cls._all_methods is not None:

Loading…
Cancel
Save