1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-21 17:04:21 +01:00

implement the display of users attributes on index page

This commit is contained in:
kakwa 2016-07-07 08:01:57 +02:00
parent c64bb11504
commit ebc5b69374
3 changed files with 45 additions and 0 deletions

View File

@ -1,8 +1,13 @@
Dev
***
Version 0.3.0
*************
* [impr] add focus on first input of forms
* [impr] add 404 (default) handler and its error page
* [feat] add a -D switch to ldapcherryd which enables logging to stderr in foreground
* [feat] print user's attribute on index page
Version 0.2.5
*************

View File

@ -885,8 +885,19 @@ class LdapCherry(object):
"""
self._check_auth(must_admin=False)
is_admin = self._check_admin()
sess = cherrypy.session
user = str(sess.get(SESSION_KEY, None))
if self.auth_mode == 'none':
user_attrs = None
else:
user_attrs = self._get_user(user)
attrs_list = self.attributes.get_search_attributes()
print attrs_list
print user_attrs
return self.temp['index.tmpl'].render(
is_admin=is_admin,
attrs_list=attrs_list,
searchresult=user_attrs,
notifications=self._empty_notification(),
)

View File

@ -1,4 +1,33 @@
## -*- coding: utf-8 -*-
<%inherit file="navbar.tmpl"/>
<%block name="core">
<div class="row clearfix top-buffer bottom-buffer">
<div class="col-md-2 column">
</div>
<div class="col-md-12 column">
<div class="well well-sm">
<legend>Your attributes:</legend>
<table id="RecordTable" class="table table-hover table-condensed">
<tbody>
% if not searchresult is None:
%for attr in sorted(attrs_list.keys(), key=lambda attr: attrs_list[attr]['weight']):
<tr>
% if attr in searchresult:
<%
value = searchresult[attr]
if type(value) is list:
value = ', '.join(value)
%>
<td>${attrs_list[attr]['display_name']}:</td>
<td>${value}</td>
% endif
</tr>
% endfor
%endif
</tbody>
</div>
</div>
<div class="col-md-2 column">
</div>
</div>
</%block>