diff --git a/gestion/gen_confs/__init__.py b/gestion/gen_confs/__init__.py index 193019e5..78a894c8 100755 --- a/gestion/gen_confs/__init__.py +++ b/gestion/gen_confs/__init__.py @@ -30,7 +30,6 @@ except : class gen_config : """ Base pour toutes les classes de génération de fichiers de conf """ base = None - ann_scol = config.ann_scol debug = 0 _locked = 0 __restore={} # pour restorer la config d'origine en cas d'erreur de génération diff --git a/gestion/gen_confs/droits.py b/gestion/gen_confs/droits.py index d63aa911..9dd605cc 100755 --- a/gestion/gen_confs/droits.py +++ b/gestion/gen_confs/droits.py @@ -6,7 +6,7 @@ import sys, signal, os # Imports pour LDAP sys.path.append('/usr/scripts/gestion') 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 diff --git a/gestion/gen_confs/firewall.py b/gestion/gen_confs/firewall.py index 80a4f17a..eeb3ec1e 100755 --- a/gestion/gen_confs/firewall.py +++ b/gestion/gen_confs/firewall.py @@ -43,7 +43,7 @@ class bl_upload_fw(gen_config) : def _gen(self) : 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 machine in adh.machines() : self.anim.cycle() diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index c329943a..a0ff1241 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -5,7 +5,7 @@ import sys, signal, os, commands, getopt, smtplib, shutil 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 affich_tools import anim, cprint, OK, ERREUR, WARNING from time import localtime, strftime @@ -38,7 +38,7 @@ for opt, val in options : if opt == '--quiet' : debug = 0 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 if not to_do : @@ -223,7 +223,7 @@ if gethostname().split(".")[0] == 'zamok': # Machines de l'assoce machines = crans(db.conn).machines() # 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'] a = anim('\ttri machines',len(base)) for adh in base : diff --git a/gestion/gen_confs/squid.py b/gestion/gen_confs/squid.py index 897a0138..6ca5c1ba 100755 --- a/gestion/gen_confs/squid.py +++ b/gestion/gen_confs/squid.py @@ -17,7 +17,7 @@ class bl_carte_etudiant(gen_config) : def _gen(self) : 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 machine in adh.machines() : self.anim.cycle() @@ -39,7 +39,7 @@ class bl_upload_squid(gen_config) : def _gen(self) : 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 machine in adh.machines() : self.anim.cycle() @@ -64,7 +64,7 @@ class bl_virus(gen_config) : def _gen(self) : 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'] : self.anim.cycle() bl = machine.blacklist_actif() diff --git a/gestion/gen_confs/wifi.py b/gestion/gen_confs/wifi.py index 47c041c4..9b1abac2 100755 --- a/gestion/gen_confs/wifi.py +++ b/gestion/gen_confs/wifi.py @@ -6,7 +6,7 @@ from gen_confs import gen_config, ERREUR, OK, anim import sys 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) : """ Génération de la configuration de isakmpd dans ISAKMPD_CONF @@ -103,7 +103,7 @@ Netmask= 0.0.0.0 phase2 = self.phase2_debut 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() if 'bloq' in machine.blacklist_actif() : continue data = { 'HOST' : machine.nom().split('.')[0] , diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index f08ee420..460b41a0 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -404,9 +404,13 @@ class crans_ldap : # Formatage adresse mac try : el = '(macAddress=%s)' % format_mac(expr) except : return '' - elif champ == 'paiement' and localtime()[1] == 9 and int(expr) == ann_scol: - # Dangereux, année de paiement - el = "(|(paiement=%s)(paiement=%s))" % (int(ann_scol),int(ann_scol)-1) + elif champ == 'paiement' and expr=='ok' : + # Paiement donnant droit à une connexion maintenant ? + 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 : # Cas général el = '(%s=%s)' % (champ, expr)