forked from shaba/openuds
Fixed OSS
This commit is contained in:
parent
e0149900a7
commit
2b33ffc656
@ -126,7 +126,7 @@ class Transports(ModelHandler):
|
||||
'value': [],
|
||||
'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
|
||||
],
|
||||
key=lambda x: x['text'].lower(),
|
||||
|
@ -157,7 +157,7 @@ class Transport(Module):
|
||||
Helper method to check if transport supports requested operating system.
|
||||
Class method
|
||||
"""
|
||||
return cls.supportedOss.count(osType) > 0
|
||||
return osType in cls.supportedOss
|
||||
|
||||
@classmethod
|
||||
def providesConnetionInfo(cls) -> bool:
|
||||
|
@ -45,6 +45,7 @@ from .tag import TaggingMixin
|
||||
# Not imported at runtime, just for type checking
|
||||
if typing.TYPE_CHECKING:
|
||||
from uds.models import Network, ServicePool
|
||||
from uds.core.util.os_detector import KnownOS
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -127,10 +128,8 @@ class Transport(ManagedObjectModel, TaggingMixin):
|
||||
return self.networks.filter(net_start__lte=ip, net_end__gte=ip).count() > 0
|
||||
return self.networks.filter(net_start__lte=ip, net_end__gte=ip).count() == 0
|
||||
|
||||
def validForOs(self, os: str) -> bool:
|
||||
if not self.allowed_oss or os in self.allowed_oss.split(','):
|
||||
return True
|
||||
return False
|
||||
def validForOs(self, os: 'KnownOS') -> bool:
|
||||
return os.name in self.allowed_oss.split(',')
|
||||
|
||||
def __str__(self) -> str:
|
||||
return '{} of type {} (id:{})'.format(self.name, self.data_type, self.id)
|
||||
|
@ -52,13 +52,13 @@ from uds.core.services.exceptions import (
|
||||
MaxServicesReachedError,
|
||||
ServiceAccessDeniedByCalendar,
|
||||
)
|
||||
|
||||
from uds.web.util import errors
|
||||
from uds.core.auths.auth import webPassword
|
||||
|
||||
# Not imported at runtime, just for type checking
|
||||
if typing.TYPE_CHECKING:
|
||||
from uds.core.util.request import ExtendedHttpRequestWithUser
|
||||
from uds.core.util.os_detector import KnownOS
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -97,7 +97,7 @@ def getServicesData(
|
||||
nets = ''
|
||||
validTrans = ''
|
||||
|
||||
osType = request.os['OS']
|
||||
osType: 'KnownOS' = request.os['OS']
|
||||
logger.debug('OS: %s', osType)
|
||||
|
||||
if request.user.isStaff():
|
||||
|
Loading…
x
Reference in New Issue
Block a user