List_droits passe à lc_ldap
This commit is contained in:
parent
09a720b827
commit
62d9379f03
1 changed files with 9 additions and 11 deletions
|
@ -1,18 +1,17 @@
|
||||||
#! /usr/bin/env python
|
#!/bin/bash /usr/scripts/python.sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys
|
from lc_ldap import shortcuts
|
||||||
sys.path.append('/usr/scripts/gestion')
|
|
||||||
|
|
||||||
from ldap_crans import crans_ldap, decode
|
ldap = shortcuts.lc_ldap_readonly()
|
||||||
|
|
||||||
db = crans_ldap()
|
|
||||||
txts = []
|
txts = []
|
||||||
|
|
||||||
adhs=db.search('droits=*')['adherent']
|
adhs = ldap.search(u"droits=*")
|
||||||
droits={}
|
droits={}
|
||||||
for adh in adhs:
|
for adh in adhs:
|
||||||
for droit in adh.droits():
|
for droit in adh['droits']:
|
||||||
|
droit = unicode(droit)
|
||||||
droits[droit] = droits.get(droit, []) + [adh]
|
droits[droit] = droits.get(droit, []) + [adh]
|
||||||
|
|
||||||
d=droits.keys()
|
d=droits.keys()
|
||||||
|
@ -20,16 +19,15 @@ d.sort()
|
||||||
|
|
||||||
for droit in d:
|
for droit in d:
|
||||||
adhs = droits[droit]
|
adhs = droits[droit]
|
||||||
|
|
||||||
noms = []
|
noms = []
|
||||||
|
|
||||||
txt = '%s\n' % droit
|
txt = '%s\n' % droit
|
||||||
for adh in adhs :
|
for adh in adhs :
|
||||||
noms.append(u'%s (%s)' % (adh.Nom(), adh.historique()[0].split(' ', 1)[0].split('/',2)[-1]))
|
noms.append(u'%s %s (%s)' % (adh['prenom'][0],adh['nom'][0],adh['historique'][0].split()[0].split('/',2)[-1]))
|
||||||
|
|
||||||
noms.sort()
|
noms.sort()
|
||||||
txt += u' %s' % '\n '.join(noms)
|
txt += u' %s' % '\n '.join(noms)
|
||||||
|
|
||||||
txts.append(txt)
|
txts.append(txt)
|
||||||
|
|
||||||
print '\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(txts)
|
print '\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(txts)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue