From f8ce7115a174fb4c7abbe126d4f056f25521cb12 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 3 Jul 2012 11:33:40 +0200 Subject: [PATCH] config through constructor --- getmailad.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/getmailad.py b/getmailad.py index 5749523..ba0510f 100755 --- a/getmailad.py +++ b/getmailad.py @@ -2,21 +2,20 @@ class getmailad(object): - """ get all email addresses from enabled(not disabled) + """ get all email addresses from enabled users/groups from active directory """ """ tested with windows 2003 domain """ - def __init__(self): + def __init__(self, ldap_server, bind_dn, bind_pass, base_dn): self.addresslist = [] self.count = 0 - #TODO: make this configurable via constructor - self._ldap_server = "ldap://dc2.aec.at" - self._bind_dn = "david@aec.at" - self._bind_pass = "xxxxxxx" - self._base_dn = "ou=adm,dc=aec,dc=at" + self._ldap_server = ldap_server + self._bind_dn = bind_dn + self._bind_pass = bind_pass + self._base_dn = base_dn def get(self): @@ -58,7 +57,7 @@ class getmailad(object): if __name__ == "__main__": - getmailadobj = getmailad() + getmailadobj = getmailad("ldap://dc2.aec.at", "davidsa@aec.at", "secret", "ou=adm,dc=aec,dc=at") getmailadobj.get() for item in getmailadobj.addresslist: print item