diff --git a/gestion/tools/whokfet.py b/gestion/tools/whokfet.py index 903487bc..1d88d7de 100755 --- a/gestion/tools/whokfet.py +++ b/gestion/tools/whokfet.py @@ -70,7 +70,7 @@ def get_state(): res['unknown_macs'].append(mac) return res -def summary(current): +def summary(current, show_all=False): u"""Réalise un joli aperçu de l'état donné en paramètre.""" if current['ma']: cprint('---=== Machines des membres actifs ===---', 'bleu') @@ -80,6 +80,16 @@ def summary(current): cprint("---=== Il semble n'y avoir personne à la Kfet ... ===---", 'rouge') for mac in current['unknown_macs']: cprint("Machine inconnue: %s" % mac, 'rouge') + if show_all: + if current['crans']: + cprint("---=== Machines Cr@ns ===---", 'bleu') + aff(current['crans']) + if current['bde']: + cprint("---=== Machines du BDE ===---", 'bleu') + aff(current['bde']) + if current['adh']: + cprint("---=== Machines d'adhérents ===---", 'bleu') + aff(current['adh']) def munin_config(): """Donne la configuration du graphe munin""" @@ -100,5 +110,13 @@ def munin(current): print """%(name)s.value %(value)s""" % {'name': name, 'value': len(current[name])} if __name__ == '__main__': + # Si on veut afficher aussi les machines qui sont normalement masquées + really = "--really" in sys.argv or "--all" in sys.argv + if really: + # Par contre, ça n'est accessible qu'aux nounous + db = crans_ldap() + really = u'Nounou' in db.getProprio(db.cur_user).droits() + if not really: + cprint("Vous n'avez pas les droits requis, --really ignoré.", 'jaune') state = get_state() - summary(state) + summary(state, show_all=really)