mirror of
https://github.com/moepman/bk-dss
synced 2024-12-22 18:24: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
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@ -168,7 +169,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'])
|
||||||
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'])
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
{% extends "_base.html" %}
|
{% extends "_base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>List users</h1>
|
<h1>List Accounts</h1>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>CN</td>
|
<td>common name</td>
|
||||||
<td>DN</td>
|
<td>distinguished name</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for dn, attr in users %}
|
{% for cn, dn in accounts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ attr['cn'][0] }}</td>
|
<td>{{ cn }}</td>
|
||||||
<td>{{ dn }}</td>
|
<td>{{ dn }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user