1
0
mirror of https://github.com/moepman/bk-dss synced 2024-12-22 13:54:26 +01:00

list: also display numberic uid

This commit is contained in:
Markus 2019-05-16 16:13:05 +02:00
parent b643c6ca18
commit e33150507d
2 changed files with 5 additions and 3 deletions

4
dss.py
View File

@ -168,8 +168,8 @@ def list_users():
l = ldap.initialize(app.config.get('LDAP_URI', 'ldaps://127.0.0.1')) l = ldap.initialize(app.config.get('LDAP_URI', 'ldaps://127.0.0.1'))
l.simple_bind_s(rdb.hget(session['uuid'], 'user'), rdb.hget(session['uuid'], 'pswd')) l.simple_bind_s(rdb.hget(session['uuid'], 'user'), rdb.hget(session['uuid'], 'pswd'))
sr = l.search_s(app.config.get('LDAP_BASE'), ldap.SCOPE_SUBTREE, '(objectClass=posixAccount)', ['cn']) sr = l.search_s(app.config.get('LDAP_BASE'), ldap.SCOPE_SUBTREE, '(objectClass=posixAccount)', ['cn', 'uidNumber'])
accounts = [(attr['cn'][0].decode(errors='ignore'), dn) for dn, attr in sr] accounts = [(attr['cn'][0].decode(errors='ignore'), attr['uidNumber'][0].decode(errors='ignore'), dn) for dn, attr in sr]
return render_template('list.html', accounts=accounts, nav=build_nav()) return render_template('list.html', accounts=accounts, nav=build_nav())

View File

@ -7,13 +7,15 @@
<thead> <thead>
<tr> <tr>
<td>common name</td> <td>common name</td>
<td>UID number</td>
<td>distinguished name</td> <td>distinguished name</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for cn, dn in accounts %} {% for cn, uin, dn in accounts %}
<tr> <tr>
<td>{{ cn }}</td> <td>{{ cn }}</td>
<td>{{ uin }}</td>
<td>{{ dn }}</td> <td>{{ dn }}</td>
</tr> </tr>
{% endfor %} {% endfor %}