From 776af42937707ae4cfd6312bb8aac830eecf3a5a Mon Sep 17 00:00:00 2001 From: Antoine Durand-Gasselin Date: Wed, 24 Jun 2009 10:06:59 +0200 Subject: [PATCH] [radius_auth.py] pour permettre aux nounous d'avoir d'autres vlans darcs-hash:20090624080659-bd074-753bed11a2461321f20c817c97c8ab88cd53e2f5.gz --- gestion/whos.py | 2 +- radius_auth.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gestion/whos.py b/gestion/whos.py index 0c34d92a..ad2223a9 100644 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -412,7 +412,7 @@ def adher_details(adher) : if ann_scol not in adher.paiement() : if not jour : f += ' et ' if isinstance(adher, Adherent) and not adher.adherentPayant(): - f += coul(u"inscription gratuite", 'bleu') + f += coul(u"inscription gratuite ", 'bleu') else: f += coul(u"cotisation %s/%d non réglée"% (ann_scol, ann_scol+1 ),'violet') jour = 0 diff --git a/radius_auth.py b/radius_auth.py index 092500e0..de2d91f8 100644 --- a/radius_auth.py +++ b/radius_auth.py @@ -7,7 +7,7 @@ from syslog import syslog, openlog sys.path.append('/usr/scripts/gestion') from ldap_crans import crans_ldap, AssociationCrans, Club from config import ann_scol, dat, vlans - +from iptools import AddrInNet def chap_ok(password, challenge, clear_pass) : """ Test l'authentification chap fournie password et chalenge doivent être données @@ -54,7 +54,8 @@ def do_auth(mac): return (-1, "Bloquage total des services pour cette machine", "") # L'adherent ne paie pas, on le met sur le vlan radin - if not isinstance(proprio, Club) and not proprio.adherentPayant(): + if ((not isinstance(proprio, Club) and not proprio.adherentPayant()) or \ + ('Nounou' in proprio.droits() and AddrInNet(m[0].ip(),'10.42.0.0/16'))): return (0, "Ne paie pas", "gratuit") # Paiment ok ? @@ -69,7 +70,8 @@ def do_auth(mac): return (0, "N'a pas payé", "accueil") # Cas des personnels logés dans les appartements de l'ENS - if proprio.etudes(0) == 'Personnel ENS': + if (proprio.etudes(0) == 'Personnel ENS' or + ('Nounou' in proprio.droits() and AddrInNet(m[0].ip(),'10.2.9.0/24'))): return (0, "Personnel ENS", "appts") # C'est bon