mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
LDAP file init
This commit is contained in:
parent
f32ee5c854
commit
6800be9543
3 changed files with 14 additions and 3 deletions
6
lib/yunohost_ldap.py
Normal file
6
lib/yunohost_ldap.py
Normal 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")
|
|
@ -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]
|
||||||
|
|
2
yunohost
2
yunohost
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in a new issue