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

some minor formatting

This commit is contained in:
Adolfo Gómez García 2023-04-25 13:09:10 +02:00
parent 122d5c5634
commit 21e8b5aa56
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
5 changed files with 9 additions and 26 deletions

View File

@ -299,7 +299,7 @@ max-parents=7
max-public-methods=32 max-public-methods=32
# Maximum number of return / yield for function / method body. # Maximum number of return / yield for function / method body.
max-returns=6 max-returns=9
# Maximum number of statements in function / method body. # Maximum number of statements in function / method body.
max-statements=64 max-statements=64

View File

@ -50,7 +50,7 @@ logger = logging.getLogger(__name__)
LDAP_RESULT_LIMIT = 100 LDAP_RESULT_LIMIT = 100
# pylint: disable=too-many-instance-attributes
class SimpleLDAPAuthenticator(auths.Authenticator): class SimpleLDAPAuthenticator(auths.Authenticator):
host = gui.TextField( host = gui.TextField(
length=64, length=64,
@ -366,7 +366,7 @@ class SimpleLDAPAuthenticator(auths.Authenticator):
@return: None if username is not found, an dictionary of LDAP entry attributes if found. @return: None if username is not found, an dictionary of LDAP entry attributes if found.
@note: Active directory users contains the groups it belongs to in "memberOf" attribute @note: Active directory users contains the groups it belongs to in "memberOf" attribute
""" """
attributes = [i for i in self._userNameAttr.split(',') + [self._userIdAttr]] attributes = self._userNameAttr.split(',') + [self._userIdAttr]
if self._mfaAttr: if self._mfaAttr:
attributes = attributes + [self._mfaAttr] attributes = attributes + [self._mfaAttr]

View File

@ -122,7 +122,7 @@ class RDPTransport(BaseRDPTransport):
width == '-1' or height == '-1', width, height, depth, target=os.os width == '-1' or height == '-1', width, height, depth, target=os.os
) )
r.enablecredsspsupport = ci.get('sso') == 'True' or self.credssp.isTrue() r.enablecredsspsupport = ci.get('sso') == 'True' or self.credssp.isTrue()
r.address = '{}:{}'.format(ip, self.rdpPort.value) r.address = f'{ip}:{self.rdpPort.num()}'
r.username = username r.username = username
r.password = password r.password = password
r.domain = domain r.domain = domain

View File

@ -30,7 +30,6 @@
""" """
@author: Adolfo Gómez, dkmaster at dkmon dot com @author: Adolfo Gómez, dkmaster at dkmon dot com
""" """
import os
import logging import logging
import typing import typing
@ -39,14 +38,6 @@ from uds.core.ui import gui
from uds.core import transports from uds.core import transports
from uds.models import UserService from uds.models import UserService
# TODO: implement this finally?
def createADUser():
try:
from . import AD # type: ignore
except ImportError:
return
# Not imported at runtime, just for type checking # Not imported at runtime, just for type checking
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from uds import models from uds import models
@ -359,8 +350,7 @@ class BaseRDPTransport(transports.Transport):
if self.testServer(userService, ip, self.rdpPort.num()) is True: if self.testServer(userService, ip, self.rdpPort.num()) is True:
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT) self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
return True return True
else: self.cache.put(ip, 'N', READY_CACHE_TIMEOUT)
self.cache.put(ip, 'N', READY_CACHE_TIMEOUT)
return ready == 'Y' return ready == 'Y'
def processedUser( def processedUser(

View File

@ -59,6 +59,7 @@ class TRDPTransport(BaseRDPTransport):
Provides access via RDP to service. Provides access via RDP to service.
This transport can use an domain. If username processed by authenticator contains '@', it will split it and left-@-part will be username, and right password This transport can use an domain. If username processed by authenticator contains '@', it will split it and left-@-part will be username, and right password
""" """
isBase = False isBase = False
iconFile = 'rdp-tunnel.png' iconFile = 'rdp-tunnel.png'
@ -91,9 +92,7 @@ class TRDPTransport(BaseRDPTransport):
verifyCertificate = gui.CheckBoxField( verifyCertificate = gui.CheckBoxField(
label=_('Force SSL certificate verification'), label=_('Force SSL certificate verification'),
order=23, order=23,
tooltip=_( tooltip=_('If enabled, the certificate of tunnel server will be verified (recommended).'),
'If enabled, the certificate of tunnel server will be verified (recommended).'
),
defvalue=gui.FALSE, defvalue=gui.FALSE,
tab=gui.Tab.TUNNEL, tab=gui.Tab.TUNNEL,
) )
@ -168,9 +167,7 @@ class TRDPTransport(BaseRDPTransport):
tunHost, tunPort = self.tunnelServer.value.split(':') tunHost, tunPort = self.tunnelServer.value.split(':')
r = RDPFile( r = RDPFile(width == '-1' or height == '-1', width, height, depth, target=os.os)
width == '-1' or height == '-1', width, height, depth, target=os.os
)
r.enablecredsspsupport = ci.get('sso') == 'True' or self.credssp.isTrue() r.enablecredsspsupport = ci.get('sso') == 'True' or self.credssp.isTrue()
r.address = '{address}' r.address = '{address}'
r.username = username r.username = username
@ -237,10 +234,6 @@ class TRDPTransport(BaseRDPTransport):
'Os not valid for RDP Transport: %s', 'Os not valid for RDP Transport: %s',
request.META.get('HTTP_USER_AGENT', 'Unknown'), request.META.get('HTTP_USER_AGENT', 'Unknown'),
) )
return super().getUDSTransportScript( return super().getUDSTransportScript(userService, transport, ip, os, user, password, request)
userService, transport, ip, os, user, password, request
)
return self.getScript(os.os.os_name(), 'tunnel', sp) return self.getScript(os.os.os_name(), 'tunnel', sp)