8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +00:00

Merge branch 'hotfix_radius_option_cache' into 'dev'

hotfix : do not fail if vlan policy is not set.

See merge request federez/re2o!364
This commit is contained in:
grizzly 2018-12-12 13:01:17 +01:00
commit d7c2b2f5e8

View file

@ -385,8 +385,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name,
"Chambre inconnue",
u'Port inconnu',
RadiusOption('unknown_port_vlan').vlan_id,
RadiusOption('unknown_port')!= RadiusOption.REJECT
getattr(RadiusOption.get_cached_value('unknown_port_vlan'), 'vlan_id', None),
RadiusOption.get_cached_value('unknown_port')!= RadiusOption.REJECT
)
# On récupère le profil du port
@ -438,8 +438,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name,
"Inconnue",
u'Chambre inconnue',
RadiusOption('unknown_room_vlan').vlan_id,
RadiusOption('unknown_room')!= RadiusOption.REJECT
getattr(RadiusOption.get_cached_value('unknown_room_vlan'), 'vlan_id', None),
RadiusOption.get_cached_value('unknown_room')!= RadiusOption.REJECT
)
room_user = User.objects.filter(
@ -467,8 +467,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name,
room,
u'Utilisateur non cotisant',
RadiusOption('non_member_vlan').vlan_id,
RadiusOption('non_member')!= RadiusOption.REJECT
getattr(RadiusOption.get_cached_value('non_member_vlan'), 'vlan_id', None),
RadiusOption.get_cached_value('non_member')!= RadiusOption.REJECT
)
# else: user OK, on passe à la verif MAC
@ -500,8 +500,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name,
"",
u'Machine inconnue',
RadiusOption('unknown_machine_vlan').vlan_id,
RadiusOption('unknown_machine')!= RadiusOption.REJECT
getattr(RadiusOption.get_cached_value('unknown_machine_vlan'), 'vlan_id', None),
RadiusOption.get_cached_value('unknown_machine')!= RadiusOption.REJECT
)
# L'interface a été trouvée, on vérifie qu'elle est active,
@ -515,16 +515,16 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name,
room,
u'Adherent banni',
RadiusOption('banned_vlan').vlan_id,
RadiusOption('banned')!= RadiusOption.REJECT
getattr(RadiusOption.get_cached_value('banned_vlan'), 'vlan_id', None),
RadiusOption.get_cached_value('banned')!= RadiusOption.REJECT
)
if not interface.is_active:
return (
sw_name,
room,
u'Machine non active / adherent non cotisant',
RadiusOption('non_member_vlan').vlan_id,
RadiusOption('non_member')!= RadiusOption.REJECT
getattr(RadiusOption.get_cached_value('non_member_vlan'), 'vlan_id', None),
RadiusOption.get_cached_value('non_member')!= RadiusOption.REJECT
)
# Si on choisi de placer les machines sur le vlan
# correspondant à leur type :