Commit 483dad2f authored by Gabriel Detraz's avatar Gabriel Detraz

Corrige les fichiers d'execution des binaires mailman

parent 09558e3a
#!/bin/bash /usr/scripts/python.sh
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Licence : GPLv2
import sys, smtplib, commands
from gestion.gen_confs import gen_config
sys.path.append('/usr/scripts/gestion')
from ldap_crans import smtpserv, crans_ldap, Machine, Adherent, Club
from whos import machine_details, adher_details, club_details
from gen_confs import gen_config
from affich_tools import cprint, OK, anim
from email.mime.text import MIMEText
import affichage
from lc_ldap import shortcuts
from lc_ldap import printing
smtpserv = "smtp.crans.org"
class mail:
"""
Envoie un mail à toutes les personnes de la liste 'To', avec les
informations détaillées des objets contenus dans 'objets'
(instances des classes Adherent, Machine ou Club) """
From = 'roots@crans.org'
To = [ 'roots@crans.org' ]
Subject = "Surveillance modifications de la base LDAP"
......@@ -40,34 +37,42 @@ Content-Transfer-Encoding: 8bit
def __init__(self,recherches) :
self.recherches = recherches
def reconfigure(self) :
""" Envoi le mail """
animation = affichage.Animation(texte="Mail de notification de modifications", nb_cycles=len(self.recherches), couleur=True, kikoo=True)
db = shortcuts.lc_ldap_readonly()
cprint(u'Mail de notification de modifications', 'gras')
a = anim('\tRecherches dans la base',len(self.recherches))
db = crans_ldap()
details = []
vus = []
for rech in self.recherches :
for results in db.search(unicode(rech)):
if results.dn in vus : continue
vus.append(results.dn)
details.append(printing.sprint(results))
animation.new_step()
for results in db.search(rech).values() :
for res in results :
if res.dn in vus : continue
vus.append(res.dn)
if isinstance(res, Machine):
details.append(machine_details(res))
elif res.__class__ == Adherent:
details.append(adher_details(res))
elif res.__class__ == Club:
details.append(club_details(res))
a.cycle()
texte = '\n\n- - - - = = = = # # # # # # = = = = - - - -\n\n'.join(details)
a.reinit()
if not details :
print(u"Rien")
print "rien"
return
print OK
print(affichage.OK)
print('\nEnvoie Mail')
anim('\tEnvoi mail')
if not self.couleur :
import re
texte = re.sub('\x1b\[1;([0-9]|[0-9][0-9])m','',texte)
conn=smtplib.SMTP(smtpserv)
msg = MIMEText(texte.encode('utf-8'), _charset='utf-8')
msg['From'] = self.From
......@@ -75,12 +80,12 @@ Content-Transfer-Encoding: 8bit
msg['Subject'] = self.Subject
conn.sendmail(self.From, self.To , msg.as_string())
conn.quit()
print(affichage.OK)
print OK
class mail_solde:
"""
Envoie un mail a la ML impression pour les modifications de solde"""
From = 'root@crans.org'
To = [ 'impression@crans.org' ]
Subject = "Modification de solde"
......@@ -89,7 +94,7 @@ class mail_solde:
To: %(To)s
Subject: %(Subject)s
X-Mailer: modif_solde (/usr/scripts/gestion/gen_confs/supervision.py)
%(Text)s"""
# Avec les caractères d'échappement qui vont bien pour la couleur ?
......@@ -97,22 +102,21 @@ X-Mailer: modif_solde (/usr/scripts/gestion/gen_confs/supervision.py)
def __init__(self,modifs) :
self.modifs = modifs
def reconfigure(self) :
""" Envoi le mail """
animation = affichage.Animation(texte="Mail de notification de modifications du solde", nb_cycles=len(self.modifs), couleur=True, kikoo=True)
cprint(u'Mail de notification de modifications du solde', 'gras')
texte = ''
for modif in self.modifs:
animation.new_step()
texte = texte + modif.decode('utf-8', 'ignore') + u'\n'
print('\tEnvoi mail')
anim('\tEnvoi mail')
conn=smtplib.SMTP(smtpserv)
conn.sendmail(self.From, self.To , \
self.mail_template % { 'From' : self.From,
self.mail_template % { 'From' : self.From,
'To' : ','.join(self.To),
'Subject' : self.Subject,
'Text' : texte.encode('utf-8', 'ignore') } )
conn.quit()
print(affichage.OK)
print OK
#! /usr/bin/env python
#!/bin/bash /usr/scripts/python.sh
# -*- mode: python; coding: utf-8 -*-
# Licence : GPLv2
import sys, smtplib, commands
sys.path.append('/usr/scripts/gestion')
from ldap_crans import smtpserv, crans_ldap, Machine, Adherent, Club
from whos import machine_details, adher_details, club_details
from gen_confs import gen_config
from affich_tools import cprint, OK, anim
from gestion.gen_confs import gen_config
from email.mime.text import MIMEText
import affichage
from lc_ldap import shortcuts
from lc_ldap import printing
smtpserv = "smtp.crans.org"
class mail:
"""
Envoie un mail à toutes les personnes de la liste 'To', avec les
informations détaillées des objets contenus dans 'objets'
(instances des classes Adherent, Machine ou Club) """
From = 'roots@crans.org'
To = [ 'roots@crans.org' ]
Subject = "Surveillance modifications de la base LDAP"
......@@ -37,42 +40,34 @@ Content-Transfer-Encoding: 8bit
def __init__(self,recherches) :
self.recherches = recherches
def reconfigure(self) :
""" Envoi le mail """
cprint(u'Mail de notification de modifications', 'gras')
a = anim('\tRecherches dans la base',len(self.recherches))
db = crans_ldap()
animation = affichage.Animation(texte="Mail de notification de modifications", nb_cycles=len(self.recherches), couleur=True, kikoo=True)
db = shortcuts.lc_ldap_readonly()
details = []
vus = []
for rech in self.recherches :
for results in db.search(rech).values() :
for res in results :
if res.dn in vus : continue
vus.append(res.dn)
if isinstance(res, Machine):
details.append(machine_details(res))
elif res.__class__ == Adherent:
details.append(adher_details(res))
elif res.__class__ == Club:
details.append(club_details(res))
a.cycle()
for results in db.search(unicode(rech)):
if results.dn in vus : continue
vus.append(results.dn)
details.append(printing.sprint(results))
animation.new_step()
texte = '\n\n- - - - = = = = # # # # # # = = = = - - - -\n\n'.join(details)
a.reinit()
if not details :
print "rien"
print(u"Rien")
return
print OK
anim('\tEnvoi mail')
print(affichage.OK)
print('\nEnvoie Mail')
if not self.couleur :
import re
texte = re.sub('\x1b\[1;([0-9]|[0-9][0-9])m','',texte)
conn=smtplib.SMTP(smtpserv)
msg = MIMEText(texte.encode('utf-8'), _charset='utf-8')
msg['From'] = self.From
......@@ -80,12 +75,12 @@ Content-Transfer-Encoding: 8bit
msg['Subject'] = self.Subject
conn.sendmail(self.From, self.To , msg.as_string())
conn.quit()
print OK
print(affichage.OK)
class mail_solde:
"""
Envoie un mail a la ML impression pour les modifications de solde"""
From = 'root@crans.org'
To = [ 'impression@crans.org' ]
Subject = "Modification de solde"
......@@ -94,7 +89,7 @@ class mail_solde:
To: %(To)s
Subject: %(Subject)s
X-Mailer: modif_solde (/usr/scripts/gestion/gen_confs/supervision.py)
%(Text)s"""
# Avec les caractères d'échappement qui vont bien pour la couleur ?
......@@ -102,21 +97,22 @@ X-Mailer: modif_solde (/usr/scripts/gestion/gen_confs/supervision.py)
def __init__(self,modifs) :
self.modifs = modifs
def reconfigure(self) :
""" Envoi le mail """
cprint(u'Mail de notification de modifications du solde', 'gras')
animation = affichage.Animation(texte="Mail de notification de modifications du solde", nb_cycles=len(self.modifs), couleur=True, kikoo=True)
texte = ''
for modif in self.modifs:
animation.new_step()
texte = texte + modif.decode('utf-8', 'ignore') + u'\n'
anim('\tEnvoi mail')
print('\tEnvoi mail')
conn=smtplib.SMTP(smtpserv)
conn.sendmail(self.From, self.To , \
self.mail_template % { 'From' : self.From,
self.mail_template % { 'From' : self.From,
'To' : ','.join(self.To),
'Subject' : self.Subject,
'Text' : texte.encode('utf-8', 'ignore') } )
conn.quit()
print OK
print(affichage.OK)
#!/bin/bash
LANG=fr_FR.UTF-8 sudo /var/lib/mailman/bin/change_pw "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/change_pw "$@"
#!/bin/bash
LANG=fr_FR.UTF-8 sudo /var/lib/mailman/bin/find_member "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/find_member "$@"
#!/bin/bash
LANG=fr_FR.UTF-8 sudo /var/lib/mailman/bin/list_admins "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/list_admins "$@"
#!/bin/bash
LANG=fr_FR.UTF-8 sudo /var/lib/mailman/bin/list_lists "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/list_lists "$@"
#!/bin/bash
LANG=fr_FR.UTF-8 sudo /var/lib/mailman/bin/list_members "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/list_members "$@"
#!/bin/bash
LANG=fr_FR.UTF-8 sudo -u list /var/lib/mailman/bin/list_owners "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/list_owners "$@"
#!/bin/bash
LANG=fr_FR.UTF-8 sudo /var/lib/mailman/bin/list_requests "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/list_requests "$@"
#!/bin/bash
LANG=fr_FR.UTF-8 sudo /var/lib/mailman/bin/newlist "$@"
LANG=fr_FR.UTF-8 /var/lib/mailman/bin/newlist "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment