Refactorizing gui variables

This commit is contained in:
Adolfo Gómez García 2022-09-12 14:21:55 +02:00
parent ce8bb30cf1
commit f7888468c0
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
38 changed files with 267 additions and 178 deletions

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2022 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""

View File

@ -91,7 +91,7 @@ class Dispatcher(View):
service = Dispatcher.services
full_path_lst: typing.List[str] = []
# Guess content type from content type header (post) or ".xxx" to method
content_type: str = request.META.get('CONTENT_TYPE', 'json')
content_type: str = request.META.get('CONTENT_TYPE', 'application/json').split(';')[0]
while path:
clean_path = path[0]
@ -111,13 +111,13 @@ class Dispatcher(View):
logger.debug("REST request: %s (%s)", full_path, content_type)
# Here, service points to the path and the value of '' is the handler
cls: typing.Optional[typing.Type[Handler]] = service['']
cls: typing.Optional[typing.Type[Handler]] = service[''] # Get "root" class, that is stored on
if not cls:
return http.HttpResponseNotFound(
'Method not found', content_type="text/plain"
)
processor = processors.available_processors_ext_dict.get(
processor = processors.available_processors_mime_dict .get(
content_type, processors.default_processor
)(request)

View File

@ -139,7 +139,7 @@ class Authenticators(ModelHandler):
),
'type': gui.InputField.CHOICE_TYPE,
'order': 108,
'tab': gui.MFA_TAB,
'tab': gui.Tab.MFA,
},
)
return field

View File

@ -181,7 +181,7 @@ class MetaPools(ModelHandler):
'tooltip': gettext('Image assocciated with this service'),
'type': gui.InputField.IMAGECHOICE_TYPE,
'order': 120,
'tab': gui.DISPLAY_TAB,
'tab': gui.Tab.DISPLAY,
},
{
'name': 'servicesPoolGroup_id',
@ -198,7 +198,7 @@ class MetaPools(ModelHandler):
),
'type': gui.InputField.IMAGECHOICE_TYPE,
'order': 121,
'tab': gui.DISPLAY_TAB,
'tab': gui.Tab.DISPLAY,
},
{
'name': 'visible',
@ -207,7 +207,7 @@ class MetaPools(ModelHandler):
'tooltip': gettext('If active, metapool will be visible for users'),
'type': gui.InputField.CHECKBOX_TYPE,
'order': 123,
'tab': gui.DISPLAY_TAB,
'tab': gui.Tab.DISPLAY,
},
{
'name': 'calendar_message',
@ -218,7 +218,7 @@ class MetaPools(ModelHandler):
),
'type': gui.InputField.TEXT_TYPE,
'order': 124,
'tab': gui.DISPLAY_TAB,
'tab': gui.Tab.DISPLAY,
},
{
'name': 'transport_grouping',
@ -230,7 +230,7 @@ class MetaPools(ModelHandler):
'tooltip': gettext('Transport selection policy'),
'type': gui.InputField.CHOICE_TYPE,
'order': 125,
'tab': gui.DISPLAY_TAB,
'tab': gui.Tab.DISPLAY,
},
]:
self.addField(localGUI, field)

View File

@ -106,7 +106,7 @@ class Transports(ModelHandler):
'If empty, any kind of device compatible with this transport will be allowed. Else, only devices compatible with selected values will be allowed'
),
'type': 'multichoice',
'tab': gui.ADVANCED_TAB,
'tab': gui.Tab.ADVANCED,
'order': 102,
},
)
@ -138,7 +138,7 @@ class Transports(ModelHandler):
),
'type': 'text',
'order': 201,
'tab': gettext(gui.ADVANCED_TAB),
'tab': gettext(gui.Tab.ADVANCED),
},
)

View File

@ -222,7 +222,7 @@ class BaseModelHandler(Handler):
),
'type': 'choice',
'order': 100, # At end
'tab': uiGui.ADVANCED_TAB,
'tab': uiGui.Tab.ADVANCED,
},
)
self.addField(
@ -240,7 +240,7 @@ class BaseModelHandler(Handler):
),
'type': 'multichoice',
'order': 101,
'tab': uiGui.ADVANCED_TAB,
'tab': uiGui.Tab.ADVANCED,
},
)

View File

@ -54,7 +54,7 @@ class IPAuth(auths.Authenticator):
'If checked, requests via proxy will get FORWARDED ip address'
' (take care with this bein checked, can take internal IP addresses from internet)'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
visibleFromNets = gui.TextField(
@ -64,7 +64,7 @@ class IPAuth(auths.Authenticator):
tooltip=_(
'This authenticator will be visible only from these networks. Leave empty to allow all networks'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
typeName = _('IP Authenticator')

View File

@ -73,7 +73,7 @@ class InternalDBAuth(auths.Authenticator):
tooltip=_('If checked, each host will have a different user name'),
defvalue='false',
rdonly=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
reverseDns = gui.CheckBoxField(
label=_('Reverse DNS'),
@ -81,7 +81,7 @@ class InternalDBAuth(auths.Authenticator):
tooltip=_('If checked, the host will be reversed dns'),
defvalue='false',
rdonly=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
acceptProxy = gui.CheckBoxField(
label=_('Accept proxy'),
@ -90,7 +90,7 @@ class InternalDBAuth(auths.Authenticator):
tooltip=_(
'If checked, requests via proxy will get FORWARDED ip address (take care with this bein checked, can take internal IP addresses from internet)'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def getIp(self, request: 'ExtendedHttpRequest') -> str:

View File

@ -91,7 +91,7 @@ class RadiusAuth(auths.Authenticator):
order=10,
tooltip=_('NAS Identifier for Radius Server'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
appClassPrefix = gui.TextField(
@ -100,7 +100,7 @@ class RadiusAuth(auths.Authenticator):
defvalue='',
order=11,
tooltip=_('Application prefix for filtering groups from "Class" attribute'),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
globalGroup = gui.TextField(
@ -109,7 +109,7 @@ class RadiusAuth(auths.Authenticator):
defvalue='',
order=12,
tooltip=_('If set, this value will be added as group for all radius users'),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
mfaAttr = gui.TextField(
length=2048,
@ -118,7 +118,7 @@ class RadiusAuth(auths.Authenticator):
order=13,
tooltip=_('Attribute from where to extract the MFA code'),
required=False,
tab=gui.MFA_TAB,
tab=gui.Tab.MFA,
)
def initialize(self, values: typing.Optional[typing.Dict[str, typing.Any]]) -> None:

View File

@ -91,7 +91,7 @@ class RegexLdap(auths.Authenticator):
order=4,
tooltip=_('Username with read privileges on the base selected'),
required=True,
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
password = gui.PasswordField(
lenth=32,
@ -99,7 +99,7 @@ class RegexLdap(auths.Authenticator):
order=5,
tooltip=_('Password of the ldap user'),
required=True,
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
timeout = gui.NumericField(
length=3,
@ -182,7 +182,7 @@ class RegexLdap(auths.Authenticator):
order=13,
tooltip=_('Attribute from where to extract the MFA code'),
required=False,
tab=gui.MFA_TAB,
tab=gui.Tab.MFA,
)
typeName = _('Regex LDAP Authenticator')

View File

@ -193,7 +193,7 @@ class SAMLAuthenticator(auths.Authenticator):
defvalue=False,
order=10,
tooltip=_('If set, logout from UDS will trigger SAML logout'),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
adFS = gui.CheckBoxField(
@ -201,7 +201,7 @@ class SAMLAuthenticator(auths.Authenticator):
defvalue=False,
order=11,
tooltip=_('If set, enable lowercase url encoding so ADFS can work correctly'),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
checkSSLCertificate = gui.CheckBoxField(

View File

@ -82,7 +82,7 @@ class SimpleLDAPAuthenticator(auths.Authenticator):
order=4,
tooltip=_('Username with read privileges on the base selected'),
required=True,
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
password = gui.PasswordField(
lenth=32,
@ -90,7 +90,7 @@ class SimpleLDAPAuthenticator(auths.Authenticator):
order=5,
tooltip=_('Password of the ldap user'),
required=True,
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
timeout = gui.NumericField(
length=3,

View File

@ -30,7 +30,6 @@
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
import imp
import typing
from uds.core.util import factory

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2021 Virtual Cable S.L.U.
# Copyright (c) 2012-2022 Virtual Cable S.L.U.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@ -33,16 +33,18 @@
import codecs
import datetime
import time
import pickle
import pickle # nosec: safe usage
import copy
import typing
import logging
import enum
from collections import abc
from django.utils.translation import get_language, gettext as _, gettext_noop
from django.conf import settings
from uds.core.managers import cryptoManager
from uds.core.util.decorators import deprecatedClassValue
logger = logging.getLogger(__name__)
@ -101,18 +103,45 @@ class gui:
]
ChoiceType = typing.Dict[str, str]
# : True string value
TRUE: typing.ClassVar[str] = 'true'
# : False string value
FALSE: typing.ClassVar[str] = 'false'
# : String for advanced tabs
ADVANCED_TAB: typing.ClassVar[str] = gettext_noop('Advanced')
PARAMETERS_TAB: typing.ClassVar[str] = gettext_noop('Parameters')
CREDENTIALS_TAB: typing.ClassVar[str] = gettext_noop('Credentials')
TUNNEL_TAB: typing.ClassVar[str] = gettext_noop('Tunnel')
DISPLAY_TAB: typing.ClassVar[str] = gettext_noop('Display')
MFA_TAB: typing.ClassVar[str] = gettext_noop('MFA')
class Tab(enum.Enum):
ADVANCED = gettext_noop('Advanced')
PARAMETERS = gettext_noop('Parameters')
CREDENTIALS = gettext_noop('Credentials')
TUNNEL = gettext_noop('Tunnel')
DISPLAY = gettext_noop('Display')
MFA = gettext_noop('MFA')
def __str__(self) -> str:
return str(self.value)
# : For backward compatibility, will be removed in future versions
# For now, will log an warning if used
@deprecatedClassValue('gui.Tab.ADVANCED')
def ADVANCED_TAB(cls) -> str:
return str(gui.Tab.ADVANCED)
@deprecatedClassValue('gui.Tab.PARAMETERS')
def PARAMETERS_TAB(cls) -> str:
return str(gui.Tab.PARAMETERS)
@deprecatedClassValue('gui.Tab.CREDENTIALS')
def CREDENTIALS_TAB(cls) -> str:
return str(gui.Tab.CREDENTIALS)
@deprecatedClassValue('gui.Tab.TUNNEL')
def TUNNEL_TAB(cls) -> str:
return str(gui.Tab.TUNNEL)
@deprecatedClassValue('gui.Tab.DISPLAY')
def DISPLAY_TAB(cls) -> str:
return str(gui.Tab.DISPLAY)
@deprecatedClassValue('gui.Tab.MFA')
def MFA_TAB(cls) -> str:
return str(gui.Tab.MFA)
# : Static Callbacks simple registry
callbacks: typing.Dict[
@ -296,7 +325,7 @@ class gui:
'value': options.get('value', ''),
}
if 'tab' in options:
self._data['tab'] = options.get('tab')
self._data['tab'] = str(options.get('tab')) # Ensure it's a string
def _type(self, type_: str) -> None:
"""
@ -360,7 +389,7 @@ class gui:
data['label'] = _(data['label']) if data['label'] else ''
data['tooltip'] = _(data['tooltip']) if data['tooltip'] else ''
if 'tab' in data:
data['tab'] = _(data['tab'])
data['tab'] = _(data['tab']) # Translates tab name
return data
@property
@ -1142,7 +1171,7 @@ class UserInterface(metaclass=UserInterfaceType):
if k in self._gui:
try:
if v.startswith(MULTIVALUE_FIELD):
val = pickle.loads(v[1:])
val = pickle.loads(v[1:]) # nosec: secure pickled by us for sure
elif v.startswith(OLD_PASSWORD_FIELD):
val = cryptoManager().AESDecrypt(v[1:], UDSB, True).decode()
elif v.startswith(PASSWORD_FIELD):

View File

@ -30,38 +30,42 @@
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
from functools import wraps
import functools
import logging
import inspect
import typing
import threading
from uds.core.util.html import checkBrowser
if typing.TYPE_CHECKING:
from uds.core.util.cache import Cache
from uds.web.util import errors
logger = logging.getLogger(__name__)
RT = typing.TypeVar('RT')
def _defaultDenyView(request) -> typing.Any:
from uds.web.util import errors
return errors.errorView(
request, errors.BROWSER_NOT_SUPPORTED
)
# Decorator that protects pages that needs at least a browser version
# Default is to deny IE < 9
def denyBrowsers(
browsers: typing.Optional[typing.List[str]] = None,
errorResponse: typing.Callable = lambda request: errors.errorView(
request, errors.BROWSER_NOT_SUPPORTED
),
errorResponse: typing.Callable = _defaultDenyView,
) -> typing.Callable[[typing.Callable[..., RT]], typing.Callable[..., RT]]:
"""
Decorator to set protection to access page
Look for samples at uds.core.web.views
"""
from uds.core.util.html import checkBrowser
denied: typing.List[str] = browsers or ['ie<9']
def wrap(view_func: typing.Callable[..., RT]) -> typing.Callable[..., RT]:
@wraps(view_func)
@functools.wraps(view_func)
def _wrapped_view(request, *args, **kwargs) -> RT:
"""
Wrapped function for decorator
@ -82,7 +86,7 @@ def deprecated(func: typing.Callable[..., RT]) -> typing.Callable[..., RT]:
as deprecated. It will result in a warning being emitted
when the function is used."""
@wraps(func)
@functools.wraps(func)
def new_func(*args, **kwargs) -> RT:
try:
caller = inspect.stack()[1]
@ -99,11 +103,37 @@ def deprecated(func: typing.Callable[..., RT]) -> typing.Callable[..., RT]:
return new_func
def deprecatedClassValue(newVarName: str) -> typing.Callable:
class innerDeprecated:
fget: typing.Callable
new_var_name: str
def __init__(self, method: typing.Callable, newVarName: str) -> None:
self.new_var_name = newVarName
self.fget = method # type: ignore
def __get__(self, instance, cls=None):
try:
caller = inspect.stack()[1]
logger.warning(
'Use of deprecated class value %s from %s:%s. Use %s instead.',
self.fget.__name__,
caller[1],
caller[2],
self.new_var_name,
)
except Exception:
logger.info('No stack info on deprecated value use %s', self.fget.__name__)
return self.fget(cls)
return functools.partial(innerDeprecated, newVarName=newVarName)
def ensureConected(func: typing.Callable[..., RT]) -> typing.Callable[..., RT]:
"""This decorator calls "connect" method of the class of the wrapped object"""
@wraps(func)
@functools.wraps(func)
def new_func(*args, **kwargs) -> RT:
args[0].connect()
return func(*args, **kwargs)
@ -117,7 +147,7 @@ def ensureConected(func: typing.Callable[..., RT]) -> typing.Callable[..., RT]:
# Decorator that tries to get from cache before executing
def allowCache(
cachePrefix: str,
cacheTimeout: typing.Union[typing.Callable[[], int], int] = Cache.DEFAULT_VALIDITY,
cacheTimeout: typing.Union[typing.Callable[[], int], int] = -1,
cachingArgs: typing.Optional[
typing.Union[typing.List[int], typing.Tuple[int], int]
] = None,
@ -136,10 +166,11 @@ def allowCache(
:param cachingKWArgs: The caching kwargs. Can be a single string or a list.
:param cachingKeyFnc: A function that receives the args and kwargs and returns the key
"""
cacheTimeout = Cache.DEFAULT_VALIDITY if cacheTimeout == -1 else cacheTimeout
keyFnc = cachingKeyFnc or (lambda x: '')
def allowCacheDecorator(fnc: typing.Callable[..., RT]) -> typing.Callable[..., RT]:
@wraps(fnc)
@functools.wraps(fnc)
def wrapper(*args, **kwargs) -> RT:
argList: typing.List[str] = []
if cachingArgs:
@ -202,7 +233,7 @@ def allowCache(
def threaded(func: typing.Callable[..., None]) -> typing.Callable[..., None]:
"""Decorator to execute method in a thread"""
@wraps(func)
@functools.wraps(func)
def wrapper(*args, **kwargs) -> None:
thread = threading.Thread(target=func, args=args, kwargs=kwargs)
thread.start()

View File

@ -55,7 +55,7 @@ class SampleMFA(mfas.MFA):
tooltip=_(
'This is a useless field, for sample and testing pourposes'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
defvalue=gui.TRUE,
)

View File

@ -91,7 +91,7 @@ class LinuxOsManager(osmanagers.OSManager):
tooltip=_(
'If checked, UDS will try to logout user when the calendar for his current access expires'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
defvalue=gui.TRUE,
)

View File

@ -82,7 +82,7 @@ class WindowsOsManager(osmanagers.OSManager):
tooltip=_(
'If checked, UDS will try to logout user when the calendar for his current access expires'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
defvalue=gui.TRUE,
)

View File

@ -141,7 +141,7 @@ class OVirtProvider(
order=50,
tooltip=_('Maximum number of concurrently creating VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxRemovingServices = gui.NumericField(
length=3,
@ -152,7 +152,7 @@ class OVirtProvider(
order=51,
tooltip=_('Maximum number of concurrently removing VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
timeout = gui.NumericField(
@ -162,7 +162,7 @@ class OVirtProvider(
order=90,
tooltip=_('Timeout in seconds of connection to oVirt'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
macsRange = gui.TextField(
length=36,
@ -172,7 +172,7 @@ class OVirtProvider(
rdonly=True,
tooltip=_('Range of valid macs for UDS managed machines'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
# Own variables

View File

@ -136,7 +136,7 @@ class OGProvider(ServiceProvider):
order=6,
tooltip=_('URL used by OpenGnsys to access UDS. If empty, UDS will guess it.'),
required=False,
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
maxPreparingServices = gui.NumericField(
@ -148,7 +148,7 @@ class OGProvider(ServiceProvider):
order=50,
tooltip=_('Maximum number of concurrently creating VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxRemovingServices = gui.NumericField(
length=3,
@ -159,7 +159,7 @@ class OGProvider(ServiceProvider):
order=51,
tooltip=_('Maximum number of concurrently removing VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
timeout = gui.NumericField(
@ -169,7 +169,7 @@ class OGProvider(ServiceProvider):
order=90,
tooltip=_('Timeout in seconds of connection to OpenGnsys'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
# Own variables

View File

@ -154,7 +154,7 @@ class OGService(Service):
rdonly=False,
tooltip=_('Maximum number of allowed services (0 or less means no limit)'),
required=True,
tab=gui.ADVANCED_TAB
tab=gui.Tab.ADVANCED
)
ov = gui.HiddenField(value=None)

View File

@ -119,7 +119,7 @@ class OpenNebulaProvider(ServiceProvider): # pylint: disable=too-many-public-me
order=50,
tooltip=_('Maximum number of concurrently creating VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxRemovingServices = gui.NumericField(
length=3,
@ -130,7 +130,7 @@ class OpenNebulaProvider(ServiceProvider): # pylint: disable=too-many-public-me
order=51,
tooltip=_('Maximum number of concurrently removing VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
timeout = gui.NumericField(
@ -140,7 +140,7 @@ class OpenNebulaProvider(ServiceProvider): # pylint: disable=too-many-public-me
order=90,
tooltip=_('Timeout in seconds of connection to OpenNebula'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
# Own variables

View File

@ -149,7 +149,7 @@ class OpenStackProvider(ServiceProvider):
order=50,
tooltip=_('Maximum number of concurrently creating VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxRemovingServices = gui.NumericField(
length=3,
@ -160,7 +160,7 @@ class OpenStackProvider(ServiceProvider):
order=51,
tooltip=_('Maximum number of concurrently removing VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
timeout = gui.NumericField(
@ -172,7 +172,7 @@ class OpenStackProvider(ServiceProvider):
order=99,
tooltip=_('Timeout in seconds of connection to OpenStack'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
tenant = gui.TextField(
@ -184,7 +184,7 @@ class OpenStackProvider(ServiceProvider):
),
required=False,
defvalue='',
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
region = gui.TextField(
length=64,
@ -193,7 +193,7 @@ class OpenStackProvider(ServiceProvider):
tooltip=_('Region for this provider. Set only if required by server.'),
required=False,
defvalue='',
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
useSubnetsName = gui.CheckBoxField(
@ -203,7 +203,7 @@ class OpenStackProvider(ServiceProvider):
'If checked, the name of the subnets will be used instead of the names of networks'
),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
httpsProxy = gui.TextField(
@ -214,7 +214,7 @@ class OpenStackProvider(ServiceProvider):
'Proxy used on server connections for HTTPS connections (use PROTOCOL://host:port, i.e. http://10.10.0.1:8080)'
),
required=False,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
legacy = False

View File

@ -165,7 +165,7 @@ class ProviderLegacy(ServiceProvider):
order=50,
tooltip=_('Maximum number of concurrently creating VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxRemovingServices = gui.NumericField(
length=3,
@ -176,7 +176,7 @@ class ProviderLegacy(ServiceProvider):
order=51,
tooltip=_('Maximum number of concurrently removing VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
timeout = gui.NumericField(
@ -188,7 +188,7 @@ class ProviderLegacy(ServiceProvider):
order=99,
tooltip=_('Timeout in seconds of connection to OpenStack'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
httpsProxy = gui.TextField(
@ -199,7 +199,7 @@ class ProviderLegacy(ServiceProvider):
'Proxy used for connection to azure for HTTPS connections (use PROTOCOL://host:port, i.e. http://10.10.0.1:8080)'
),
required=False,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
# tenant = gui.TextField(length=64, label=_('Project'), order=6, tooltip=_('Project (tenant) for this provider'), required=True, defvalue='')

View File

@ -60,7 +60,7 @@ class PhysicalMachinesProvider(services.ServiceProvider):
order=3,
tooltip=_('Advanced configuration data for the provider'),
required=False,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def initialize(self, values: 'Module.ValuesType') -> None:

View File

@ -82,7 +82,7 @@ class IPMachinesService(IPServiceBase):
'If non zero, only hosts responding to connection on that port will be served.'
),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
skipTimeOnFailure = gui.NumericField(
length=6,
@ -92,7 +92,7 @@ class IPMachinesService(IPServiceBase):
tooltip=_('If a host fails to check, skip it for this time (in minutes).'),
minValue=0,
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxSessionForMachine = gui.NumericField(
@ -105,14 +105,14 @@ class IPMachinesService(IPServiceBase):
),
minValue=0,
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
lockByExternalAccess = gui.CheckBoxField(
label=_('Lock machine by external access'),
tooltip=_('If checked, UDS will lock the machine if it is accesed from outside UDS.'),
defvalue=False,
order=4,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
# Description of service

View File

@ -106,7 +106,7 @@ class ProxmoxProvider(
order=50,
tooltip=_('Maximum number of concurrently creating VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxRemovingServices = gui.NumericField(
length=3,
@ -117,7 +117,7 @@ class ProxmoxProvider(
order=51,
tooltip=_('Maximum number of concurrently removing VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
timeout = gui.NumericField(
@ -127,7 +127,7 @@ class ProxmoxProvider(
order=90,
tooltip=_('Timeout in seconds of connection to Proxmox'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
startVmId = gui.NumericField(
@ -140,7 +140,7 @@ class ProxmoxProvider(
tooltip=_('Starting machine id on proxmox'),
required=True,
rdonly=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
# Own variables

View File

@ -129,7 +129,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods
order=50,
tooltip=_('Maximum number of concurrently creating VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
maxRemovingServices = gui.NumericField(
length=3,
@ -140,7 +140,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods
order=51,
tooltip=_('Maximum number of concurrently removing VMs'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
macsRange = gui.TextField(
@ -151,7 +151,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods
rdonly=True,
tooltip=_('Range of valid macs for created machines'),
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
verifySSL = gui.CheckBoxField(
label=_('Verify Certificate'),
@ -159,7 +159,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods
tooltip=_(
'If selected, certificate will be checked against system valid certificate providers'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
defvalue=gui.FALSE,
)
@ -170,7 +170,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods
tooltip=_(
'XenServer BACKUP IP or Hostname (used on connection failure to main server)'
),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
required=False,
)

View File

@ -80,7 +80,7 @@ class HTML5RDPTransport(transports.Transport):
defvalue='https://',
length=64,
required=True,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
useGlyptodonTunnel = gui.CheckBoxField(
@ -89,26 +89,26 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_(
'If checked, UDS will use Glyptodon Enterprise Tunnel for HTML tunneling instead of UDS Tunnel'
),
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
useEmptyCreds = gui.CheckBoxField(
label=_('Empty creds'),
order=3,
tooltip=_('If checked, the credentials used to connect will be emtpy'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedName = gui.TextField(
label=_('Username'),
order=4,
tooltip=_('If not empty, this username will be always used as credential'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedPassword = gui.PasswordField(
label=_('Password'),
order=5,
tooltip=_('If not empty, this password will be always used as credential'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
withoutDomain = gui.CheckBoxField(
label=_('Without Domain'),
@ -116,7 +116,7 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_(
'If checked, the domain part will always be emptied (to connecto to xrdp for example is needed)'
),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedDomain = gui.TextField(
label=_('Domain'),
@ -124,7 +124,7 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_(
'If not empty, this domain will be always used as credential (used as DOMAIN\\user)'
),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
wallpaper = gui.CheckBoxField(
label=_('Show wallpaper'),
@ -132,19 +132,19 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_(
'If checked, the wallpaper and themes will be shown on machine (better user experience, more bandwidth)'
),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
desktopComp = gui.CheckBoxField(
label=_('Allow Desk.Comp.'),
order=19,
tooltip=_('If checked, desktop composition will be allowed'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
smooth = gui.CheckBoxField(
label=_('Font Smoothing'),
order=20,
tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
enableAudio = gui.CheckBoxField(
label=_('Enable Audio'),
@ -152,7 +152,7 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_(
'If checked, the audio will be redirected to remote session (if client browser supports it)'
),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
defvalue=gui.TRUE,
)
enableAudioInput = gui.CheckBoxField(
@ -161,7 +161,7 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_(
'If checked, the microphone will be redirected to remote session (if client browser supports it)'
),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
enablePrinting = gui.CheckBoxField(
label=_('Enable Printing'),
@ -169,7 +169,7 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_(
'If checked, the printing will be redirected to remote session (if client browser supports it)'
),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
enableFileSharing = gui.ChoiceField(
label=_('File Sharing'),
@ -182,7 +182,7 @@ class HTML5RDPTransport(transports.Transport):
{'id': 'up', 'text': _('Allow upload only')},
{'id': 'true', 'text': _('Enable file sharing')},
],
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
enableClipboard = gui.ChoiceField(
label=_('Clipboard'),
@ -195,7 +195,7 @@ class HTML5RDPTransport(transports.Transport):
{'id': 'dis-paste', 'text': _('Disable paste to remote')},
{'id': 'enabled', 'text': _('Enable clipboard')},
],
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
serverLayout = gui.ChoiceField(
@ -225,7 +225,7 @@ class HTML5RDPTransport(transports.Transport):
gui.choiceItem('failsafe', _('Failsafe')),
],
defvalue='-',
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
ticketValidity = gui.NumericField(
@ -238,7 +238,7 @@ class HTML5RDPTransport(transports.Transport):
),
required=True,
minValue=60,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
forceNewWindow = gui.ChoiceField(
@ -260,7 +260,7 @@ class HTML5RDPTransport(transports.Transport):
),
],
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
security = gui.ChoiceField(
order=92,
@ -290,7 +290,7 @@ class HTML5RDPTransport(transports.Transport):
gui.choiceItem('tls', _('TLS (Transport Security Layer encryption)')),
],
defvalue='any',
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
rdpPort = gui.NumericField(
@ -300,7 +300,7 @@ class HTML5RDPTransport(transports.Transport):
tooltip=_('Use this port as RDP port. Defaults to 3389.'),
required=True, #: Numeric fields have always a value, so this not really needed
defvalue='3389',
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
customGEPath = gui.TextField(
@ -312,7 +312,7 @@ class HTML5RDPTransport(transports.Transport):
defvalue='/',
length=128,
required=False,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def initialize(self, values: 'Module.ValuesType'):

View File

@ -79,20 +79,20 @@ class HTML5VNCTransport(transports.Transport):
defvalue='https://',
length=64,
required=True,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
username = gui.TextField(
label=_('Username'),
order=20,
tooltip=_('Username for VNC connection authentication.'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
password = gui.PasswordField(
label=_('Password'),
order=21,
tooltip=_('Password for VNC connection authentication'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
vncPort = gui.NumericField(
@ -102,7 +102,7 @@ class HTML5VNCTransport(transports.Transport):
order=2,
tooltip=_('Port of the VNC server.'),
required=True,
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
colorDepth = gui.ChoiceField(
@ -118,7 +118,7 @@ class HTML5VNCTransport(transports.Transport):
gui.choiceItem('32', '33 bits'),
],
defvalue='-',
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
swapRedBlue = gui.CheckBoxField(
label=_('Swap red/blue'),
@ -126,19 +126,19 @@ class HTML5VNCTransport(transports.Transport):
tooltip=_(
'Use this if your colours seems incorrect (blue appears red, ..) to swap them.'
),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
cursor = gui.CheckBoxField(
label=_('Remote cursor'),
order=28,
tooltip=_('If set, force to show remote cursor'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
readOnly = gui.CheckBoxField(
label=_('Read only'),
order=29,
tooltip=_('If set, the connection will be read only'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
ticketValidity = gui.NumericField(
@ -151,7 +151,7 @@ class HTML5VNCTransport(transports.Transport):
),
required=True,
minValue=60,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
forceNewWindow = gui.ChoiceField(
order=91,
@ -172,7 +172,7 @@ class HTML5VNCTransport(transports.Transport):
),
],
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def initialize(self, values: 'Module.ValuesType'):

View File

@ -71,19 +71,19 @@ class BaseRDPTransport(transports.Transport):
label=_('Empty creds'),
order=11,
tooltip=_('If checked, the credentials used to connect will be emtpy'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedName = gui.TextField(
label=_('Username'),
order=12,
tooltip=_('If not empty, this username will be always used as credential'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedPassword = gui.PasswordField(
label=_('Password'),
order=13,
tooltip=_('If not empty, this password will be always used as credential'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
withoutDomain = gui.CheckBoxField(
label=_('Without Domain'),
@ -91,7 +91,7 @@ class BaseRDPTransport(transports.Transport):
tooltip=_(
'If checked, the domain part will always be emptied (to connect to xrdp for example is needed)'
),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedDomain = gui.TextField(
label=_('Domain'),
@ -99,20 +99,20 @@ class BaseRDPTransport(transports.Transport):
tooltip=_(
'If not empty, this domain will be always used as credential (used as DOMAIN\\user)'
),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
allowSmartcards = gui.CheckBoxField(
label=_('Allow Smartcards'),
order=20,
tooltip=_('If checked, this transport will allow the use of smartcards'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
allowPrinters = gui.CheckBoxField(
label=_('Allow Printers'),
order=21,
tooltip=_('If checked, this transport will allow the use of user printers'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
allowDrives = gui.ChoiceField(
label=_('Local drives policy'),
@ -124,7 +124,7 @@ class BaseRDPTransport(transports.Transport):
{'id': 'dynamic', 'text': 'Allow PnP drives'},
{'id': 'true', 'text': 'Allow any drive'},
],
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
enforceDrives = gui.TextField(
label=_('Force drives'),
@ -132,34 +132,34 @@ class BaseRDPTransport(transports.Transport):
tooltip=_(
'Use comma separated values, for example "C:,D:". If drives policy is disallowed, this will be ignored'
),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
allowSerials = gui.CheckBoxField(
label=_('Allow Serials'),
order=24,
tooltip=_('If checked, this transport will allow the use of user serial ports'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
allowClipboard = gui.CheckBoxField(
label=_('Enable clipboard'),
order=25,
tooltip=_('If checked, copy-paste functions will be allowed'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
defvalue=gui.TRUE,
)
allowAudio = gui.CheckBoxField(
label=_('Enable sound'),
order=26,
tooltip=_('If checked, sound will be redirected.'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
defvalue=gui.TRUE,
)
allowWebcam = gui.CheckBoxField(
label=_('Enable webcam'),
order=27,
tooltip=_('If checked, webcam will be redirected (ONLY Windows).'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
defvalue=gui.FALSE,
)
usbRedirection = gui.ChoiceField(
@ -176,14 +176,14 @@ class BaseRDPTransport(transports.Transport):
{'id': '{50dd5230-ba8a-11d1-bf5d-0000f805f530}', 'text': 'Smartcards'},
{'id': '{745a17a0-74d3-11d0-b6fe-00a0c90f57da}', 'text': 'HIDs'},
],
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
credssp = gui.CheckBoxField(
label=_('Credssp Support'),
order=29,
tooltip=_('If checked, will enable Credentials Provider Support)'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
defvalue=gui.TRUE,
)
rdpPort = gui.NumericField(
@ -191,7 +191,7 @@ class BaseRDPTransport(transports.Transport):
length=5, # That is, max allowed value is 65535
label=_('RDP Port'),
tooltip=_('Use this port as RDP port. Defaults to 3389.'),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
required=True, #: Numeric fields have always a value, so this not really needed
defvalue='3389',
)
@ -217,7 +217,7 @@ class BaseRDPTransport(transports.Transport):
{'id': '5120x2880', 'text': '5120x2880'},
{'id': '-1x-1', 'text': 'Full screen'},
],
tab=gui.DISPLAY_TAB,
tab=gui.Tab.DISPLAY,
)
colorDepth = gui.ChoiceField(
@ -231,7 +231,7 @@ class BaseRDPTransport(transports.Transport):
{'id': '24', 'text': '24'},
{'id': '32', 'text': '32'},
],
tab=gui.DISPLAY_TAB,
tab=gui.Tab.DISPLAY,
)
wallpaper = gui.CheckBoxField(
@ -240,7 +240,7 @@ class BaseRDPTransport(transports.Transport):
tooltip=_(
'If checked, the wallpaper and themes will be shown on machine (better user experience, more bandwidth)'
),
tab=gui.DISPLAY_TAB,
tab=gui.Tab.DISPLAY,
)
multimon = gui.CheckBoxField(
label=_('Multiple monitors'),
@ -248,26 +248,26 @@ class BaseRDPTransport(transports.Transport):
tooltip=_(
'If checked, all client monitors will be used for displaying (only works on windows clients)'
),
tab=gui.DISPLAY_TAB,
tab=gui.Tab.DISPLAY,
)
aero = gui.CheckBoxField(
label=_('Allow Desk.Comp.'),
order=35,
tooltip=_('If checked, desktop composition will be allowed'),
tab=gui.DISPLAY_TAB,
tab=gui.Tab.DISPLAY,
)
smooth = gui.CheckBoxField(
label=_('Font Smoothing'),
defvalue=gui.TRUE,
order=36,
tooltip=_('If checked, fonts smoothing will be allowed'),
tab=gui.DISPLAY_TAB,
tab=gui.Tab.DISPLAY,
)
showConnectionBar = gui.CheckBoxField(
label=_('Connection Bar'),
order=37,
tooltip=_('If checked, connection bar will be shown (only on Windows clients)'),
tab=gui.DISPLAY_TAB,
tab=gui.Tab.DISPLAY,
defvalue=gui.TRUE,
)

View File

@ -73,7 +73,7 @@ class TRDPTransport(BaseRDPTransport):
tooltip=_(
'IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'
),
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
tunnelWait = gui.NumericField(
@ -85,7 +85,7 @@ class TRDPTransport(BaseRDPTransport):
order=2,
tooltip=_('Maximum time to wait before closing the tunnel listener'),
required=True,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
verifyCertificate = gui.CheckBoxField(
@ -95,7 +95,7 @@ class TRDPTransport(BaseRDPTransport):
'If enabled, the certificate of tunnel server will be verified (recommended).'
),
defvalue=gui.FALSE,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
useEmptyCreds = BaseRDPTransport.useEmptyCreds

View File

@ -63,19 +63,19 @@ class BaseSpiceTransport(transports.Transport):
order=1,
label=_('Empty credentials'),
tooltip=_('If checked, the credentials used to connect will be emtpy'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedName = gui.TextField(
order=2,
label=_('Username'),
tooltip=_('If not empty, this username will be always used as credential'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
fixedPassword = gui.PasswordField(
order=3,
label=_('Password'),
tooltip=_('If not empty, this password will be always used as credential'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
serverCertificate = gui.TextField(
order=4,
@ -91,28 +91,28 @@ class BaseSpiceTransport(transports.Transport):
order=5,
label=_('Fullscreen Mode'),
tooltip=_('If checked, viewer will be shown on fullscreen mode-'),
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
smartCardRedirect = gui.CheckBoxField(
order=6,
label=_('Smartcard Redirect'),
tooltip=_('If checked, SPICE protocol will allow smartcard redirection.'),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
usbShare = gui.CheckBoxField(
order=7,
label=_('Enable USB'),
tooltip=_('If checked, USB redirection will be allowed.'),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
autoNewUsbShare = gui.CheckBoxField(
order=8,
label=_('New USB Auto Sharing'),
tooltip=_('Auto-redirect USB devices when plugged in.'),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def isAvailableFor(self, userService: 'models.UserService', ip: str) -> bool:

View File

@ -71,7 +71,7 @@ class TSPICETransport(BaseSpiceTransport):
tooltip=_(
'IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'
),
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
tunnelWait = gui.NumericField(
@ -83,7 +83,7 @@ class TSPICETransport(BaseSpiceTransport):
order=2,
tooltip=_('Maximum time to wait before closing the tunnel listener'),
required=True,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
verifyCertificate = gui.CheckBoxField(
@ -93,7 +93,7 @@ class TSPICETransport(BaseSpiceTransport):
'If enabled, the certificate of tunnel server will be verified (recommended).'
),
defvalue=gui.FALSE,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
serverCertificate = BaseSpiceTransport.serverCertificate

View File

@ -83,7 +83,7 @@ class TestTransport(transports.Transport):
'If checked, every connection will try to open its own window instead of reusing the "global" one.'
),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def initialize(self, values: 'Module.ValuesType'):

View File

@ -82,7 +82,7 @@ class URLCustomTransport(transports.Transport):
'If checked, every connection will try to open its own window instead of reusing the "global" one.'
),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def initialize(self, values: 'Module.ValuesType'):

View File

@ -71,7 +71,7 @@ class BaseX2GOTransport(transports.Transport):
order=2,
label=_('Username'),
tooltip=_('If not empty, this username will be always used as credential'),
tab=gui.CREDENTIALS_TAB,
tab=gui.Tab.CREDENTIALS,
)
screenSize = gui.ChoiceField(
@ -87,7 +87,7 @@ class BaseX2GOTransport(transports.Transport):
{'id': CommonPrefs.SZ_1920x1080, 'text': '1920x1080'},
{'id': CommonPrefs.SZ_FULLSCREEN, 'text': gettext_lazy('Full Screen')},
],
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
desktopType = gui.ChoiceField(
@ -105,7 +105,7 @@ class BaseX2GOTransport(transports.Transport):
{'id': 'gnome-session-cinnamon2d', 'text': 'Cinnamon 2.2 (see docs)'},
{'id': 'UDSVAPP', 'text': 'UDS vAPP'},
],
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
customCmd = gui.TextField(
@ -114,7 +114,7 @@ class BaseX2GOTransport(transports.Transport):
tooltip=_(
'If UDS vAPP is selected as "Desktop", the FULL PATH of the app to be executed. If UDS vAPP is not selected, this field will be ignored.'
),
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
sound = gui.CheckBoxField(
@ -122,7 +122,7 @@ class BaseX2GOTransport(transports.Transport):
label=_('Enable sound'),
tooltip=_('If checked, sound will be available'),
defvalue=gui.TRUE,
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
exports = gui.CheckBoxField(
@ -132,7 +132,7 @@ class BaseX2GOTransport(transports.Transport):
'If checked, user home folder will be redirected. (On linux, also redirects /media)'
),
defvalue=gui.FALSE,
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
speed = gui.ChoiceField(
@ -147,7 +147,7 @@ class BaseX2GOTransport(transports.Transport):
{'id': '3', 'text': 'WAN'},
{'id': '4', 'text': 'LAN'},
],
tab=gui.PARAMETERS_TAB,
tab=gui.Tab.PARAMETERS,
)
soundType = gui.ChoiceField(
@ -159,7 +159,7 @@ class BaseX2GOTransport(transports.Transport):
{'id': 'pulse', 'text': 'Pulse'},
{'id': 'esd', 'text': 'ESD'},
],
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
keyboardLayout = gui.TextField(
@ -167,7 +167,7 @@ class BaseX2GOTransport(transports.Transport):
order=31,
tooltip=_('Keyboard layout (es, us, fr, ...). Empty value means autodetect.'),
defvalue='',
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
# 'nopack', '8', '64', '256', '512', '4k', '32k', '64k', '256k', '2m', '16m'
# '256-rdp', '256-rdp-compressed', '32k-rdp', '32k-rdp-compressed', '64k-rdp'
@ -187,7 +187,7 @@ class BaseX2GOTransport(transports.Transport):
order=32,
tooltip=_('Pack format. Change with care!'),
defvalue='16m-jpeg',
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
quality = gui.NumericField(
@ -199,7 +199,7 @@ class BaseX2GOTransport(transports.Transport):
minValue=1,
maxValue=9,
required=True,
tab=gui.ADVANCED_TAB,
tab=gui.Tab.ADVANCED,
)
def isAvailableFor(self, userService: 'models.UserService', ip: str) -> bool:

View File

@ -71,7 +71,7 @@ class TX2GOTransport(BaseX2GOTransport):
tooltip=_(
'IP or Hostname of tunnel server sent to client device ("public" ip) and port. (use HOST:PORT format)'
),
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
tunnelWait = gui.NumericField(
@ -83,7 +83,7 @@ class TX2GOTransport(BaseX2GOTransport):
order=2,
tooltip=_('Maximum time to wait before closing the tunnel listener'),
required=True,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
verifyCertificate = gui.CheckBoxField(
@ -93,7 +93,7 @@ class TX2GOTransport(BaseX2GOTransport):
'If enabled, the certificate of tunnel server will be verified (recommended).'
),
defvalue=gui.FALSE,
tab=gui.TUNNEL_TAB,
tab=gui.Tab.TUNNEL,
)
fixedName = BaseX2GOTransport.fixedName