
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
74 lines
2.1 KiB
Python
Executable file
74 lines
2.1 KiB
Python
Executable file
#! /usr/bin/env python
|
|
# -*- coding: iso-8859-15 -*-
|
|
|
|
""" Génération de la configuration pour squid """
|
|
|
|
from gen_confs import gen_config
|
|
from time import localtime
|
|
|
|
class bl_carte_etudiant(gen_config) :
|
|
""" Génère le fichier de blackliste pour carte d'étudiant pour squid"""
|
|
BL_CARTE = '/tmp/bl_carte_et'
|
|
restart_cmd = '/etc/init.d/squid reload'
|
|
|
|
def __str__(self) :
|
|
return "blackliste cartes d'étudiant"
|
|
|
|
def _gen(self) :
|
|
fd=self._open_conf(self.BL_CARTE)
|
|
|
|
base = self.base.search('paiement=ok')
|
|
for adh in ( [ self.crans ] + base['adherent'] + base['club'] ):
|
|
for machine in adh.machines() :
|
|
self.anim.cycle()
|
|
if 'bloq' in machine.blacklist_actif() : continue
|
|
if machine.proprietaire().idn != 'aid' : continue
|
|
fd.write(machine.nom() + '\n')
|
|
|
|
fd.close()
|
|
|
|
class bl_upload_squid(gen_config) :
|
|
""" Génère le fichier de blackliste d'upload pour squid"""
|
|
# Fichier
|
|
BL_UPLOAD = '/tmp/bl_upload_squid'
|
|
restart_cmd = '/etc/init.d/squid reload'
|
|
|
|
def __str__(self) :
|
|
return "blackliste upload squid"
|
|
|
|
def _gen(self) :
|
|
upload = self._open_conf( self.BL_UPLOAD )
|
|
|
|
base = self.base.search('paiement=ok')
|
|
for adh in ( [ self.crans ] + base['adherent'] + base['club'] ):
|
|
for machine in adh.machines() :
|
|
self.anim.cycle()
|
|
bl = machine.blacklist_actif()
|
|
if 'bl_upload' in bl and not 'bloq' in bl :
|
|
upload.write( machine.nom() + '\n' )
|
|
|
|
upload.close()
|
|
|
|
class bl_virus(gen_config) :
|
|
""" Génère le fichier de blackliste virus pour squid"""
|
|
# Fichiers
|
|
BL_VIRUS = '/tmp/bl_virus'
|
|
|
|
def __str__(self) :
|
|
return "blackliste virus"
|
|
|
|
restart_cmd = '/etc/init.d/squid reload'
|
|
|
|
description = u'Bloquage accès http vers l\'extérieur, page expliquative'
|
|
|
|
def _gen(self) :
|
|
virus = self._open_conf( self.BL_VIRUS )
|
|
|
|
base = self.base.search('paiement=ok')
|
|
for machine in base['machine'] :
|
|
self.anim.cycle()
|
|
bl = machine.blacklist_actif()
|
|
if 'bl_virus' in bl and not 'bloq' in bl :
|
|
virus.write( machine.nom() + '\n')
|
|
|
|
virus.close()
|