mirror of
https://github.com/moepman/bk-dss
synced 2024-12-22 12:44:27 +01:00
fix account listing for python3
This commit is contained in:
parent
c1cd8bded1
commit
f88da30fe6
4
dss.py
4
dss.py
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import uuid
|
||||
|
||||
@ -168,7 +169,8 @@ def list_users():
|
||||
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'))
|
||||
sr = l.search_s(app.config.get('LDAP_BASE'), ldap.SCOPE_SUBTREE, '(objectClass=posixAccount)', ['cn'])
|
||||
return render_template('list.html', users=sr, nav=build_nav())
|
||||
accounts = [(attr['cn'][0].decode(errors='ignore'), dn) for dn, attr in sr]
|
||||
return render_template('list.html', accounts=accounts, nav=build_nav())
|
||||
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
|
@ -1,19 +1,19 @@
|
||||
{% extends "_base.html" %}
|
||||
{% block content %}
|
||||
<div class="page-header">
|
||||
<h1>List users</h1>
|
||||
<h1>List Accounts</h1>
|
||||
</div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>CN</td>
|
||||
<td>DN</td>
|
||||
<td>common name</td>
|
||||
<td>distinguished name</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for dn, attr in users %}
|
||||
{% for cn, dn in accounts %}
|
||||
<tr>
|
||||
<td>{{ attr['cn'][0] }}</td>
|
||||
<td>{{ cn }}</td>
|
||||
<td>{{ dn }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user