Ejemplo n.º 1
0
    def form_pageForm(self, data):
        f = form.Form()

        f.addField('NTP',
                   form.String(required=True),
                   label="Time server",
                   description="Network time server")
        f.addField(
            'SMTPRelay',
            form.String(),
            label="SMTP Relay",
            description=
            "SMTP relay server. Sometimes called a smart-host. This is the mailserver your ISP gave you. Leave blank for direct delivery."
        )
        f.addField(
            'ForwardingNameservers',
            form.String(),
            label="DNS Servers",
            description=
            "Comma separated list of DNS servers to forward queries to.")

        f.data = {
            'NTP': 'pool.ntp.org',
            'SMTPRelay': '',
            'ForwardingNameservers': ''
        }

        f.addAction(self.next)

        return f
Ejemplo n.º 2
0
    def form_pageForm(self, data):
        f = form.Form()

        ifaces = getNetInterfaces()
        for n in ifaces:
            print n
            f.addField(n,
                       form.String(required=True),
                       form.widgetFactory(form.SelectChoice,
                                          options=(
                                              ('Unused', 'Unused'),
                                              ('LAN', 'LAN'),
                                              ('WAN', 'WAN'),
                                              ('PPPoE', 'PPPoE'),
                                          )),
                       label=n.replace('eth', 'Port '))

            f.data[n] = 'Unused'

        f.data['eth0'] = 'LAN'
        f.data['eth1'] = 'WAN'

        f.addAction(self.next)

        return f
Ejemplo n.º 3
0
    def form_license(self, data):
        f = form.Form()

        f.addField('key', form.String(), label="Key")

        f.addAction(self.addKey)
        return f
Ejemplo n.º 4
0
    def form_pageForm(self, data):
        f = form.Form()

        lans = []
        for k, n in self.enamel.setup['nets'].items():
            if n == "LAN":
                lans.append(k)

        cnt = 0
        for l in lans:
            f.addField(l,
                       form.String(),
                       label="%s IP" % l,
                       description=
                       "IP address (CIDR format v.w.x.y/z) or blank for DHCP")

            f.addField(l + 'dhcp',
                       form.Boolean(),
                       label="%s DHCP Server" % l,
                       description="Enable DHCP server on ths interface")

            if cnt == 0:
                f.data[l + 'dhcp'] = True
            cnt += 1

        f.addAction(self.next)

        return f
Ejemplo n.º 5
0
    def form_regform(self, ctx):
        f = form.Form()
        f.addField('fullname', form.String(required=True), label="Name")

        f.addField('company', form.String(required=True), label="Company")
        f.addField('email', form.String(required=True), label="EMail")
        f.addField('phone', form.String(required=True), label="Phone number")

        f.addField('address0', form.String(required=True), label="Address")
        f.addField('address1', form.String(), label="Address")
        f.addField('address2', form.String(), label="Address")
        f.addField('address3', form.String(), label="Address")

        f.addField('country', form.String(required=True), label="Country")

        #f.addField('zaId', form.String(), label = "SA ID", description =
        #    ["If you are a South African citizen please enter your ID number (",
        #    tags.a(href="/Help/why_id")["Why?"], ")"]
        #),

        f.addField('password',
                   form.String(required=True),
                   form.CheckedPassword,
                   label="Password")

        f.addAction(self.registerUser)

        return f
Ejemplo n.º 6
0
    def form_pageForm(self, data):
        f = form.Form()

        f.addField(
            'pdc',
            form.Boolean(),
            label="PDC",
            description="Should this server act as a primary domain controller"
        )

        f.addField('proxy',
                   form.Boolean(),
                   label="Proxy Authentication",
                   description=
                   "Should this server require authentication for the proxy?")

        f.addField('cf',
                   form.Boolean(),
                   label="Content Filter",
                   description="Should content filtering be enabled?")

        f.addField('dhcp',
                   form.Boolean(),
                   label="DHCP",
                   description="Should the DHCP service be enabled?")

        f.data = {'pdc': True, 'proxy': False, 'cf': True, 'dhcp': True}

        f.addAction(self.next)

        return f
Ejemplo n.º 7
0
 def form_adminpassword(self, data):
     addServer = form.Form()
     addServer.addField('password',
                        form.String(),
                        label="Administrator Password")
     addServer.addAction(self.changeAdminPass)
     return addServer
Ejemplo n.º 8
0
    def form_addGroup(self, data):
        addGroups = form.Form()
        addGroups.addField('name', form.String(), label="Group Name")
        # XXX Add a dropdown box here if the Avatars group id is 0 (Thusa group)
        addGroups.addAction(self.addGroup)

        return addGroups
Ejemplo n.º 9
0
        def gotUser(res):
            editUsers = form.Form()
            editUsers.addField('fullname', form.String(), label = "Name")
            editUsers.addField('company', form.String(), label = "Company")
            editUsers.addField('email', form.String(), label = "EMail")

            editUsers.addField('phone', form.String(), label = "Phone number")
            editUsers.addField('address0', form.String(), label = "Address")
            editUsers.addField('address1', form.String(), label = "Address")
            editUsers.addField('address2', form.String(), label = "Address")
            editUsers.addField('address3', form.String(), label = "Address")

            editUsers.addField('password', form.String(), label = "Password")
            editUsers.addAction(self.editUser)

            editUsers.data = {
                'fullname': res[3],
                'company':  res[5],
                'email':    res[4],
                'phone':    res[10],
                'address0': res[6],
                'address1': res[7],
                'address2': res[8],
                'address3': res[9]
            }

            return editUsers
Ejemplo n.º 10
0
    def form_addServer(self, data):
        addServer = form.Form()
        addServer.addField('name', form.String(), label = "Server Name")
        addServer.addField('key', form.String(), label = "License Key", description="Leave blank to generate a new key")
        addServer.addField('hostname', form.String(), label = "Hostname", description="Hostname by which this server can be accessed")
        addServer.addAction(self.addServer)

        return addServer
Ejemplo n.º 11
0
    def form_global(self, data):
        f = form.Form()

        f.addField('command', form.String(), label = "Command")

        f.addAction(self.sendCommand)

        return f
Ejemplo n.º 12
0
    def form_approveUpdate(self, data):
        f = form.Form()
        f.addField('package', form.String(required=True), label="Package")
        f.addField('version', form.String(required=True), label="Version")

        f.addAction(self.approveUpdate)

        return f
Ejemplo n.º 13
0
    def form_addUser(self, data):
        addUsers = form.Form()
        addUsers.addField('name', form.String(), label="Username")
        addUsers.addField('email', form.String(), label="EMail address")
        addUsers.addField('password', form.String(), label="Password")
        # XXX Add a dropdown box here if the Avatars group id is 0 (Thusa group)
        addUsers.addAction(self.addUser)

        return addUsers
Ejemplo n.º 14
0
    def form_createTicket(self, data):
        ticket = form.Form()
        ticket.addField('subject', form.String(required=True), label="Subject")
        ticket.addField('detail',
                        form.String(required=True),
                        form.TextArea,
                        label="Detail")

        ticket.addAction(self.sendTicket)

        return ticket
Ejemplo n.º 15
0
    def form_addDomainMembership(self, data):
        addMember = form.Form()

        def gotServerGroups(doms):
            domains = [(i[0], i[1]) for i in doms]
            addMember.addField('domain',
                               form.Integer(required=True),
                               form.widgetFactory(form.SelectChoice,
                                                  options=domains),
                               label="Domain")
            addMember.addAction(self.addDomainMembership)
            return addMember

        return self.enamel.storage.getDomains().addBoth(gotServerGroups)
Ejemplo n.º 16
0
 def form_switchView(self, data):
     f = form.Form()
     f.addField('view',
                form.String(required=True),
                form.widgetFactory(form.SelectChoice,
                                   options=(('load', 'System Load'),
                                            ('latency', 'Latency'),
                                            ('mailq', 'Mail Queue'),
                                            ('internet',
                                             'Internet Traffic'),
                                            ('mailrate', 'Mail Rate'))),
                label="Change view")
     f.addAction(self.submitView)
     return f
Ejemplo n.º 17
0
    def form_addServerMembership(self, data):
        # XXX Should only show this for Thusa group members
        addMember = form.Form()

        def gotServerGroups(server):
            servers = [(i[0], i[1]) for i in server]
            addMember.addField('server',
                               form.Integer(required=True),
                               form.widgetFactory(form.SelectChoice,
                                                  options=servers),
                               label="Server")
            addMember.addAction(self.addServerMembership)
            return addMember

        return self.enamel.storage.getServers().addBoth(gotServerGroups)
Ejemplo n.º 18
0
        def gotDisks(disks):
            print "HERE"
            print disks
            f = form.Form()
            myDisks = {}
            # Split on new lines, and remove the * that signifies bootable partitions
            for n in disks.replace('*','').split('\n'):
                if not n.strip():
                    continue
                parts = n.split()
                device = parts[0].strip('/dev/')

                cyls = int(parts[3].strip('-').strip('+'))

                myDisks[device] = cyls

            self.disks = []

            cnt = 0

            for dev, cyls in myDisks.items():
                cnt += 1 
                size = (int(cyls) * 8225280)/(1024*1024)
                self.disks.append(dev)

                f.addField(dev, form.String(),
                    form.widgetFactory(form.SelectChoice, 
                        options=(
                            ('/', '/'), 
                            ('/var', '/var'), 
                            ('/storage', '/storage')
                        )
                    ),
                    label = [tags.strong[dev], " (%sMB)" % size]
                )

                if cnt == 1:
                    f.data[dev] = '/'
                if cnt ==2:
                    f.data[dev] = '/var'
                if cnt ==3:
                    f.data[dev] = '/storage'

            # If more than one drive exists..
                
            f.addAction(self.nextSingle)
            
            return f
Ejemplo n.º 19
0
    def form_pageForm(self, data):
        f = form.Form()

        f.addField('rootpw', form.String(required=True), form.CheckedPassword,label = "Root Password", 
            description = "Enter a root password for the installation")

        f.addField('adminpw', form.String(required=True), form.CheckedPassword, label = "Administrator Password", 
            description = "Enter a password for the administrator account")

        f.addField('thusam', form.Boolean(), label = "Thusa Managed", 
            description = "Tick this option to grant THUSA (http://thusa.net) permission to provide remote management and support services to this Vulani server. " +
                          "If you have purchased a maintenance or remote support agreement from THUSA, you must tick this box.")

        f.addAction(self.next)

        return f
Ejemplo n.º 20
0
    def form_addServer(self, data):
        editServer = form.Form()
        editServer.addField('name', form.String(), label = "Server Name")
        editServer.addField('key', form.String(), label = "License Key", description="Leave blank to generate a new key")
        editServer.addField('hostname', form.String(), label = "Hostname", description="Hostname by which this server can be accessed")
        editServer.addAction(self.editServer)

        def gotData(result):
            
            editServer.data = {
                'name': result[1],
                'hostname': result[2],
                'key':  result[3]
            }
            return editServer
 
        return self.enamel.storage.getServer(int(self.arguments[0])).addCallbacks(gotData, gotData)
Ejemplo n.º 21
0
    def form_diskConfig(self, data):
        f = form.Form()

        f.addField('setup', form.String(),
            form.widgetFactory(form.RadioChoice, 
                options=(
                    ('raid1', 'RAID 1'),
                    ('noraid', 'Single device')
                )
            ),
            label = "Setup"
        )
        
        # If more than one drive exists..
        f.data['setup'] = 'raid1'

        f.addAction(self.next)
        return f
Ejemplo n.º 22
0
    def form_pageForm(self, data):
        f = form.Form()

        wans = self.getWan()

        for l in wans:
            f.addField(l,
                       form.String(),
                       label="%s Username" % (l.replace('eth', 'Port ')),
                       description="Username for PPPoE conection")

            f.addField('pass%s' % l,
                       form.String(),
                       label="%s Password" % (l.replace('eth', 'Port ')),
                       description="Password for PPPoE connection")

        f.addAction(self.next)

        return f
Ejemplo n.º 23
0
    def form_pageForm(self, data):
        f = form.Form()

        wans = self.getWan()

        for l in wans:
            f.addField(l,
                       form.String(),
                       label="%s IP" % (l.replace('eth', 'Port ')),
                       description=
                       "IP address (CIDR format v.w.x.y/z) or blank for DHCP")

            f.addField('gw%s' % l,
                       form.String(),
                       label="%s Gateway" % (l.replace('eth', 'Port ')),
                       description="IP address or blank for no default route")

        f.addAction(self.next)

        return f
Ejemplo n.º 24
0
    def form_pageForm(self, data):
        f = form.Form()

        f.addField('CompanyName', form.String(required=True), label = "Company Name")

        f.addField('ExternalName', form.String(required=True), label = "External Name", description = "Fully qualified hostname by which this server will be reachable")

        f.addField('Hostname', form.String(required=True), label = "Hostname", description = "The short hostname for this server")

        f.addField('Domain', form.String(required=True), label = "Domain", description = "The DNS domain for this server")

        f.addField('SambaDomain', form.String(), label = "Windows Domain", description = "The Windows domain this server will provide")


        fi = open('/home/installer/tzs')

        zones = []

        for i in fi:
            ln = i.strip('\n').strip('/')

            if ln:
                zones.append(ln)

        zones.sort()

        timezones = [(i,i) for i in zones]

        f.addField('timezone', form.String(required=True), form.widgetFactory(form.SelectChoice, options=timezones), label = "Timezone")

        f.data = {
            'CompanyName':'My Company',
            'ExternalName':'vulani-gw.yourdomain.co.za',
            'Hostname':'vulani',
            'Domain':'yourdomain.co.za',
            'SambaDomain': ''
        }

        f.addAction(self.next)

        return f
Ejemplo n.º 25
0
    def form_vlic(self, data):
        vlics = form.Form()
        vlics.addField('name',
                       form.String(required=True),
                       label="Client Name",
                       description="Where this server will be installed")
        vlics.addField(
            'host',
            form.String(),
            label="Hostname",
            description="The external hostname this server will be reachable on"
        )

        vlics.addField('support',
                       form.String(required=True),
                       form.widgetFactory(form.SelectChoice,
                                          options=(
                                              ('none', 'No support'),
                                              ('standard',
                                               'Standard update protection'),
                                              ('silver', 'Silver SLA'),
                                              ('gold', 'Gold SLA'),
                                              ('platinum', 'Platinum SLA'),
                                          )),
                       description="Select a support option")

        vlics.addField(
            'terms',
            form.Boolean(required=True),
            label="Accept Terms and Conditions",
            description=[
                "Please read and accept the ",
                tags.
                a(href=
                  "http://www.vulani.net/sites/default/files/downloads/T&C.pdf"
                  )["Terms and Conditions"]
            ])

        vlics.addAction(self.vlicOrder)
        return vlics
Ejemplo n.º 26
0
    def form_vlic(self, data):
        vlics = form.Form()

        def gotServerGroups(server):
            servers = [(i[0], i[1]) for i in server]
            vlics.addField(
                'sidlink',
                form.Integer(required=True),
                form.widgetFactory(form.SelectChoice, options=servers),
                label="SID Link",
                description=
                "The entry we have created - this will bond the server to the ordering group"
            )

            vlics.addField('completed',
                           form.Boolean(),
                           label="Complete",
                           description="Tick to complete the order. ")

            vlics.addAction(self.vlicOrder)
            return vlics

        return self.enamel.storage.getServers().addBoth(gotServerGroups)
Ejemplo n.º 27
0
        def renderForm(user):
            self.user = user
            domains = ['asd.co.za']
            username = self.user[3]
            domain = self.user[2]

            u_form = formal.Form(
                self.submitForm
            )[formal.Group('userSettings')[tags.div(_class="field")[
                tags.label[self.text.userFormLabelEmailAddress],
                tags.div(id="emailAd", _class="inputs")["%s@%s" %
                                                        (username, domain)]],
                                           formal.Field('uid',
                                                        formal.String(
                                                            required=True),
                                                        label=self.text.
                                                        userFormLabelUsername),
                                           formal.Field('givenName',
                                                        formal.String(
                                                            required=True),
                                                        label=self.text.
                                                        userFormLabelName),
                                           formal.Field('sn',
                                                        formal.String(),
                                                        label=self.text.
                                                        userFormLabelSurname),
                                           formal.Field('userPassword',
                                                        formal.String(),
                                                        formal.CheckedPassword,
                                                        label=self.text.
                                                        userFormLabelPass), ],
              formal.Group('mailSettings')
              [formal.Field('mailForwardingAddress0',
                            formal.String(),
                            label=self.text.userFormLabelForward),
               formal.
               Field('mailForwardingAddress1', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress2', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress3', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress4', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress5', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress6', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress7', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress8', formal.String(), label=""),
               formal.
               Field('mailForwardingAddress9', formal.String(), label=""),
               tags.div(
                   _class="userLine")[tags.a(href="#", onclick="addForward();")
                                      [self.text.userFormLabelAddline]],
               formal.Field('mailAlternateAddress0',
                            formal.String(),
                            label=self.text.userFormLabelAlias),
               formal.Field('mailAlternateAddress1', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress2', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress3', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress4', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress5', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress6', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress7', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress8', formal.String(), label=""
                            ),
               formal.Field('mailAlternateAddress9', formal.String(), label=""
                            ),
               tags.div(
                   _class="userLine")[tags.a(href="#", onclick="addAlias();")[
                       self.text.userFormLabelAddline]],
               formal.Field('vacen',
                            formal.Boolean(),
                            label=self.text.userFormLabelVacationActive,
                            description=self.text.userFormTextVacationNote),
               formal.Field('vacation',
                            formal.String(),
                            formal.TextArea,
                            label=self.text.userFormLabelVacation), ],
              formal.Group('userPermissions')
              [formal.Field('employeeType',
                            formal.Boolean(),
                            label=self.text.userFormLabelWeb),
               formal.Field('accountStatus',
                            formal.Boolean(),
                            label=self.text.userFormLabelEmail),
               formal.Field('tumsAdmin',
                            formal.Boolean(),
                            label=self.text.userFormLabelAdmin),
               formal.Field(
                   'tumsUser', formal.Sequence(formal.String()),
                   formal.widgetFactory(formal.CheckboxMultiChoice,
                                        [(i, i) for i in domains])),
               formal.Field('tumsReports',
                            formal.Boolean(),
                            label=self.text.userFormLabelReports),
               #      formal.Field('copyto', formal.String(), label = self.text.userFormLabelCopy,
               #          description = self.text.userFormTextCopy)
               ],
              #  formal.Group('userAccess')[
              #      formal.Field('vpnEnabled', formal.Boolean(), label = self.text.userFormLabelVPN,
              #          description = self.text.userFormTextVPN),
              #      formal.Field('ftpEnabled', formal.Boolean(), label = self.text.userFormLabelFTP,
              #          description = self.text.userFormTextFTP),
              #      formal.Field('ftpGlobal', formal.Boolean(), label = self.text.userFormLabelGlobalFTP,
              #          description = self.text.userFormTextGlobal)
              #  ]
              ]

            u_form.addAction(self.submitForm)

            u_form.data['userSettings.uid'] = self.user[3]
            u_form.data['userSettings.givenName'] = self.user[4]
            u_form.data['userSettings.sn'] = self.user[5]

            u_form.data['userPermissions.employeeType'] = "squid" in self.user[
                9]
            u_form.data['userPermissions.tumsUser'] = []
            u_form.data[
                'userPermissions.accountStatus'] = "active" in self.user[10]
            u_form.data[
                'userPermissions.tumsAdmin'] = "tumsAdmin" in self.user[9]
            u_form.data['userPermissions.tumsReports'] = "Repor" in self.user[
                9]

            u_form.data['mailSettings.vacen'] = self.user[20] == 1
            u_form.data['mailSettings.vacation'] = self.user[19]

            return u_form
Ejemplo n.º 28
0
    def form_addDomain(self, data):
        addDomain = form.Form()
        addDomain.addField('domain', form.String(), label="Domain")
        addDomain.addAction(self.addDomain)

        return addDomain
Ejemplo n.º 29
0
        def gotDisks(disks):
            f = form.Form()

            # Decide how many raid sets we can create from numbers of even partitions

            raidDisks = {}
            
            # Split on new lines, and remove the * that signifies bootable partitions
            for n in disks.replace('*','').split('\n'):
                if not n.strip():
                    continue
                parts = n.split()
                device = parts[0].strip('/dev/')
                cyls = int(parts[3].strip('-').strip('+'))
                raidDisks[device] = cyls

            # Find congruency 

            raidSets = {}

            used = []
            
            for k, v in raidDisks.items():
                if k in used:
                    continue 

                raidSets[k] = [k]

                used.append(k)

                # one partition per drive only
                usedHere = [k[:-1]]

                for otherk, otherv in raidDisks.items():
                    # Never check disks twice
                    if otherk in used:
                        # Already got this
                        continue

                    if otherk[:-1] in usedHere:
                        # Make sure we only check different drives
                        continue

                    if otherv == v:
                        # Same size
                        raidSets[k].append(otherk)
                        used.append(otherk)
                        usedHere.append(otherk[:-1])

            print raidSets

            sets = [v for k,v in raidSets.items()]

            self.raidSets = {}

            for raidNum, set in enumerate(sets):
                size = (int(raidDisks[set[0]]) * 8225280)/(1024*1024)

                # Store it.
                self.raidSets["md%s" % raidNum] = set

                f.addField('md%s' % raidNum, form.String(),
                    form.widgetFactory(form.SelectChoice, 
                        options=(
                            ('/', '/'), 
                            ('/var', '/var'), 
                            ('/storage', '/storage')
                        )
                    ),
                    label = [tags.strong["md%s" % (raidNum)], " (%sMB)" % size]
                )

            f.data = {
                'md0': '/',
                'md1': '/var',
                'md2': '/storage',
            }
 
            # If more than one drive exists..
                
            f.addAction(self.next)
            
            # Time to find some disks

            return f