1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +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
# Maximum number of return / yield for function / method body.
max-returns=6
max-returns=9
# Maximum number of statements in function / method body.
max-statements=64

View File

@ -50,7 +50,7 @@ logger = logging.getLogger(__name__)
LDAP_RESULT_LIMIT = 100
# pylint: disable=too-many-instance-attributes
class SimpleLDAPAuthenticator(auths.Authenticator):
host = gui.TextField(
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.
@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:
attributes = attributes + [self._mfaAttr]

View File

@ -122,7 +122,7 @@ class RDPTransport(BaseRDPTransport):
width == '-1' or height == '-1', width, height, depth, target=os.os
)
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.password = password
r.domain = domain

View File

@ -30,7 +30,6 @@
"""
@author: Adolfo Gómez, dkmaster at dkmon dot com
"""
import os
import logging
import typing
@ -39,14 +38,6 @@ from uds.core.ui import gui
from uds.core import transports
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
if typing.TYPE_CHECKING:
from uds import models
@ -359,8 +350,7 @@ class BaseRDPTransport(transports.Transport):
if self.testServer(userService, ip, self.rdpPort.num()) is True:
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
return True
else:
self.cache.put(ip, 'N', READY_CACHE_TIMEOUT)
self.cache.put(ip, 'N', READY_CACHE_TIMEOUT)
return ready == 'Y'
def processedUser(

View File

@ -59,6 +59,7 @@ class TRDPTransport(BaseRDPTransport):
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
"""
isBase = False
iconFile = 'rdp-tunnel.png'
@ -91,9 +92,7 @@ class TRDPTransport(BaseRDPTransport):
verifyCertificate = gui.CheckBoxField(
label=_('Force SSL certificate verification'),
order=23,
tooltip=_(
'If enabled, the certificate of tunnel server will be verified (recommended).'
),
tooltip=_('If enabled, the certificate of tunnel server will be verified (recommended).'),
defvalue=gui.FALSE,
tab=gui.Tab.TUNNEL,
)
@ -168,9 +167,7 @@ class TRDPTransport(BaseRDPTransport):
tunHost, tunPort = self.tunnelServer.value.split(':')
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.enablecredsspsupport = ci.get('sso') == 'True' or self.credssp.isTrue()
r.address = '{address}'
r.username = username
@ -237,10 +234,6 @@ class TRDPTransport(BaseRDPTransport):
'Os not valid for RDP Transport: %s',
request.META.get('HTTP_USER_AGENT', 'Unknown'),
)
return super().getUDSTransportScript(
userService, transport, ip, os, user, password, request
)
return super().getUDSTransportScript(userService, transport, ip, os, user, password, request)
return self.getScript(os.os.os_name(), 'tunnel', sp)