Commit 18b63786 authored by Hamza Dely's avatar Hamza Dely

On récupère le nom du bâtiment et le numéro de switch séparemment

parent 80fe6ce9
......@@ -927,17 +927,16 @@ class RadiusEventHandler(object):
def _plug_info(self, nas_id, port):
"""Renvoie la chambre associé à un NAS et une prise donnée d'une part
et l'ensemble des adhérents y résidant d'autre part"""
nas_id = nas_id.replace('-', '')
plug = "%d%02d" % (int(nas_id[3:]), int(port))
building = nas_id[3]
plug = "%d%02d" % (int(nas_id[5:]), int(port))
logger.debug('Trying to find a match by room (plug %s)', plug)
building, plug_nb = plug[0], plug[1:]
room = reverse(building, plug_nb)
room = reverse(building, plug)
if room:
room = room[0]
logger.debug('Found room %s%s', building.upper(), crans_utils.escape(room))
return self.ldap.search('(&(chbre=%s%s)(!(chbre=EXT)))' % (building, room))
else:
logger.debug('No room for plug %s', plug)
logger.debug('No room for plug %s%s', building, plug)
return []
def __find_match(self, request, m_type):
......
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