petites modifs pour le greylisting qui est maintenant oprationel
darcs-hash:20051123210943-4ec08-6f15a8304951121c5869a0389170ba4cb3df1bd7.gz
This commit is contained in:
parent
c21e75fea8
commit
3d3f114ed2
3 changed files with 35 additions and 11 deletions
|
@ -68,7 +68,7 @@ def coul(txt,col):
|
||||||
Les couleur sont celles de codecol
|
Les couleur sont celles de codecol
|
||||||
Il est possible de changer la couleur de fond grace aux couleur f_<couleur>
|
Il est possible de changer la couleur de fond grace aux couleur f_<couleur>
|
||||||
"""
|
"""
|
||||||
codecol={'rouge' : 31 , 'vert' : 32 , 'jaune' : 33 , 'bleu': 34 , 'violet' : 35 , 'cyan' : 36 , 'gras' : 50}
|
codecol={'rouge' : 31 , 'vert' : 32 , 'jaune' : 33 , 'bleu': 34 , 'violet' : 35 , 'cyan' : 36 , 'gris' : 30, 'gras' : 50}
|
||||||
try :
|
try :
|
||||||
if col[:2]=='f_' : add=10; col=col[2:]
|
if col[:2]=='f_' : add=10; col=col[2:]
|
||||||
else : add=0
|
else : add=0
|
||||||
|
|
|
@ -210,7 +210,7 @@ class crans_ldap:
|
||||||
'club': [ 'nom', 'chbre' ] }
|
'club': [ 'nom', 'chbre' ] }
|
||||||
|
|
||||||
# Champs de recherche pour la recherche manuelle (en plus de la recherche auto)
|
# Champs de recherche pour la recherche manuelle (en plus de la recherche auto)
|
||||||
non_auto_search_champs = { 'adherent': [ 'etudes', 'paiement', 'carteEtudiant', 'aid' , 'postalAddress', 'historique' ,'blacklist', 'droits', 'uidNumber', 'uid', 'info', 'solde' , 'controle' ], \
|
non_auto_search_champs = { 'adherent': [ 'etudes', 'paiement', 'carteEtudiant', 'aid' , 'postalAddress', 'historique' ,'blacklist', 'droits', 'uidNumber', 'uid', 'info', 'solde' , 'controle' , 'contourneGreylist' ], \
|
||||||
'machine': [ 'mid' , 'ipsec', 'historique', 'blacklist' , 'puissance', 'canal', 'portTCPin', 'portTCPout', 'portUDPin', 'portUDPout', 'prise' , 'info', 'exempt' ] ,
|
'machine': [ 'mid' , 'ipsec', 'historique', 'blacklist' , 'puissance', 'canal', 'portTCPin', 'portTCPout', 'portUDPin', 'portUDPout', 'prise' , 'info', 'exempt' ] ,
|
||||||
'club': [ 'cid' , 'responsable', 'paiement', 'historique', 'blacklist', 'mailAlias', 'info', 'controle' ] }
|
'club': [ 'cid' , 'responsable', 'paiement', 'historique', 'blacklist', 'mailAlias', 'info', 'controle' ] }
|
||||||
|
|
||||||
|
@ -884,9 +884,13 @@ class base_classes_crans(crans_ldap):
|
||||||
valeur_initiale = 'N/A'
|
valeur_initiale = 'N/A'
|
||||||
else:
|
else:
|
||||||
valeur_initiale = self._init_data[champ][0]
|
valeur_initiale = self._init_data[champ][0]
|
||||||
|
if not self._data.get(champ,[]):
|
||||||
|
valeur_finale = 'N/A'
|
||||||
|
else:
|
||||||
|
valeur_finale = self._data[champ][0]
|
||||||
modif[modif.index(champ)] = '%s (%s -> %s)' % (champ,
|
modif[modif.index(champ)] = '%s (%s -> %s)' % (champ,
|
||||||
valeur_initiale,
|
valeur_initiale,
|
||||||
self._data[champ][0])
|
valeur_finale)
|
||||||
|
|
||||||
# Formate les entrées de l'historique de la forme champ+diff-diff
|
# Formate les entrées de l'historique de la forme champ+diff-diff
|
||||||
for champ in ['droits', 'controle', 'paiement', 'carteEtudiant', 'mailAlias', 'hostAlias', 'exempt']:
|
for champ in ['droits', 'controle', 'paiement', 'carteEtudiant', 'mailAlias', 'hostAlias', 'exempt']:
|
||||||
|
@ -1203,20 +1207,35 @@ class base_proprietaire(base_classes_crans):
|
||||||
|
|
||||||
def contourneGreylist(self,contourneGreylist=None):
|
def contourneGreylist(self,contourneGreylist=None):
|
||||||
""" Retourne ou change la greylist pour le compte
|
""" Retourne ou change la greylist pour le compte
|
||||||
OK : contourne la greyliste
|
True : contourne le GreyListing
|
||||||
NOK : ne contourne pas la greyliste """
|
False :ne contourne pas le greylisting """
|
||||||
|
|
||||||
|
# Pour postfix il faut retourner :
|
||||||
|
# OK : contourne la greyliste
|
||||||
|
# cf. man 5 access
|
||||||
|
|
||||||
|
# si l'adhérent n'a pas de compte, on lève une exeption
|
||||||
if not self.compte():
|
if not self.compte():
|
||||||
raise NotImplementedError, u"L'adhérent na pas de compte"
|
raise NotImplementedError, u"L'adhérent na pas de compte"
|
||||||
|
|
||||||
elif contourneGreylist==None:
|
# tente de modifier la valeur
|
||||||
return self._data.get('contourneGreylist',['NOK'])[0]
|
if contourneGreylist==None:
|
||||||
|
pass
|
||||||
|
|
||||||
elif contourneGreylist not in ['OK','NOK']:
|
elif contourneGreylist == True:
|
||||||
raise ValueError, u"contourneGreylist : il faut fournir OK/NOK comme argument"
|
self._set('contourneGreylist',['OK'])
|
||||||
|
|
||||||
|
elif contourneGreylist == False:
|
||||||
|
self._set('contourneGreylist',[])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self._set('contourneGreylist',[contourneGreylist])
|
raise ValueError, u"contourneGreylist prend un booléen comme argument"
|
||||||
return contourneGreylist
|
|
||||||
|
# renvoie la valeur trouvée dans la base
|
||||||
|
if self._data.get('contourneGreylist',[]) == []:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
""" Retourne le home de l'adhérent """
|
""" Retourne le home de l'adhérent """
|
||||||
|
|
|
@ -289,16 +289,21 @@ def adher_details(adher) :
|
||||||
f += coul(u'Nom : ','gras') + "%s\n" % adher.Nom()
|
f += coul(u'Nom : ','gras') + "%s\n" % adher.Nom()
|
||||||
|
|
||||||
# Mail
|
# Mail
|
||||||
|
GL = u''
|
||||||
if adher.mail().find('@')!=-1 :
|
if adher.mail().find('@')!=-1 :
|
||||||
f += coul(u'Adresse mail : ','gras') + "%s" % adher.mail()
|
f += coul(u'Adresse mail : ','gras') + "%s" % adher.mail()
|
||||||
else :
|
else :
|
||||||
f += coul(u'Login : ','gras') + "%s\t" % adher.mail()
|
f += coul(u'Login : ','gras') + "%s\t" % adher.mail()
|
||||||
|
# controurneGreylisting
|
||||||
|
if not adher.contourneGreylist():
|
||||||
|
GL = u' (%s)'%coul(u'GreyList','gris')
|
||||||
alias = ', '.join([adher.cannonical_alias()] + adher.alias())
|
alias = ', '.join([adher.cannonical_alias()] + adher.alias())
|
||||||
if alias :
|
if alias :
|
||||||
if alias[0]==',' :
|
if alias[0]==',' :
|
||||||
# Cannonical étéait vide
|
# Cannonical étéait vide
|
||||||
alias = alias[2:]
|
alias = alias[2:]
|
||||||
f += coul(u'Alias : ','gras') + alias
|
f += coul(u'Alias : ','gras') + alias
|
||||||
|
f+= GL
|
||||||
f+= u'\n'
|
f+= u'\n'
|
||||||
|
|
||||||
# Etat administratif
|
# Etat administratif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue