1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-21 18:03:54 +03:00

RDP Transport fixes

* Now preferences are not for user, that is not useful. Now screen size,
color deppth, etc.. is selected on the transports.
* Preferences for RDP has been removed from "user preferences"
This commit is contained in:
Adolfo Gómez García 2017-12-15 12:33:15 +01:00
parent 6830d8db4e
commit 0f1d1af736
5 changed files with 75 additions and 24 deletions

View File

@ -87,6 +87,7 @@ class gui(object):
PARAMETERS_TAB = ugettext_noop('Parameters')
CREDENTIALS_TAB = ugettext_noop('Credentials')
TUNNEL_TAB = ugettext_noop('Tunnel')
DISPLAY_TAB = ugettext_noop('Display')
# : Static Callbacks simple registry
callbacks = {}
@ -347,6 +348,7 @@ class gui(object):
tooltip = _('Other info'), rdonly = True)
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._type(gui.InputField.TEXT_TYPE)
@ -375,6 +377,7 @@ class gui(object):
defvalue = '443', order = 1, tooltip = _('Port (usually 443)'),
required = True)
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
minValue = options.get('minValue', '987654321')
@ -463,6 +466,7 @@ class gui(object):
required = True)
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._type(gui.InputField.PASSWORD_TYPE)
@ -498,6 +502,7 @@ class gui(object):
self.hidden.setDefValue(self.parent().serialize())
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._isSerializable = options.get('serializable', '') != ''
@ -525,6 +530,7 @@ class gui(object):
tooltip = _('If checked, will use a ssl connection'))
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._type(gui.InputField.CHECKBOX_TYPE)
@ -628,6 +634,7 @@ class gui(object):
ev = gui.HiddenField() # ....
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._data['values'] = options.get('values', [])
@ -647,6 +654,7 @@ class gui(object):
self._data['values'] = values
class ImageChoiceField(InputField):
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._data['values'] = options.get('values', [])
@ -692,6 +700,7 @@ class gui(object):
{'id': '1', 'text': 'datastore1' } ]
)
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._data['values'] = options.get('values', [])
@ -750,6 +759,7 @@ class gui(object):
'''
Image field
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._type(gui.InputField.TEXT_TYPE)
@ -758,6 +768,7 @@ class gui(object):
'''
Informational field (no input is done)
'''
def __init__(self, **options):
super(self.__class__, self).__init__(**options)
self._type(gui.InputField.INFO_TYPE)
@ -768,6 +779,7 @@ class UserInterfaceType(type):
Metaclass definition for moving the user interface descriptions to a usable
better place
'''
def __new__(cls, classname, bases, classDict):
newClassDict = {}
_gui = {}

View File

@ -42,8 +42,7 @@ from uds.core.util import connection
import logging
import os
__updated__ = '2017-09-13'
__updated__ = '2017-12-15'
logger = logging.getLogger(__name__)
@ -68,11 +67,39 @@ class BaseRDPTransport(Transport):
allowDrives = gui.CheckBoxField(label=_('Allow Drives'), order=22, tooltip=_('If checked, this transport will allow the use of user drives'), tab=gui.PARAMETERS_TAB)
allowSerials = gui.CheckBoxField(label=_('Allow Serials'), order=23, tooltip=_('If checked, this transport will allow the use of user serial ports'), tab=gui.PARAMETERS_TAB)
allowClipboard = gui.CheckBoxField(label=_('Enable clipboard'), order=24, tooltip=_('If checked, copy-paste functions will be allowed'), tab=gui.PARAMETERS_TAB, defvalue=gui.TRUE)
wallpaper = gui.CheckBoxField(label=_('Wallpaper/theme'), order=25, tooltip=_('If checked, the wallpaper and themes will be shown on machine (better user experience, more bandwidth)'), tab=gui.PARAMETERS_TAB)
multimon = gui.CheckBoxField(label=_('Multiple monitors'), order=26, tooltip=_('If checked, all client monitors will be used for displaying (only works on windows clients)'), tab=gui.PARAMETERS_TAB)
aero = gui.CheckBoxField(label=_('Allow Desk.Comp.'), order=27, tooltip=_('If checked, desktop composition will be allowed'), tab=gui.PARAMETERS_TAB)
smooth = gui.CheckBoxField(label=_('Font Smoothing'), order=28, tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'), tab=gui.PARAMETERS_TAB)
credssp = gui.CheckBoxField(label=_('Credssp Support'), order=29, tooltip=_('If checked, will enable Credentials Provider Support)'), tab=gui.PARAMETERS_TAB)
credssp = gui.CheckBoxField(label=_('Credssp Support'), order=25, tooltip=_('If checked, will enable Credentials Provider Support)'), tab=gui.PARAMETERS_TAB)
screenSize = gui.ChoiceField(
label=_('Screen Size'),
order=30,
tooltip=_('Screen size for this transport'),
defvalue='-1x-1',
values=[
{'id': '640x480', 'text': '640x480' },
{'id': '800x600', 'text': '800x600' },
{'id': '1024x768', 'text': '1024x768' },
{'id': '1366x768', 'text': '1366x768' },
{'id': '1920x1080', 'text': '1920x1080' },
{'id': '-1x-1', 'text': 'Full screen' },
], tab=gui.DISPLAY_TAB)
colorDepth = gui.ChoiceField(
label=_('Color depth'),
order=31,
tooltip=_('Color depth for this conextion'),
defvalue='24',
values=[
{'id': '8', 'text': '8' },
{'id': '16', 'text': '16' },
{'id': '24', 'text': '24' },
{'id': '32', 'text': '32' },
], tab=gui.DISPLAY_TAB)
wallpaper = gui.CheckBoxField(label=_('Wallpaper/theme'), order=32, tooltip=_('If checked, the wallpaper and themes will be shown on machine (better user experience, more bandwidth)'), tab=gui.DISPLAY_TAB)
multimon = gui.CheckBoxField(label=_('Multiple monitors'), order=33, tooltip=_('If checked, all client monitors will be used for displaying (only works on windows clients)'), tab=gui.DISPLAY_TAB)
aero = gui.CheckBoxField(label=_('Allow Desk.Comp.'), order=34, tooltip=_('If checked, desktop composition will be allowed'), tab=gui.DISPLAY_TAB)
smooth = gui.CheckBoxField(label=_('Font Smoothing'), order=35, tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'), tab=gui.DISPLAY_TAB)
multimedia = gui.CheckBoxField(label=_('Multimedia sync'), order=40, tooltip=_('If checked. Linux client will use multimedia parameter for xfreerdp'), tab='Linux Client')
alsa = gui.CheckBoxField(label=_('Use Alsa'), order=41, tooltip=_('If checked, Linux client will try to use ALSA, otherwise Pulse will be used'), tab='Linux Client')
printerString = gui.TextField(label=_('Printer string'), order=42, tooltip=_('If printer is checked, the printer string used with xfreerdp client'), tab='Linux Client')

View File

@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30
__updated__ = '2017-11-14'
__updated__ = '2017-12-15'
class RDPTransport(BaseRDPTransport):
@ -72,6 +72,10 @@ class RDPTransport(BaseRDPTransport):
smooth = BaseRDPTransport.smooth
credssp = BaseRDPTransport.credssp
multimedia = BaseRDPTransport.multimedia
screenSize = BaseRDPTransport.screenSize
colorDepth = BaseRDPTransport.colorDepth
alsa = BaseRDPTransport.alsa
printerString = BaseRDPTransport.printerString
smartcardString = BaseRDPTransport.smartcardString
@ -79,15 +83,17 @@ class RDPTransport(BaseRDPTransport):
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
# We use helper to keep this clean
prefs = user.prefs('rdp')
# prefs = user.prefs('rdp')
ci = self.getConnectionInfo(userService, user, password)
username, password, domain = ci['username'], ci['password'], ci['domain']
width, height = CommonPrefs.getWidthHeight(prefs)
depth = CommonPrefs.getDepth(prefs)
# width, height = CommonPrefs.getWidthHeight(prefs)
# depth = CommonPrefs.getDepth(prefs)
width, height = self.screenSize.value.split('x')
depth = self.colorDepth.value
r = RDPFile(width == -1 or height == -1, width, height, depth, target=os['OS'])
r = RDPFile(width == '-1' or height == '-1', width, height, depth, target=os['OS'])
r.address = '{}:{}'.format(ip, 3389)
r.username = username
r.password = password

View File

@ -48,7 +48,7 @@ import logging
import random
import string
__updated__ = '2017-11-14'
__updated__ = '2017-12-15'
logger = logging.getLogger(__name__)
@ -88,6 +88,10 @@ class TRDPTransport(BaseRDPTransport):
smooth = BaseRDPTransport.smooth
credssp = BaseRDPTransport.credssp
multimedia = BaseRDPTransport.multimedia
screenSize = BaseRDPTransport.screenSize
colorDepth = BaseRDPTransport.colorDepth
alsa = BaseRDPTransport.alsa
printerString = BaseRDPTransport.printerString
smartcardString = BaseRDPTransport.smartcardString
@ -100,13 +104,15 @@ class TRDPTransport(BaseRDPTransport):
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
# We use helper to keep this clean
prefs = user.prefs('rdp')
# prefs = user.prefs('rdp')
ci = self.getConnectionInfo(userService, user, password)
username, password, domain = ci['username'], ci['password'], ci['domain']
width, height = CommonPrefs.getWidthHeight(prefs)
depth = CommonPrefs.getDepth(prefs)
# width, height = CommonPrefs.getWidthHeight(prefs)
# depth = CommonPrefs.getDepth(prefs)
width, height = self.screenSize.value.split('x')
depth = self.colorDepth.value
tunpass = ''.join(random.choice(string.letters + string.digits) for _i in range(12))
tunuser = TicketStore.create(tunpass)
@ -115,7 +121,7 @@ class TRDPTransport(BaseRDPTransport):
logger.debug('Username generated: {0}, password: {1}'.format(tunuser, tunpass))
r = RDPFile(width == -1 or height == -1, width, height, depth, target=os['OS'])
r = RDPFile(width == '-1' or height == '-1', width, height, depth, target=os['OS'])
r.address = '{address}'
r.username = username
r.password = password

View File

@ -36,10 +36,10 @@ from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from .RDPTransport import RDPTransport
from .TRDPTransport import TRDPTransport
UserPrefsManager.manager().registerPrefs('rdp',
_('Remote Desktop Protocol'),
[
CommonPrefs.screenSizePref,
CommonPrefs.depthPref
]
)
# UserPrefsManager.manager().registerPrefs('rdp',
# _('Remote Desktop Protocol'),
# [
# CommonPrefs.screenSizePref,
# CommonPrefs.depthPref
# ]
# )