scripts/gestion/tools/list_droits.py
2013-05-05 01:10:09 +02:00

25 lines
615 B
Python
Executable file

#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append('/usr/scripts/gestion')
from ldap_crans import crans_ldap, decode
db = crans_ldap()
txts = []
for droit in [ u'Nounou', u'Apprenti', u'Moderateur', u'Cableur', u'Webradio' , u'Imprimeur', u'Bureau', u'Tresorier'] :
adhs = db.search('droits=%s' % droit)['adherent']
noms = []
txt = '%s\n' % droit
for adh in adhs :
noms.append(u'%s' % adh.Nom())
txt += u' %s' % '\n '.join(noms)
txts.append(txt)
print '\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(txts)