[radius_auth.py] pour permettre aux nounous d'avoir d'autres vlans

darcs-hash:20090624080659-bd074-753bed11a2461321f20c817c97c8ab88cd53e2f5.gz
This commit is contained in:
Antoine Durand-Gasselin 2009-06-24 10:06:59 +02:00
parent f30fdb5a25
commit 776af42937
2 changed files with 6 additions and 4 deletions

View file

@ -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