From 129c4593b59d946d907ff42e07b9446e3cc968ec Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Tue, 16 Oct 2012 19:30:30 +0200 Subject: [PATCH] Une fonction pour se connecter facilement en admin en important secrets.py --- lc_ldap.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lc_ldap.py b/lc_ldap.py index dbd983e..d87d67d 100644 --- a/lc_ldap.py +++ b/lc_ldap.py @@ -76,7 +76,13 @@ def cldif_to_ldif(cldif): def lc_ldap_test(): """Binding LDAP à la base de tests""" - return lc_ldap(dn='cn=admin,dc=crans,dc=org', cred='75bdb64f32') + return lc_ldap(uri='ldap://vo.adm.crans.org',dn='cn=admin,dc=crans,dc=org', cred='75bdb64f32') + +def lc_ldap_admin(): + """Binding LDAP à la vraie vase, en admin. + Possible seulement si on peut lire secrets.py""" + secrets = import_secrets() + return lc_ldap(uri='ldap://ldap.adm.crans.org/', dn=secrets.ldap_auth_dn, cred=secrets.ldap_password) class lc_ldap(ldap.ldapobject.LDAPObject): """Connexion à la base ldap crans, chaque instance représente une connexion