]> gitweb.pimeys.fr Git - scripts-20-100.git/blob - bde/old/big_brother.py
Les 2 scripts indispensables pour lancer une appli graphique sur la machine distante
[scripts-20-100.git] / bde / old / big_brother.py
1 #!/usr/bin/python
2 # -*- coding:utf8 -*-
3
4 # vieilles version de big_brother, la version propre et à jour est dans /usr/script/gestion
5
6 from commands import getstatusoutput as ex
7 import os
8
9 # liste des supremes connus
10 known = "(2430,1767,2821,2221,2863,2882,3019,1230,2969,2804,1206,250,2837,2832,2850)"
11
12 message = "\nDroits supreme :\n"
13 supremes=ex("psql bde -c 'SELECT numcbde,prenom,nom,pseudo FROM adherents WHERE supreme=true AND NOT numcbde IN %s;'"%(known))[1]
14
15 i=supremes.split()[-2]
16 if i=="(0":
17 message+="(Seulement des gens connus)\n"
18 else:
19 message+="!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"+supremes
20
21
22 message+= "\n\nDroits invités :\n"
23 droits_invites=ex('psql bde -c"SELECT numcbde,prenom,nom,pseudo FROM adherents WHERE droits&128!=0 AND supreme=false AND numcbde!=0;"')[1]
24 i=droits_invites.split()[-2]
25 if i=="(0":
26 message+="(Personne à part les supreme)"
27 else:
28 message+="!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"+droits_invites
29
30
31 header = "From: note-bigbrother@bde.crans.org\nTo: root\n"
32 header += "Subject: Résumé des droits\n"
33 mailer=os.popen("/usr/sbin/sendmail -t", "w")
34 mailer.write(header+message+'\n.')
35 mailer.close()