Exemplo n.º 1
0
    def identities( self ):
        '''
        Returns a list of identities defined on the user configuration.
        @return a list of identities in dictionary form.
        '''
        identity_list = []
        for section in self.sections():
            identity_sec = self.identity_re.match(section)
            if identity_sec:
                identity = {}
                identity['id_number'] = int(identity_sec.group('id_number'))
                for option in self.options(section):
                    identity[option] = self.get( section, option )
                identity_list.append( identity )
        identity_list.sort(cmp_dict( 'id_number' ))

        return identity_list
Exemplo n.º 2
0
def server_list():
    '''
    Returns a list of server configurations. This is the login server, ie, the
    server against which the users authenticate.
    '''
    config = server_config()

    server_list = []
    k = 0
    for server in config.sections():
        s = {}
        s['label'] = server
        k += 1
        for option in config.options(server):
            s[option] = config.get( server, option )
        server_list.append(s)
    server_list.sort(cmp_dict('name'))

    return server_list