Commit a10cec5e authored by Gabriel Detraz's avatar Gabriel Detraz

La desactivation défintive de radius se fait dans l'annuaire pg à présent

parent e594c335
......@@ -96,6 +96,13 @@ def lieux_public():
results = cur.fetchall()
return [batiment.upper()+chambre for batiment, chambre in results]
@_need_conn
def disabled_radius():
cur = conn.cursor()
cur.execute("SELECT batiment,chambre FROM prises_prise WHERE has_radius=False")
results = cur.fetchall()
return [batiment.upper()+chambre for batiment, chambre in results]
@_need_conn
def reverse(batiment, prise = None):
"""Correspondance prise -> chambre"""
......
......@@ -90,6 +90,8 @@ class Port(object):
# : Liste des vlans vus
seen_vlans = None
# Radius activé
has_radius = True
def __init__(self, num):
self.num = num
......@@ -194,7 +196,7 @@ class Port(object):
def radius_auth(self):
"""Doit-on faire de l'auth radius ?"""
return not self.uplink and not self.servers and not self.bornes
return not self.uplink and not self.servers and not self.bornes and self.has_radius
def adherents(self):
"""Adhérents sur la prise"""
......@@ -280,6 +282,8 @@ def get_port_dict(switch):
port = ports[int(prise[1:])]
# (below) beware: type(num) == str (ex: 302g)
port.chambres += [bat.upper() + num for num in chbres]
# On remplit si radius a été désactivé
port.has_radius = not any(x in annuaire.disabled_radius() for x in port.chambres)
# Remplit les uplinks
for num_prise, label in annuaire.uplink_prises[bat].iteritems():
......@@ -287,6 +291,7 @@ def get_port_dict(switch):
continue
port = ports[num_prise % 100]
port.uplink = label
return ports
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment