Plus de sale hack sur paiement=<anne en cours> quand on est en septembre

Maintenant pour savoir si un peiement est valide pour la priode en cours il
suffira de chercher avec paiement=ok

darcs-hash:20040930224644-41617-62aecb62998fc489eb30b40fb3cb707af60ed12e.gz
This commit is contained in:
pauget 2004-10-01 00:46:44 +02:00
parent b6e6dfa2f3
commit 25e5ed6874
7 changed files with 17 additions and 14 deletions

View file

@ -30,7 +30,6 @@ except :
class gen_config : class gen_config :
""" Base pour toutes les classes de génération de fichiers de conf """ """ Base pour toutes les classes de génération de fichiers de conf """
base = None base = None
ann_scol = config.ann_scol
debug = 0 debug = 0
_locked = 0 _locked = 0
__restore={} # pour restorer la config d'origine en cas d'erreur de génération __restore={} # pour restorer la config d'origine en cas d'erreur de génération

View file

@ -6,7 +6,7 @@ import sys, signal, os
# Imports pour LDAP # Imports pour LDAP
sys.path.append('/usr/scripts/gestion') sys.path.append('/usr/scripts/gestion')
from gen_confs import gen_config, anim, cprint, OK, ERREUR from gen_confs import gen_config, anim, cprint, OK, ERREUR
from ldap_crans import crans_ldap, crans, ann_scol, preattr, ldap from ldap_crans import crans_ldap, crans, preattr, ldap
from socket import gethostname from socket import gethostname

View file

@ -43,7 +43,7 @@ class bl_upload_fw(gen_config) :
def _gen(self) : def _gen(self) :
upload = self._open_conf( self.BL_UPLOAD, '#' ) upload = self._open_conf( self.BL_UPLOAD, '#' )
base = self.base.search('paiement=%s' % self.ann_scol) base = self.base.search('paiement=ok')
for adh in ( [ self.crans ] + base['adherent'] + base['club'] ): for adh in ( [ self.crans ] + base['adherent'] + base['club'] ):
for machine in adh.machines() : for machine in adh.machines() :
self.anim.cycle() self.anim.cycle()

View file

@ -5,7 +5,7 @@ import sys, signal, os, commands, getopt, smtplib, shutil
sys.path.append('/usr/scripts/gestion') sys.path.append('/usr/scripts/gestion')
from ldap_crans import crans_ldap, crans, ann_scol, smtpserv from ldap_crans import crans_ldap, crans, smtpserv
from lock import * from lock import *
from affich_tools import anim, cprint, OK, ERREUR, WARNING from affich_tools import anim, cprint, OK, ERREUR, WARNING
from time import localtime, strftime from time import localtime, strftime
@ -38,7 +38,7 @@ for opt, val in options :
if opt == '--quiet' : if opt == '--quiet' :
debug = 0 debug = 0
elif len(opt)>2 and opt[:2]=='--' : elif len(opt)>2 and opt[:2]=='--' :
to_do[opt[2:]] = [ val ] to_do[opt[2:]] = val.split('.')
##### Lecture de la base LDAP si besion ce qu'il y a a faire et préparation ##### Lecture de la base LDAP si besion ce qu'il y a a faire et préparation
if not to_do : if not to_do :
@ -223,7 +223,7 @@ if gethostname().split(".")[0] == 'zamok':
# Machines de l'assoce # Machines de l'assoce
machines = crans(db.conn).machines() machines = crans(db.conn).machines()
# Machines des adhérents et clubs de l'année en cours # Machines des adhérents et clubs de l'année en cours
base = db.search('paiement=%s' % ann_scol) base = db.search('paiement=ok')
base = base['adherent'] + base['club'] base = base['adherent'] + base['club']
a = anim('\ttri machines',len(base)) a = anim('\ttri machines',len(base))
for adh in base : for adh in base :

View file

@ -17,7 +17,7 @@ class bl_carte_etudiant(gen_config) :
def _gen(self) : def _gen(self) :
fd=self._open_conf(self.BL_CARTE) fd=self._open_conf(self.BL_CARTE)
base = self.base.search('paiement=%s' % self.ann_scol) base = self.base.search('paiement=ok')
for adh in ( [ self.crans ] + base['adherent'] + base['club'] ): for adh in ( [ self.crans ] + base['adherent'] + base['club'] ):
for machine in adh.machines() : for machine in adh.machines() :
self.anim.cycle() self.anim.cycle()
@ -39,7 +39,7 @@ class bl_upload_squid(gen_config) :
def _gen(self) : def _gen(self) :
upload = self._open_conf( self.BL_UPLOAD ) upload = self._open_conf( self.BL_UPLOAD )
base = self.base.search('paiement=%s' % self.ann_scol) base = self.base.search('paiement=ok')
for adh in ( [ self.crans ] + base['adherent'] + base['club'] ): for adh in ( [ self.crans ] + base['adherent'] + base['club'] ):
for machine in adh.machines() : for machine in adh.machines() :
self.anim.cycle() self.anim.cycle()
@ -64,7 +64,7 @@ class bl_virus(gen_config) :
def _gen(self) : def _gen(self) :
virus = self._open_conf( self.BL_VIRUS ) virus = self._open_conf( self.BL_VIRUS )
base = self.base.search('paiement=%s' % self.ann_scol) base = self.base.search('paiement=ok')
for machine in base['machine'] : for machine in base['machine'] :
self.anim.cycle() self.anim.cycle()
bl = machine.blacklist_actif() bl = machine.blacklist_actif()

View file

@ -6,7 +6,7 @@ from gen_confs import gen_config, ERREUR, OK, anim
import sys import sys
sys.path.append('/usr/scripts/gestion') sys.path.append('/usr/scripts/gestion')
from ldap_crans import crans_ldap, ann_scol from ldap_crans import crans_ldap
class conf_wifi(gen_config) : class conf_wifi(gen_config) :
""" Génération de la configuration de isakmpd dans ISAKMPD_CONF """ Génération de la configuration de isakmpd dans ISAKMPD_CONF
@ -103,7 +103,7 @@ Netmask= 0.0.0.0
phase2 = self.phase2_debut phase2 = self.phase2_debut
blocs='' blocs=''
for machine in self.db.search('host=*.wifi.crans.org&paiement=%s' % ann_scol)['machine'] : for machine in self.db.search('host=*.wifi.crans.org&paiement=ok')['machine'] :
self.anim.cycle() self.anim.cycle()
if 'bloq' in machine.blacklist_actif() : continue if 'bloq' in machine.blacklist_actif() : continue
data = { 'HOST' : machine.nom().split('.')[0] , data = { 'HOST' : machine.nom().split('.')[0] ,

View file

@ -404,9 +404,13 @@ class crans_ldap :
# Formatage adresse mac # Formatage adresse mac
try : el = '(macAddress=%s)' % format_mac(expr) try : el = '(macAddress=%s)' % format_mac(expr)
except : return '' except : return ''
elif champ == 'paiement' and localtime()[1] == 9 and int(expr) == ann_scol: elif champ == 'paiement' and expr=='ok' :
# Dangereux, année de paiement # Paiement donnant droit à une connexion maintenant ?
el = "(|(paiement=%s)(paiement=%s))" % (int(ann_scol),int(ann_scol)-1) if localtime()[1] == 9 :
# Pourseptembre paiement année précédente ok
el = "(|(paiement=%s)(paiement=%s))" % (int(ann_scol),int(ann_scol)-1)
else :
el = "(paiement=%s)" % (int(ann_scol))
else : else :
# Cas général # Cas général
el = '(%s=%s)' % (champ, expr) el = '(%s=%s)' % (champ, expr)