diff --git a/index.py b/index.py index 9aee3ce..fbe0e05 100755 --- a/index.py +++ b/index.py @@ -91,7 +91,7 @@ def create(): user_dn = app.config.get('USER_DN').format(**d) attrs = {} for k,v in app.config.get('USER_ATTRS').iteritems(): - if type(v) == str: + if isinstance(v, str): attrs[k] = v.format(**d) elif isinstance(v, list): attrs[k] = [] @@ -142,13 +142,13 @@ def edit(): @app.route('/list') -def list(): +def list_users(): if not isLoggedin(): return render_template('error.html', message="You are not logged in. Please log in first.", nav=buildNav()) 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)', ['']) + sr = l.search_s(app.config.get('LDAP_BASE'), ldap.SCOPE_SUBTREE, '(objectClass=posixAccount)', ['cn']) return render_template('list.html', users=sr, nav=buildNav()) diff --git a/templates/list.html b/templates/list.html index 52a1c49..1568386 100644 --- a/templates/list.html +++ b/templates/list.html @@ -5,11 +5,17 @@ - + + + + - {% for dn, _ in users %} - + {% for dn, attr in users %} + + + + {% endfor %}
DN
CNDN
{{ dn }}
{{ attr['cn'][0] }}{{ dn }}