[base, komaz, utils, zamok] Factorisation de code via l'ajout de la methode blacklisted_ips

De plus, on rend le code plus jolie en prenant en compte l'ajout récent de méthodes dans
lc_ldap.
This commit is contained in:
Valentin Samir 2014-02-19 19:35:57 +01:00
parent 63895c98d4
commit cd8ce5c729
4 changed files with 37 additions and 39 deletions

View file

@ -102,8 +102,8 @@ class firewall(base.firewall):
self.add(table, chain, '-d 127.0.0.1/8 -j RETURN')
for net in base.config.NETs['all']:
self.add(table, chain, '-d %s -j RETURN' % net)
for adh in self.blacklisted_adherents(['paiement']):
if 'uidNumber' in adh.attrs.keys():
for adh in self.blacklisted_adherents():
if 'uidNumber' in adh:
self.add(table, chain, '-m owner --uid-owner %s -j REJECT' % adh['uidNumber'][0])
print OK