diff --git a/lib/yunohost_ldap.py b/lib/yunohost_ldap.py new file mode 100644 index 00000000..9582d3e3 --- /dev/null +++ b/lib/yunohost_ldap.py @@ -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") diff --git a/lib/yunohost_user.py b/lib/yunohost_user.py index f4b13221..5a4aa43a 100644 --- a/lib/yunohost_user.py +++ b/lib/yunohost_user.py @@ -1,5 +1,10 @@ -#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- +import ldap +import ldap.modlist as modlist +import yunohost_ldap as yldap + 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] diff --git a/yunohost b/yunohost index 37fc68d6..ef160a73 100755 --- a/yunohost +++ b/yunohost @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # -*- coding: utf-8 -*- import sys