From 508bffbe48ce6f65266d7dd7982970fb558ea985 Mon Sep 17 00:00:00 2001 From: bos Date: Mon, 21 May 2007 23:25:31 +0200 Subject: [PATCH] Validation des mails darcs-hash:20070521212531-c992d-3fd6d670d0b54a35dbe594c7ce14656171369f09.gz --- gestion/gen_confs/adherents.py | 21 ++++++++++++++++++++- gestion/gen_confs/generate.py | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gestion/gen_confs/adherents.py b/gestion/gen_confs/adherents.py index 80e04f75..6b7d757c 100755 --- a/gestion/gen_confs/adherents.py +++ b/gestion/gen_confs/adherents.py @@ -9,7 +9,7 @@ sys.path.append('/usr/scripts/gestion') from affich_tools import cprint, anim, OK, WARNING, ERREUR import config from time import strftime -from ldap_crans import hostname +from ldap_crans import hostname, crans_ldap try: sys.path.append('/usr/lib/mailman') @@ -186,3 +186,22 @@ class ML_ens: print OK mlist.Save() mlist.Unlock() + +class mail_valide: + debug = True + + def __init__(self,aids): + self.aids = aids + + def reconfigure(self): + db = crans_ldap() + cprint(u'Validation d\'adresses', 'gras') + for aid in self.aids: + adh = db.search(("aid=%s" %aid), 'w')['adherent'][0] + if not adh._modifiable: + db.services_to_restart('mail_valide',aid) + print "echec pour le mail de %s" %adh.nom() + else: + adh.mail_invalide(False) + adh.save() + print "mail de %s marque valide" % adh.nom() diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index 9e725eb0..5ee6b6b5 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -173,6 +173,9 @@ class rouge(base_reconfigure): from adherents import del_user self._do(del_user(args)) + def mail_valide(self, args): + from adherents import mail_valide + self._do(mail_valide(args)) class zamok(base_reconfigure): def del_user(self, args):