Added clipboard enabling/disabling on transport

This commit is contained in:
Adolfo Gómez García 2017-09-01 12:37:13 +02:00
parent 59635839cf
commit 611f3590e6
4 changed files with 34 additions and 21 deletions

View File

@ -42,7 +42,7 @@ from uds.core.util import connection
import logging
import os
__updated__ = '2017-06-05'
__updated__ = '2017-09-01'
logger = logging.getLogger(__name__)
@ -63,20 +63,21 @@ class BaseRDPTransport(Transport):
fixedPassword = gui.PasswordField(label=_('Password'), order=13, tooltip=_('If not empty, this password will be always used as credential'), tab=gui.CREDENTIALS_TAB)
withoutDomain = gui.CheckBoxField(label=_('Without Domain'), order=14, tooltip=_('If checked, the domain part will always be emptied (to connect to xrdp for example is needed)'), tab=gui.CREDENTIALS_TAB)
fixedDomain = gui.TextField(label=_('Domain'), order=15, tooltip=_('If not empty, this domain will be always used as credential (used as DOMAIN\\user)'), tab=gui.CREDENTIALS_TAB)
allowSmartcards = gui.CheckBoxField(label=_('Allow Smartcards'), order=16, tooltip=_('If checked, this transport will allow the use of smartcards'), tab=gui.PARAMETERS_TAB)
allowPrinters = gui.CheckBoxField(label=_('Allow Printers'), order=17, tooltip=_('If checked, this transport will allow the use of user printers'), tab=gui.PARAMETERS_TAB)
allowDrives = gui.CheckBoxField(label=_('Allow Drives'), order=18, tooltip=_('If checked, this transport will allow the use of user drives'), tab=gui.PARAMETERS_TAB)
allowSerials = gui.CheckBoxField(label=_('Allow Serials'), order=19, tooltip=_('If checked, this transport will allow the use of user serial ports'), tab=gui.PARAMETERS_TAB)
wallpaper = gui.CheckBoxField(label=_('Show wallpaper'), order=20, 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=21, 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=22, tooltip=_('If checked, desktop composition will be allowed'), tab=gui.PARAMETERS_TAB)
smooth = gui.CheckBoxField(label=_('Font Smoothing'), order=23, tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'), tab=gui.PARAMETERS_TAB)
credssp = gui.CheckBoxField(label=_('Credssp Support'), order=24, tooltip=_('If checked, will enable Credentials Provider Support)'), tab=gui.PARAMETERS_TAB)
multimedia = gui.CheckBoxField(label=_('Multimedia sync'), order=25, tooltip=_('If checked. Linux client will use multimedia parameter for xfreerdp'), tab='Linux Client')
alsa = gui.CheckBoxField(label=_('Use Alsa'), order=26, 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=27, tooltip=_('If printer is checked, the printer string used with xfreerdp client'), tab='Linux Client')
smartcardString = gui.TextField(label=_('Smartcard string'), order=28, tooltip=_('If smartcard is checked, the smartcard string used with xfreerdp client'), tab='Linux Client')
customParameters = gui.TextField(label=_('Custom parameters'), order=29, tooltip=_('If not empty, extra parameter to include for Linux Client (for example /usb:id,dev:054c:0268, or aything compatible with your xfreerdp client)'), tab='Linux Client')
allowSmartcards = gui.CheckBoxField(label=_('Allow Smartcards'), order=20, tooltip=_('If checked, this transport will allow the use of smartcards'), tab=gui.PARAMETERS_TAB)
allowPrinters = gui.CheckBoxField(label=_('Allow Printers'), order=21, tooltip=_('If checked, this transport will allow the use of user printers'), tab=gui.PARAMETERS_TAB)
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)
wallpaper = gui.CheckBoxField(label=_('Show wallpaper'), 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)
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')
smartcardString = gui.TextField(label=_('Smartcard string'), order=43, tooltip=_('If smartcard is checked, the smartcard string used with xfreerdp client'), tab='Linux Client')
customParameters = gui.TextField(label=_('Custom parameters'), order=44, tooltip=_('If not empty, extra parameter to include for Linux Client (for example /usb:id,dev:054c:0268, or aything compatible with your xfreerdp client)'), tab='Linux Client')
def isAvailableFor(self, userService, ip):
'''

View File

@ -40,7 +40,7 @@ from uds.core.util import OsDetector
import six
import os
__updated__ = '2017-07-26'
__updated__ = '2017-09-01'
class RDPFile(object):
@ -68,6 +68,7 @@ class RDPFile(object):
printerString = None
smartcardString = None
enablecredsspsupport = False
enableClipboard = False
linuxCustomParameters = None
def __init__(self, fullScreen, width, height, bpp, target=OsDetector.Windows):
@ -95,7 +96,10 @@ class RDPFile(object):
Parameters for xfreerdp >= 1.1.0 with self rdp description
Note that server is not added
'''
params = ['/clipboard', '/t:UDS-Connection', '/cert-ignore'] # , '/sec:rdp']
params = ['/t:UDS-Connection', '/cert-ignore'] # , '/sec:rdp']
if self.enableClipboard:
params.append('/clipboard')
if self.redirectSmartcards and self.smartcardString not in (None, ''):
params.append('/smartcard:{}'.format(self.smartcardString))
@ -158,7 +162,10 @@ class RDPFile(object):
Note that server is not added
'''
params = ['-TUDS Connection', '-P', '-rclipboard:PRIMARYCLIPBOARD']
params = ['-TUDS Connection', '-P']
if self.enableClipboard:
params.append('-rclipboard:PRIMARYCLIPBOARD')
if self.redirectSmartcards:
params.append('-rsdcard')
@ -215,6 +222,7 @@ class RDPFile(object):
bar = self.displayConnectionBar and "1" or "0"
disableWallpaper = self.showWallpaper and "0" or "1"
useMultimon = self.multimon and "1" or "0"
enableClipboard = self.enableClipboard and "1" or "0"
res = ''
res += 'screen mode id:i:' + screenMode + '\n'
@ -230,7 +238,7 @@ class RDPFile(object):
res += 'redirectprinters:i:' + printers + '\n'
res += 'redirectcomports:i:' + serials + '\n'
res += 'redirectsmartcards:i:' + scards + '\n'
res += 'redirectclipboard:i:1' + '\n'
res += 'redirectclipboard:i:' + enableClipboard + '\n'
res += 'displayconnectionbar:i:' + bar + '\n'
if len(self.username) != 0:
res += 'username:s:' + self.username + '\n'

View File

@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
READY_CACHE_TIMEOUT = 30
__updated__ = '2017-08-02'
__updated__ = '2017-09-01'
class RDPTransport(BaseRDPTransport):
@ -65,6 +65,7 @@ class RDPTransport(BaseRDPTransport):
allowPrinters = BaseRDPTransport.allowPrinters
allowDrives = BaseRDPTransport.allowDrives
allowSerials = BaseRDPTransport.allowSerials
allowClipboard = BaseRDPTransport.allowClipboard
wallpaper = BaseRDPTransport.wallpaper
multimon = BaseRDPTransport.multimon
aero = BaseRDPTransport.aero
@ -95,6 +96,7 @@ class RDPTransport(BaseRDPTransport):
r.redirectSmartcards = self.allowSmartcards.isTrue()
r.redirectDrives = self.allowDrives.isTrue()
r.redirectSerials = self.allowSerials.isTrue()
r.enableClipboard = self.allowClipboard.isTrue()
r.showWallpaper = self.wallpaper.isTrue()
r.multimon = self.multimon.isTrue()
r.desktopComposition = self.aero.isTrue()

View File

@ -48,7 +48,7 @@ import logging
import random
import string
__updated__ = '2017-06-05'
__updated__ = '2017-09-01'
logger = logging.getLogger(__name__)
@ -83,6 +83,7 @@ class TRDPTransport(BaseRDPTransport):
allowPrinters = BaseRDPTransport.allowPrinters
allowDrives = BaseRDPTransport.allowDrives
allowSerials = BaseRDPTransport.allowSerials
allowClipboard = BaseRDPTransport.allowClipboard
wallpaper = BaseRDPTransport.wallpaper
multimon = BaseRDPTransport.multimon
aero = BaseRDPTransport.aero
@ -125,6 +126,7 @@ class TRDPTransport(BaseRDPTransport):
r.redirectSmartcards = self.allowSmartcards.isTrue()
r.redirectDrives = self.allowDrives.isTrue()
r.redirectSerials = self.allowSerials.isTrue()
r.enableClipboard = self.allowClipboard.isTrue()
r.showWallpaper = self.wallpaper.isTrue()
r.multimon = self.multimon.isTrue()
r.desktopComposition = self.aero.isTrue()