|
|
@ -2,6 +2,7 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
from collections import defaultdict
|
|
|
|
from collections import defaultdict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from django.conf import settings
|
|
|
|
from django.db.models import TextChoices
|
|
|
|
from django.db.models import TextChoices
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
|
|
|
|
|
@ -78,6 +79,10 @@ class NativeClient(TextChoices):
|
|
|
|
return protocol
|
|
|
|
return protocol
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def xpack_methods(cls):
|
|
|
|
|
|
|
|
return [cls.sqlplus, cls.mstsc]
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def get_methods(cls, os='windows'):
|
|
|
|
def get_methods(cls, os='windows'):
|
|
|
|
clients_map = cls.get_native_clients()
|
|
|
|
clients_map = cls.get_native_clients()
|
|
|
@ -87,6 +92,8 @@ class NativeClient(TextChoices):
|
|
|
|
if isinstance(_clients, dict):
|
|
|
|
if isinstance(_clients, dict):
|
|
|
|
_clients = _clients.get(os, _clients['default'])
|
|
|
|
_clients = _clients.get(os, _clients['default'])
|
|
|
|
for client in _clients:
|
|
|
|
for client in _clients:
|
|
|
|
|
|
|
|
if not settings.XPACK_ENABLED and client in cls.xpack_methods():
|
|
|
|
|
|
|
|
continue
|
|
|
|
methods[protocol].append({
|
|
|
|
methods[protocol].append({
|
|
|
|
'value': client.value,
|
|
|
|
'value': client.value,
|
|
|
|
'label': client.label,
|
|
|
|
'label': client.label,
|
|
|
@ -121,8 +128,10 @@ class AppletMethod:
|
|
|
|
from .models import Applet, AppletHost
|
|
|
|
from .models import Applet, AppletHost
|
|
|
|
|
|
|
|
|
|
|
|
methods = defaultdict(list)
|
|
|
|
methods = defaultdict(list)
|
|
|
|
has_applet_hosts = AppletHost.objects.all().exists()
|
|
|
|
if not settings.XPACK_ENABLED:
|
|
|
|
|
|
|
|
return methods
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
has_applet_hosts = AppletHost.objects.all().exists()
|
|
|
|
applets = Applet.objects.filter(is_active=True)
|
|
|
|
applets = Applet.objects.filter(is_active=True)
|
|
|
|
for applet in applets:
|
|
|
|
for applet in applets:
|
|
|
|
for protocol in applet.protocols:
|
|
|
|
for protocol in applet.protocols:
|
|
|
|