forked from shaba/openuds
Merge remote-tracking branch 'origin/v3.5'
This commit is contained in:
commit
9ca143c2db
@ -96,7 +96,7 @@ class Transports(ModelHandler):
|
|||||||
'value': [],
|
'value': [],
|
||||||
'values': sorted(
|
'values': sorted(
|
||||||
[
|
[
|
||||||
{'id': x.value[0], 'text': x.value[0].replace('CrOS', 'Chrome OS')}
|
{'id': x.name, 'text': x.name}
|
||||||
for x in OsDetector.knownOss
|
for x in OsDetector.knownOss
|
||||||
],
|
],
|
||||||
key=lambda x: x['text'].lower(),
|
key=lambda x: x['text'].lower(),
|
||||||
|
@ -157,7 +157,7 @@ class Transport(Module):
|
|||||||
Helper method to check if transport supports requested operating system.
|
Helper method to check if transport supports requested operating system.
|
||||||
Class method
|
Class method
|
||||||
"""
|
"""
|
||||||
return cls.supportedOss.count(osType) > 0
|
return osType in cls.supportedOss
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def providesConnetionInfo(cls) -> bool:
|
def providesConnetionInfo(cls) -> bool:
|
||||||
|
@ -45,6 +45,7 @@ from .tag import TaggingMixin
|
|||||||
# 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.models import Network, ServicePool
|
from uds.models import Network, ServicePool
|
||||||
|
from uds.core.util.os_detector import KnownOS
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -130,10 +131,8 @@ class Transport(ManagedObjectModel, TaggingMixin):
|
|||||||
# Deny, must not be in any network
|
# Deny, must not be in any network
|
||||||
return self.networks.filter(net_start__lte=ip, net_end__gte=ip).exists() is False
|
return self.networks.filter(net_start__lte=ip, net_end__gte=ip).exists() is False
|
||||||
|
|
||||||
def validForOs(self, os: str) -> bool:
|
def validForOs(self, os: 'KnownOS') -> bool:
|
||||||
if not self.allowed_oss or os in self.allowed_oss.split(','):
|
return not self.allowed_oss or os.name in self.allowed_oss.split(',')
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return '{} of type {} (id:{})'.format(self.name, self.data_type, self.id)
|
return '{} of type {} (id:{})'.format(self.name, self.data_type, self.id)
|
||||||
|
@ -59,6 +59,7 @@ from uds.core.auths.auth import webPassword
|
|||||||
# 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.core.util.request import ExtendedHttpRequestWithUser
|
from uds.core.util.request import ExtendedHttpRequestWithUser
|
||||||
|
from uds.core.util.os_detector import KnownOS
|
||||||
from uds.models import Image
|
from uds.models import Image
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +138,7 @@ def getServicesData(
|
|||||||
nets = ''
|
nets = ''
|
||||||
validTrans = ''
|
validTrans = ''
|
||||||
|
|
||||||
osType = request.os['OS']
|
osType: 'KnownOS' = request.os['OS']
|
||||||
logger.debug('OS: %s', osType)
|
logger.debug('OS: %s', osType)
|
||||||
|
|
||||||
if request.user.isStaff():
|
if request.user.isStaff():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user