LDAP file init

This commit is contained in:
Kloadut 2012-10-06 17:57:08 +02:00 committed by root
parent f32ee5c854
commit 6800be9543
3 changed files with 14 additions and 3 deletions

6
lib/yunohost_ldap.py Normal file
View file

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
import ldap
conn = ldap.initialize('ldap://localhost:389')
conn.simple_bind_s("cn=admin,dc=yunohost,dc=org","secret")

View file

@ -1,5 +1,10 @@
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import ldap
import ldap.modlist as modlist
import yunohost_ldap as yldap
def user_list(args): def user_list(args):
print args result = yldap.conn.search_s('ou=users,dc=gavoty,dc=org',ldap.SCOPE_SUBTREE,'(cn=*)',['cn','mail'])
for dn,entry in result:
print entry['mail'][0]

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7 #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys