예제 #1
0
 def initGui(self):
     logger.debug('Initializing gui')
     vals = [
         gui.choiceItem(v.uuid, v.name)
         for v in ServicePool.objects.all().order_by('name')
     ]
     self.pools.setValues(vals)
예제 #2
0
파일: users.py 프로젝트: dkmstr/openuds
    def initGui(self):
        logger.debug('Initializing gui')
        vals = [
            gui.choiceItem(v.uuid, v.name) for v in Authenticator.objects.all()
        ]

        self.authenticator.setValues(vals)
예제 #3
0
파일: users.py 프로젝트: spofa/openuds
    def initGui(self):
        logger.debug('Initializing gui')
        vals = [
            gui.choiceItem(v.uuid, v.name) for v in Authenticator.objects.all()
        ]

        self.authenticator.setValues(vals)
예제 #4
0
파일: services.py 프로젝트: borzel/openuds
    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))
예제 #5
0
파일: services.py 프로젝트: dkmstr/openuds
    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))
예제 #6
0
    def getGui(self, type_):

        g = self.addDefaultFields([], ['name', 'short_name', 'comments', 'tags'])

        for f in [{
            'name': 'policy',
            'values': [gui.choiceItem(k, str(v)) for k, v in MetaPool.TYPES.items()],
            'label': ugettext('Policy'),
            'tooltip': ugettext('Service pool policy'),
            'type': gui.InputField.CHOICE_TYPE,
            'order': 100,
        }, {
            'name': 'image_id',
            'values': [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in Image.objects.all()]),
            'label': ugettext('Associated Image'),
            'tooltip': ugettext('Image assocciated with this service'),
            'type': gui.InputField.IMAGECHOICE_TYPE,
            'order': 120,
            'tab': ugettext('Display'),
        }, {
            'name': 'servicesPoolGroup_id',
            'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicesPoolGroup.objects.all()]),
            'label': ugettext('Pool group'),
            'tooltip': ugettext('Pool group for this pool (for pool classify on display)'),
            'type': gui.InputField.IMAGECHOICE_TYPE,
            'order': 121,
            'tab': ugettext('Display'),
        }, {
            'name': 'visible',
            'value': True,
            'label': ugettext('Visible'),
            'tooltip': ugettext('If active, metapool will be visible for users'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 123,
            'tab': ugettext('Display'),
        }]:
            self.addField(g, f)

        return g
예제 #7
0
    def getGui(self, type_):

        g = self.addDefaultFields([], ['name', 'short_name', 'comments', 'tags'])

        for f in [{
            'name': 'policy',
            'values': [gui.choiceItem(k, str(v)) for k, v in MetaPool.TYPES.items()],
            'label': ugettext('Policy'),
            'tooltip': ugettext('Service pool policy'),
            'type': gui.InputField.CHOICE_TYPE,
            'order': 100,
        }, {
            'name': 'image_id',
            'values': [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in Image.objects.all()]),
            'label': ugettext('Associated Image'),
            'tooltip': ugettext('Image assocciated with this service'),
            'type': gui.InputField.IMAGECHOICE_TYPE,
            'order': 120,
            'tab': ugettext('Display'),
        }, {
            'name': 'servicesPoolGroup_id',
            'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicesPoolGroup.objects.all()]),
            'label': ugettext('Pool group'),
            'tooltip': ugettext('Pool group for this pool (for pool classify on display)'),
            'type': gui.InputField.IMAGECHOICE_TYPE,
            'order': 121,
            'tab': ugettext('Display'),
        }, {
            'name': 'visible',
            'value': True,
            'label': ugettext('Visible'),
            'tooltip': ugettext('If active, metapool will be visible for users'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 123,
            'tab': ugettext('Display'),
        }]:
            self.addField(g, f)

        return g
예제 #8
0
    def getGui(self, type_):
        if OSManager.objects.count() < 1:  # No os managers, can't create db
            raise ResponseError(
                ugettext(
                    'Create at least one OS Manager before creating a new service pool'
                ))
        if Service.objects.count() < 1:
            raise ResponseError(
                ugettext(
                    'Create at least a service before creating a new service pool'
                ))

        g = self.addDefaultFields([],
                                  ['name', 'short_name', 'comments', 'tags'])

        for f in [
            {
                'name':
                'service_id',
                'values': [gui.choiceItem('', '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.provider.name + '\\' + v.name)
                    for v in Service.objects.all()
                ]),
                'label':
                ugettext('Base service'),
                'tooltip':
                ugettext('Service used as base of this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'rdonly':
                True,
                'order':
                100,  # Ensueres is At end
            },
            {
                'name':
                'osmanager_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.name)
                    for v in OSManager.objects.all()
                ]),
                'label':
                ugettext('OS Manager'),
                'tooltip':
                ugettext('OS Manager used as base of this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'rdonly':
                True,
                'order':
                101,
            },
            {
                'name':
                'show_transports',
                'value':
                True,
                'label':
                ugettext('Show transports'),
                'tooltip':
                ugettext(
                    'If active, alternative transports for user will be shown'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                110,
                'tab':
                ugettext('Advanced'),
            },
            {
                'name':
                'allow_users_remove',
                'value':
                False,
                'label':
                ugettext('Allow removal by users'),
                'tooltip':
                ugettext(
                    'If active, the user will be allowed to remove the service "manually". Be careful with this, because the user will have the "power" to delete it\'s own service'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                111,
                'tab':
                ugettext('Advanced'),
            },
            {
                'name':
                'allow_users_reset',
                'value':
                False,
                'label':
                ugettext('Allow reset by users'),
                'tooltip':
                ugettext(
                    'If active, the user will be allowed to reset the service'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                112,
                'tab':
                ugettext('Advanced'),
            },
            {
                'name':
                'ignores_unused',
                'value':
                False,
                'label':
                ugettext('Ignores unused'),
                'tooltip':
                ugettext(
                    'If the option is enabled, UDS will not attempt to detect and remove the user services assigned but not in use.'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                113,
                'tab':
                ugettext('Advanced'),
            },
            {
                'name':
                'image_id',
                'values':
                [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] +
                gui.sortedChoices([
                    gui.choiceImage(v.uuid, v.name, v.thumb64)
                    for v in Image.objects.all()
                ]),
                'label':
                ugettext('Associated Image'),
                'tooltip':
                ugettext('Image assocciated with this service'),
                'type':
                gui.InputField.IMAGECHOICE_TYPE,
                'order':
                120,
                'tab':
                ugettext('Display'),
            },
            {
                'name':
                'servicesPoolGroup_id',
                'values':
                [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] +
                gui.sortedChoices([
                    gui.choiceImage(v.uuid, v.name, v.thumb64)
                    for v in ServicesPoolGroup.objects.all()
                ]),
                'label':
                ugettext('Pool group'),
                'tooltip':
                ugettext(
                    'Pool group for this pool (for pool classify on display)'),
                'type':
                gui.InputField.IMAGECHOICE_TYPE,
                'order':
                121,
                'tab':
                ugettext('Display'),
            },
            {
                'name':
                'visible',
                'value':
                True,
                'label':
                ugettext('Visible'),
                'tooltip':
                ugettext('If active, transport will be visible for users'),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                107,
                'tab':
                ugettext('Display'),
            },
            {
                'name':
                'initial_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Initial available services'),
                'tooltip':
                ugettext('Services created initially for this service pool'),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                130,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'cache_l1_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Services to keep in cache'),
                'tooltip':
                ugettext(
                    'Services kept in cache for improved user service assignation'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                131,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'cache_l2_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Services to keep in L2 cache'),
                'tooltip':
                ugettext(
                    'Services kept in cache of level2 for improved service generation'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                132,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'max_srvs',
                'value':
                '0',
                'minValue':
                '1',
                'label':
                ugettext('Maximum number of services to provide'),
                'tooltip':
                ugettext(
                    'Maximum number of service (assigned and L1 cache) that can be created for this service'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                133,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'show_transports',
                'value':
                True,
                'label':
                ugettext('Show transports'),
                'tooltip':
                ugettext(
                    'If active, alternative transports for user will be shown'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'tab':
                ugettext('Advanced'),
                'order':
                130,
            },
            {
                'name':
                'account_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.name)
                    for v in Account.objects.all()
                ]),
                'label':
                ugettext('Accounting'),
                'tooltip':
                ugettext('Account associated to this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'tab':
                ugettext('Advanced'),
                'order':
                131,
            }
        ]:
            self.addField(g, f)

        return g
예제 #9
0
class HTML5RDPTransport(Transport):
    """
    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
    """
    typeName = _('HTML5 RDP')
    typeType = 'HTML5RDPTransport'
    typeDescription = _('RDP protocol using HTML5 client')
    iconFile = 'html5.png'

    ownLink = True
    supportedOss = OsDetector.allOss
    protocol = protocols.RDP
    group = TUNNELED_GROUP

    guacamoleServer = gui.TextField(
        label=_('Tunnel Server'),
        order=1,
        tooltip=
        _('Host of the tunnel server (use http/https & port if needed) as accesible from users'
          ),
        defvalue='https://',
        length=64,
        required=True,
        tab=gui.TUNNEL_TAB)
    useEmptyCreds = gui.CheckBoxField(
        label=_('Empty creds'),
        order=2,
        tooltip=_('If checked, the credentials used to connect will be emtpy'),
        tab=gui.CREDENTIALS_TAB)
    fixedName = gui.TextField(
        label=_('Username'),
        order=3,
        tooltip=_(
            'If not empty, this username will be always used as credential'),
        tab=gui.CREDENTIALS_TAB)
    fixedPassword = gui.PasswordField(
        label=_('Password'),
        order=4,
        tooltip=_(
            'If not empty, this password will be always used as credential'),
        tab=gui.CREDENTIALS_TAB)
    withoutDomain = gui.CheckBoxField(
        label=_('Without Domain'),
        order=5,
        tooltip=
        _('If checked, the domain part will always be emptied (to connecto to xrdp for example is needed)'
          ),
        tab=gui.CREDENTIALS_TAB)
    fixedDomain = gui.TextField(
        label=_('Domain'),
        order=6,
        tooltip=
        _('If not empty, this domain will be always used as credential (used as DOMAIN\\user)'
          ),
        tab=gui.CREDENTIALS_TAB)
    wallpaper = gui.CheckBoxField(
        label=_('Show wallpaper'),
        order=20,
        tooltip=
        _('If checked, the wallpaper and themes will be shown on machine (better user experience, more bandwidth)'
          ),
        tab=gui.PARAMETERS_TAB)
    desktopComp = gui.CheckBoxField(
        label=_('Allow Desk.Comp.'),
        order=22,
        tooltip=_('If checked, desktop composition will be allowed'),
        tab=gui.PARAMETERS_TAB)
    smooth = gui.CheckBoxField(
        label=_('Font Smoothing'),
        order=23,
        tooltip=_(
            'If checked, fonts smoothing will be allowed (windows clients only)'
        ),
        tab=gui.PARAMETERS_TAB)
    enableAudio = gui.CheckBoxField(
        label=_('Enable Audio'),
        order=24,
        tooltip=
        _('If checked, the audio will be redirected to client (if client browser supports it)'
          ),
        tab=gui.PARAMETERS_TAB)
    enablePrinting = gui.CheckBoxField(
        label=_('Enable Printing'),
        order=25,
        tooltip=
        _('If checked, the printing will be redirected to client (if client browser supports it)'
          ),
        tab=gui.PARAMETERS_TAB)
    enableFileSharing = gui.CheckBoxField(
        label=_('Enable File Sharing'),
        order=8,
        tooltip=
        _('If checked, the user will be able to upload/download files (if client browser supports it)'
          ),
        tab=gui.PARAMETERS_TAB)
    serverLayout = gui.ChoiceField(
        order=26,
        label=_('Layout'),
        tooltip=_('Keyboards Layout of server'),
        required=True,
        values=[
            gui.choiceItem('-', 'default'),
            gui.choiceItem('en-us-qwerty', _('English (US) keyboard')),
            gui.choiceItem('de-de-qwertz', _('German keyboard (qwertz)')),
            gui.choiceItem('fr-fr-azerty', _('French keyboard (azerty)')),
            gui.choiceItem('it-it-qwerty', _('Italian keyboard')),
            gui.choiceItem('sv-se-qwerty', _('Swedish keyboard')),
            gui.choiceItem('failsafe', _('Failsafe')),
        ],
        defvalue='-',
        tab=gui.PARAMETERS_TAB)
    security = gui.ChoiceField(
        order=27,
        label=_('Security'),
        tooltip=_('Connection security mode for Guacamole RDP connection'),
        required=True,
        values=[
            gui.choiceItem(
                'any', _('Any (Allow the server to choose the type of auth)')),
            gui.choiceItem(
                'rdp',
                _('RDP (Standard RDP encryption. Should be supported by all servers)'
                  )),
            gui.choiceItem(
                'nla',
                _('NLA (Network Layer authentication. Requires VALID username&password, or connection will fail)'
                  )),
            gui.choiceItem('tls',
                           _('TLS (Transport Security Layer encryption)')),
        ],
        defvalue='rdp',
        tab=gui.PARAMETERS_TAB)

    ticketValidity = gui.NumericField(
        length=3,
        label=_('Ticket Validity'),
        defvalue='60',
        order=90,
        tooltip=
        _('Allowed time, in seconds, for HTML5 client to reload data from UDS Broker. The default value of 60 is recommended.'
          ),
        required=True,
        minValue=60,
        tab=gui.ADVANCED_TAB)

    def initialize(self, values):
        if values is None:
            return
        self.guacamoleServer.value = self.guacamoleServer.value.strip()
        if self.guacamoleServer.value[0:4] != 'http':
            raise Transport.ValidationException(
                _('The server must be http or https'))
        if self.useEmptyCreds.isTrue() and self.security.value != 'rdp':
            raise Transport.ValidationException(
                _('Empty credentials (on Credentials tab) is only allowed with Security level (on Parameters tab) set to "RDP"'
                  ))

    # Same check as normal RDP transport
    def isAvailableFor(self, userService, ip):
        """
        Checks if the transport is available for the requested destination ip
        Override this in yours transports
        """
        logger.debug('Checking availability for {0}'.format(ip))
        ready = self.cache.get(ip)
        if ready is None:
            # Check again for readyness
            if self.testServer(userService, ip, '3389') is True:
                self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
                return True
            else:
                self.cache.put(ip, 'N', READY_CACHE_TIMEOUT)
        return ready == 'Y'

    def processedUser(self, userService, userName):
        v = self.processUserPassword(userService, userName, '')
        return v['username']

    def processUserPassword(self, service, user, password):
        username = user.getUsernameForAuth()

        if self.fixedName.value != '':
            username = self.fixedName.value

        proc = username.split('@')
        if len(proc) > 1:
            domain = proc[1]
        else:
            domain = ''
        username = proc[0]

        if self.fixedPassword.value != '':
            password = self.fixedPassword.value
        if self.fixedDomain.value != '':
            domain = self.fixedDomain.value
        if self.useEmptyCreds.isTrue():
            username, password, domain = '', '', ''

        if self.withoutDomain.isTrue():
            domain = ''

        if '.' in domain:  # Dotter domain form
            username = username + '@' + domain
            domain = ''

        # Fix username/password acording to os manager
        username, password = service.processUserPassword(username, password)

        return {
            'protocol': self.protocol,
            'username': username,
            'password': password,
            'domain': domain
        }

    def getLink(self, userService, transport, ip, os, user, password, request):
        ci = self.processUserPassword(userService, user, password)
        username, password, domain = ci['username'], ci['password'], ci[
            'domain']

        if domain != '':
            username = domain + '\\' + username

        scrambler = cryptoManager().randomString(32)
        passwordCrypted = cryptoManager().symCrypt(password, scrambler)

        # Build params dict
        params = {
            'protocol': 'rdp',
            'hostname': ip,
            'username': username,
            'password': passwordCrypted,
            'ignore-cert': 'true',
            'security': self.security.value,
            'drive-path': '/share/{}'.format(user.uuid),
            'create-drive-path': 'true'
        }

        if self.enableFileSharing.isTrue():
            params['enable-drive'] = 'true'

        if self.serverLayout.value != '-':
            params['server-layout'] = self.serverLayout.value

        if self.enableAudio.isTrue() is False:
            params['disable-audio'] = 'true'

        if self.enablePrinting.isTrue() is True:
            params['enable-printing'] = 'true'

        if self.wallpaper.isTrue() is True:
            params['enable-wallpaper'] = 'true'

        if self.desktopComp.isTrue() is True:
            params['enable-desktop-composition'] = 'true'

        if self.smooth.isTrue() is True:
            params['enable-font-smoothing'] = 'true'

        logger.debug('RDP Params: {0}'.format(params))

        ticket = TicketStore.create(params, validity=self.ticketValidity.num())

        return HttpResponseRedirect("{}/transport/?{}.{}&{}".format(
            self.guacamoleServer.value, ticket, scrambler,
            request.build_absolute_uri(reverse('Index'))))
예제 #10
0
    def getGui(self, type_):
        if OSManager.objects.count() < 1:  # No os managers, can't create db
            raise ResponseError(ugettext('Create at least one OS Manager before creating a new service pool'))
        if Service.objects.count() < 1:
            raise ResponseError(ugettext('Create at least a service before creating a new service pool'))

        g = self.addDefaultFields([], ['name', 'comments'])

        for f in [{
            'name': 'service_id',
            'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([gui.choiceItem(v.uuid, v.provider.name + '\\' + v.name) for v in Service.objects.all()]),
            'label': ugettext('Base service'),
            'tooltip': ugettext('Service used as base of this service pool'),
            'type': gui.InputField.CHOICE_TYPE,
            'rdonly': True,
            'order': 100,  # Ensueres is At end
        }, {
            'name': 'osmanager_id',
            'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([gui.choiceItem(v.uuid, v.name) for v in OSManager.objects.all()]),
            'label': ugettext('OS Manager'),
            'tooltip': ugettext('OS Manager used as base of this service pool'),
            'type': gui.InputField.CHOICE_TYPE,
            'rdonly': True,
            'order': 101,
        }, {
            'name': 'image_id',
            'values': [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in Image.objects.all()]),
            'label': ugettext('Associated Image'),
            'tooltip': ugettext('Image assocciated with this service'),
            'type': gui.InputField.IMAGECHOICE_TYPE,
            'order': 102,
        }, {
            'name': 'initial_srvs',
            'value': '0',
            'minValue': '0',
            'label': ugettext('Initial available services'),
            'tooltip': ugettext('Services created initially for this service pool'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 103,
        }, {
            'name': 'cache_l1_srvs',
            'value': '0',
            'minValue': '0',
            'label': ugettext('Services to keep in cache'),
            'tooltip': ugettext('Services kept in cache for improved user service assignation'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 104,
        }, {
            'name': 'cache_l2_srvs',
            'value': '0',
            'minValue': '0',
            'label': ugettext('Services to keep in L2 cache'),
            'tooltip': ugettext('Services kept in cache of level2 for improved service generation'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 105,
        }, {
            'name': 'max_srvs',
            'value': '0',
            'minValue': '1',
            'label': ugettext('Maximum number of services to provide'),
            'tooltip': ugettext('Maximum number of service (assigned and L1 cache) that can be created for this service'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 106,
        }, {
            'name': 'show_transports',
            'value': True,
            'label': ugettext('Show transports'),
            'tooltip': ugettext('If active, alternative transports for user will be shown'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 107,
        }]:
            self.addField(g, f)

        return g
예제 #11
0
 def initGui(self):
     logger.debug('Initializing gui')
     vals = [
         gui.choiceItem(v.uuid, v.name) for v in ServicePool.objects.all()
     ]
     self.pools.setValues(vals)
예제 #12
0
    def getGui(self, type_):
        if OSManager.objects.count() < 1:  # No os managers, can't create db
            raise ResponseError(
                ugettext(
                    'Create at least one OS Manager before creating a new service pool'
                ))
        if Service.objects.count() < 1:
            raise ResponseError(
                ugettext(
                    'Create at least a service before creating a new service pool'
                ))

        g = self.addDefaultFields([], ['name', 'comments'])

        for f in [
            {
                'name':
                'service_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.provider.name + '\\' + v.name)
                    for v in Service.objects.all()
                ]),
                'label':
                ugettext('Base service'),
                'tooltip':
                ugettext('Service used as base of this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'rdonly':
                True,
                'order':
                100,  # Ensueres is At end
            },
            {
                'name':
                'osmanager_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.name)
                    for v in OSManager.objects.all()
                ]),
                'label':
                ugettext('OS Manager'),
                'tooltip':
                ugettext('OS Manager used as base of this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'rdonly':
                True,
                'order':
                101,
            },
            {
                'name':
                'image_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.name)
                    for v in Image.objects.all()
                ]),
                'label':
                ugettext('Associated Image'),
                'tooltip':
                ugettext('Image assocciated with this service'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'order':
                102,
            },
            {
                'name':
                'initial_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Initial available services'),
                'tooltip':
                ugettext('Services created initially for this service pool'),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                103,
            },
            {
                'name':
                'cache_l1_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Services to keep in cache'),
                'tooltip':
                ugettext(
                    'Services kept in cache for improved user service assignation'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                104,
            },
            {
                'name':
                'cache_l2_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Services to keep in L2 cache'),
                'tooltip':
                ugettext(
                    'Services kept in cache of level2 for improved service generation'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                105,
            },
            {
                'name':
                'max_srvs',
                'value':
                '0',
                'minValue':
                '1',
                'label':
                ugettext('Maximum number of services to provide'),
                'tooltip':
                ugettext(
                    'Maximum number of service (assigned and L1 cache) that can be created for this service'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                106,
            },
            {
                'name':
                'show_transports',
                'value':
                True,
                'label':
                ugettext('Show transports'),
                'tooltip':
                ugettext(
                    'If active, alternative transports for user will be shown'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                107,
            }
        ]:
            self.addField(g, f)

        return g
예제 #13
0
    def getGui(self, type_):
        if OSManager.objects.count() < 1:  # No os managers, can't create db
            raise ResponseError(ugettext('Create at least one OS Manager before creating a new service pool'))
        if Service.objects.count() < 1:
            raise ResponseError(ugettext('Create at least a service before creating a new service pool'))

        g = self.addDefaultFields([], ['name', 'short_name', 'comments', 'tags'])

        for f in [{
            'name': 'service_id',
            'values': [gui.choiceItem('', '')] + gui.sortedChoices([gui.choiceItem(v.uuid, v.provider.name + '\\' + v.name) for v in Service.objects.all()]),
            'label': ugettext('Base service'),
            'tooltip': ugettext('Service used as base of this service pool'),
            'type': gui.InputField.CHOICE_TYPE,
            'rdonly': True,
            'order': 100,  # Ensueres is At end
        }, {
            'name': 'osmanager_id',
            'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([gui.choiceItem(v.uuid, v.name) for v in OSManager.objects.all()]),
            'label': ugettext('OS Manager'),
            'tooltip': ugettext('OS Manager used as base of this service pool'),
            'type': gui.InputField.CHOICE_TYPE,
            'rdonly': True,
            'order': 101,
        }, {
            'name': 'show_transports',
            'value': True,
            'label': ugettext('Show transports'),
            'tooltip': ugettext('If active, alternative transports for user will be shown'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 110,
            'tab': ugettext('Advanced'),
        }, {
            'name': 'allow_users_remove',
            'value': False,
            'label': ugettext('Allow removal by users'),
            'tooltip': ugettext('If active, the user will be allowed to remove the service "manually". Be careful with this, because the user will have the "power" to delete it\'s own service'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 111,
            'tab': ugettext('Advanced'),
        }, {
            'name': 'allow_users_reset',
            'value': False,
            'label': ugettext('Allow reset by users'),
            'tooltip': ugettext('If active, the user will be allowed to reset the service'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 112,
            'tab': ugettext('Advanced'),
        }, {
            'name': 'ignores_unused',
            'value': False,
            'label': ugettext('Ignores unused'),
            'tooltip': ugettext('If the option is enabled, UDS will not attempt to detect and remove the user services assigned but not in use.'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 113,
            'tab': ugettext('Advanced'),
        }, {
            'name': 'image_id',
            'values': [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in Image.objects.all()]),
            'label': ugettext('Associated Image'),
            'tooltip': ugettext('Image assocciated with this service'),
            'type': gui.InputField.IMAGECHOICE_TYPE,
            'order': 120,
            'tab': ugettext('Display'),
        }, {
            'name': 'servicesPoolGroup_id',
            'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicesPoolGroup.objects.all()]),
            'label': ugettext('Pool group'),
            'tooltip': ugettext('Pool group for this pool (for pool classify on display)'),
            'type': gui.InputField.IMAGECHOICE_TYPE,
            'order': 121,
            'tab': ugettext('Display'),
        }, {
            'name': 'visible',
            'value': True,
            'label': ugettext('Visible'),
            'tooltip': ugettext('If active, transport will be visible for users'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'order': 107,
            'tab': ugettext('Display'),
        }, {
            'name': 'initial_srvs',
            'value': '0',
            'minValue': '0',
            'label': ugettext('Initial available services'),
            'tooltip': ugettext('Services created initially for this service pool'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 130,
            'tab': ugettext('Availability'),
        }, {
            'name': 'cache_l1_srvs',
            'value': '0',
            'minValue': '0',
            'label': ugettext('Services to keep in cache'),
            'tooltip': ugettext('Services kept in cache for improved user service assignation'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 131,
            'tab': ugettext('Availability'),
        }, {
            'name': 'cache_l2_srvs',
            'value': '0',
            'minValue': '0',
            'label': ugettext('Services to keep in L2 cache'),
            'tooltip': ugettext('Services kept in cache of level2 for improved service generation'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 132,
            'tab': ugettext('Availability'),
        }, {
            'name': 'max_srvs',
            'value': '0',
            'minValue': '1',
            'label': ugettext('Maximum number of services to provide'),
            'tooltip': ugettext('Maximum number of service (assigned and L1 cache) that can be created for this service'),
            'type': gui.InputField.NUMERIC_TYPE,
            'order': 133,
            'tab': ugettext('Availability'),
        }, {
            'name': 'show_transports',
            'value': True,
            'label': ugettext('Show transports'),
            'tooltip': ugettext('If active, alternative transports for user will be shown'),
            'type': gui.InputField.CHECKBOX_TYPE,
            'tab': ugettext('Advanced'),
            'order': 130,
        }, {
            'name': 'account_id',
            'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([gui.choiceItem(v.uuid, v.name) for v in Account.objects.all()]),
            'label': ugettext('Accounting'),
            'tooltip': ugettext('Account associated to this service pool'),
            'type': gui.InputField.CHOICE_TYPE,
            'tab': ugettext('Advanced'),
            'order': 131,
        }

        ]:
            self.addField(g, f)

        return g