source: n4d-matrix/trunk/install_matrix/usr/share/n4d/python-plugins/Matrix.py @ 1227

Last change on this file since 1227 was 1227, checked in by kbut, 3 years ago

add packages files

File size: 837 bytes
Line 
1import ldap
2import ldap.sasl
3import ldap.modlist
4
5class Matrix:
6        '''
7        def connection_ldap(self):
8                try:
9                        self.connect_ldap=ldap.initialize('ldap://localhost:389',trace_level=0)
10                        self.connect_ldap.protocol_version=3
11                        password = "lliurex"
12                        self.connect_ldap.bind_s("cn=admin,dc=ma5,dc=lliurex,dc=net",password)
13                        return True
14                except Exception as e:
15                        print "\n\nError" + str(e) + "\n\n"
16                        self.connect_ldap = None
17                        return False
18        '''
19        def get_users(self):
20                objects['SlapdManager'].connection_ldap()
21                #self.connection_ldap()
22                all_results = objects['SlapdManager'].connect_ldap.search_s('dc=ma5,dc=lliurex,dc=net',ldap.SCOPE_SUBTREE)
23                dic_all_results = map(list,all_results)
24                dic_all_results.pop(0)
25                return  dic_all_results
26
27if __name__ == '__main__':
28        a = Matrix()
29        a.connection_ldap()
30        for x in a.respuesta():
31                print x
Note: See TracBrowser for help on using the repository browser.