1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-10 01:17:59 +03:00

Split usb sharing & auto new usb sharing into two options

This commit is contained in:
Adolfo Gómez García 2017-05-09 08:35:17 +02:00
parent 0ec3cb104a
commit 9bbd7fd57d
4 changed files with 24 additions and 10 deletions

View File

@ -100,11 +100,18 @@ class BaseSpiceTransport(Transport):
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB
)
enableUsbShare = gui.CheckBoxField(
usbShare = gui.CheckBoxField(
order=7,
label=_('USB Auto Sharing'),
tooltip=_('If checked, viewer will allow usb auto sharing.'),
defvalue=gui.TRUE,
label=_('USB'),
tooltip=_('If checked, USB redirection will be allowed.'),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB
)
autoNewUsbShare = gui.CheckBoxField(
order=7,
label=_('New USB Auto Sharing'),
tooltip=_('Auto-redirect USB devices when plugged in.'),
defvalue=gui.FALSE,
tab=gui.ADVANCED_TAB
)

View File

@ -8,7 +8,7 @@ import six
import os
__updated__ = '2017-05-05'
__updated__ = '2017-05-09'
TEMPLATE = '''[virt-viewer]
@ -22,7 +22,7 @@ title={title}:%d - Press SHIFT+F12 to Release Cursor
enable-smartcard={smartcard}
enable-usb-autoshare={usb_auto_share}
delete-this-file={delete_file}
usb-filter=-1,-1,-1,-1,{usb_auto_share}
usb-filter=-1,-1,-1,-1,{new_usb_auto_share}
tls-ciphers=DEFAULT
host-subject={host_subject}
ca={ca}
@ -46,6 +46,7 @@ class RemoteViewerFile(object):
smartcard = False
usb_auto_share = True
new_usb_auto_share = False
delete_file = True
@ -74,6 +75,7 @@ class RemoteViewerFile(object):
smartcard = '01'[self.smartcard]
delete_file = '01'[self.delete_file]
usb_auto_share = '01'[self.usb_auto_share]
new_usb_auto_share = '01'[self.new_usb_auto_share]
ca = self.ca.strip().replace('\n', '\\\\n') # So we get '\\n' and script works fine after replacement
@ -87,6 +89,7 @@ class RemoteViewerFile(object):
title=self.title,
smartcard=smartcard,
usb_auto_share=usb_auto_share,
new_usb_auto_share=new_usb_auto_share,
delete_file=delete_file,
host_subject=self.host_subject if self.tls_port != -1 else '',
ca=ca if tls_port != -1 else '',

View File

@ -58,7 +58,8 @@ class SPICETransport(BaseSpiceTransport):
# fixedPassword = BaseSpiceTransport.fixedPassword
serverCertificate = BaseSpiceTransport.serverCertificate
fullScreen = BaseSpiceTransport.fullScreen
enableUsbShare = BaseSpiceTransport.enableUsbShare
usbShare = BaseSpiceTransport.usbShare
autoNewUsbShare = BaseSpiceTransport.autoNewUsbShare
smartCardRedirect = BaseSpiceTransport.smartCardRedirect
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
@ -73,7 +74,8 @@ class SPICETransport(BaseSpiceTransport):
secure_port = -1 if secure_port is None else secure_port
r = RemoteViewerFile(con['address'], port, secure_port, con['ticket']['value'], self.serverCertificate.value, con['cert_subject'], fullscreen=self.fullScreen.isTrue())
r.usb_auto_share = self.enableUsbShare.isTrue()
r.usb_auto_share = self.usbShare.isTrue()
r.new_usb_auto_share = self.autoNewUsbShare.isTrue()
r.smartcard = self.smartCardRedirect.isTrue()
m = tools.DictAsObj({

View File

@ -68,7 +68,8 @@ class TSPICETransport(BaseSpiceTransport):
serverCertificate = BaseSpiceTransport.serverCertificate
fullScreen = BaseSpiceTransport.fullScreen
enableUsbShare = BaseSpiceTransport.enableUsbShare
usbShare = BaseSpiceTransport.usbShare
autoNewUsbShare = BaseSpiceTransport.autoNewUsbShare
smartCardRedirect = BaseSpiceTransport.smartCardRedirect
def initialize(self, values):
@ -92,7 +93,8 @@ class TSPICETransport(BaseSpiceTransport):
sshHost, sshPort = self.tunnelServer.value.split(':')
r = RemoteViewerFile('127.0.0.1', '{port}', '{secure_port}', con['ticket']['value'], self.serverCertificate.value, con['cert_subject'], fullscreen=self.fullScreen.isTrue())
r.usb_auto_share = self.enableUsbShare.isTrue()
r.usb_auto_share = self.usbShare.isTrue()
r.new_usb_auto_share = self.autoNewUsbShare.isTrue()
r.smartcard = self.smartCardRedirect.isTrue()
m = tools.DictAsObj({