Exemplo n.º 1
0
def transformTransports(apps, schema_editor):
    '''
    Move serialization to a better model (it's time, the mode is there since 1.1 :) )
    '''
    model = apps.get_model("uds", 'Transport')
    for t in model.objects.all():
        if t.data_type == RDPTransport.typeType:
            values = unmarshalRDP(t.data.decode(RDPTransport.CODEC))
            rdp = RDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()

        if t.data_type == TSRDPTransport.typeType:
            values = unmarshalTSRDP(t.data.decode(TSRDPTransport.CODEC))
            rdp = TSRDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()

        if t.data_type == RGSTransport.typeType:
            values = unmarshalRGS(t.data.decode(RGSTransport.CODEC))
            rgs = RGSTransport(Environment.getTempEnv(), values)
            t.data = rgs.serialize()
            t.save()

        if t.data_type == TRGSTransport.typeType:
            values = unmarshalTRGS(t.data.decode(TRGSTransport.CODEC))
            rgs = TRGSTransport(Environment.getTempEnv(), values)
            t.data = rgs.serialize()
            t.save()
def transformTransports(apps, schema_editor):
    '''
    Move serialization to a better model (it's time, the mode is there since 1.1 :) )
    '''
    model = apps.get_model("uds", 'Transport')
    for t in model.objects.all():
        if t.data_type == RDPTransport.typeType:
            values = unmarshalRDP(t.data.decode(RDPTransport.CODEC))
            rdp = RDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()

        if t.data_type == TRDPTransport.typeType:
            values = unmarshalTRDP(t.data.decode(TRDPTransport.CODEC))
            rdp = TRDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()

        if t.data_type == RGSTransport.typeType:
            values = unmarshalRGS(t.data.decode(RGSTransport.CODEC))
            rgs = RGSTransport(Environment.getTempEnv(), values)
            t.data = rgs.serialize()
            t.save()

        if t.data_type == TRGSTransport.typeType:
            values = unmarshalTRGS(t.data.decode(TRGSTransport.CODEC))
            rgs = TRGSTransport(Environment.getTempEnv(), values)
            t.data = rgs.serialize()
            t.save()
def transformTransports(apps, schema_editor):
    """
    Move serialization to a better model (it's time, the mode is there since 1.1 :) )
    """
    model = apps.get_model("uds", 'Transport')
    for t in model.objects.all():
        if t.data_type == RDPTransport.typeType:
            values = unmarshalRDP(encoders.decode(t.data, 'base64'))
            rdp = RDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()

        if t.data_type == TRDPTransport.typeType:
            values = unmarshalTRDP(encoders.decode(t.data, 'base64'))
            rdp = TRDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()
def transformTransports(apps, schema_editor):
    """
    Move serialization to a better model (it's time, the mode is there since 1.1 :) )
    """
    model = apps.get_model("uds", 'Transport')
    for t in model.objects.all():
        if t.data_type == RDPTransport.typeType:
            values = unmarshalRDP(encoders.decode(t.data, 'base64'))
            rdp = RDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()

        if t.data_type == TRDPTransport.typeType:
            values = unmarshalTRDP(encoders.decode(t.data, 'base64'))
            rdp = TRDPTransport(Environment.getTempEnv(), values)
            t.data = rdp.serialize()
            t.save()
Exemplo n.º 5
0
 def getGui(self, parent, forType):
     try:
         logger.debug('getGui parameters: {0}, {1}'.format(parent, forType))
         parentInstance = parent.getInstance()
         serviceType = parentInstance.getServiceByType(forType)
         service = serviceType(Environment.getTempEnv(), parentInstance)  # Instantiate it so it has the opportunity to alter gui description based on parent
         return self.addDefaultFields(service.guiDescription(service), ['name', 'comments'])
     except Exception as e:
         logger.exception('getGui')
         raise ResponseError(unicode(e))
Exemplo n.º 6
0
 def getGui(self, parent, forType):
     try:
         logger.debug('getGui parameters: {0}, {1}'.format(parent, forType))
         parentInstance = parent.getInstance()
         serviceType = parentInstance.getServiceByType(forType)
         service = serviceType(
             Environment.getTempEnv(), parentInstance
         )  # Instantiate it so it has the opportunity to alter gui description based on parent
         return self.addDefaultFields(service.guiDescription(service),
                                      ['name', 'comments'])
     except Exception as e:
         logger.exception('getGui')
         raise ResponseError(unicode(e))
Exemplo n.º 7
0
    def test(self, type_):
        from uds.core.Environment import Environment

        authType = auths.factory().lookup(type_)
        self.ensureAccess(authType, permissions.PERMISSION_MANAGEMENT, root=True)

        dct = self._params.copy()
        dct['_request'] = self._request
        res = authType.test(Environment.getTempEnv(), dct)
        if res[0]:
            return self.success()
        else:
            return res[1]
Exemplo n.º 8
0
    def test(self, type_):
        from uds.core.Environment import Environment

        logger.debug('Type: {}'.format(type_))
        spType = services.factory().lookup(type_)

        self.ensureAccess(spType, permissions.PERMISSION_MANAGEMENT, root=True)

        logger.debug('spType: {}'.format(spType))
        res = spType.test(Environment.getTempEnv(), self._params)
        if res[0]:
            return 'ok'
        else:
            return res[1]
Exemplo n.º 9
0
    def test(self, type_):
        from uds.core.Environment import Environment

        authType = auths.factory().lookup(type_)
        self.ensureAccess(authType,
                          permissions.PERMISSION_MANAGEMENT,
                          root=True)

        dct = self._params.copy()
        dct['_request'] = self._request
        res = authType.test(Environment.getTempEnv(), dct)
        if res[0]:
            return self.success()
        else:
            return res[1]
Exemplo n.º 10
0
    def test(self, type_):
        from uds.core.Environment import Environment

        logger.debug('Type: %s', type_)
        spType = services.factory().lookup(type_)

        self.ensureAccess(spType, permissions.PERMISSION_MANAGEMENT, root=True)

        logger.debug('spType: %s', spType)

        dct = self._params.copy()
        dct['_request'] = self._request
        res = spType.test(Environment.getTempEnv(), dct)
        if res[0]:
            return 'ok'
        else:
            return res[1]
Exemplo n.º 11
0
    def getGui(self, parent, forType):
        try:
            logger.debug('getGui parameters: {0}, {1}'.format(parent, forType))
            parentInstance = parent.getInstance()
            serviceType = parentInstance.getServiceByType(forType)
            service = serviceType(
                Environment.getTempEnv(), parentInstance
            )  # Instantiate it so it has the opportunity to alter gui description based on parent
            g = self.addDefaultFields(service.guiDescription(service),
                                      ['name', 'comments', 'tags'])
            for f in [
                {
                    'name':
                    'proxy_id',
                    'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                        gui.choiceItem(v.uuid, v.name)
                        for v in Proxy.objects.all()
                    ]),
                    'label':
                    _('Proxy'),
                    'tooltip':
                    _('Proxy for services behind a firewall'),
                    'type':
                    gui.InputField.CHOICE_TYPE,
                    'tab':
                    _('Advanced'),
                    'order':
                    132,
                },
            ]:
                self.addField(g, f)

            return g

        except Exception as e:
            logger.exception('getGui')
            raise ResponseError(six.text_type(e))
Exemplo n.º 12
0
    def getGui(self, parent, forType):
        try:
            logger.debug('getGui parameters: {0}, {1}'.format(parent, forType))
            parentInstance = parent.getInstance()
            serviceType = parentInstance.getServiceByType(forType)
            service = serviceType(Environment.getTempEnv(), parentInstance)  # Instantiate it so it has the opportunity to alter gui description based on parent
            g = self.addDefaultFields(service.guiDescription(service), ['name', 'comments', 'tags'])
            for f in [{
                'name': 'proxy_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([gui.choiceItem(v.uuid, v.name) for v in Proxy.objects.all()]),
                'label': _('Proxy'),
                'tooltip': _('Proxy for services behind a firewall'),
                'type': gui.InputField.CHOICE_TYPE,
                'tab': _('Advanced'),
                'order': 132,
                },
            ]:
                self.addField(g, f)

            return g

        except Exception as e:
            logger.exception('getGui')
            raise ResponseError(six.text_type(e))