mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
implement the display of users attributes on index page
This commit is contained in:
parent
c64bb11504
commit
ebc5b69374
@ -1,8 +1,13 @@
|
|||||||
Dev
|
Dev
|
||||||
***
|
***
|
||||||
|
|
||||||
|
Version 0.3.0
|
||||||
|
*************
|
||||||
|
|
||||||
* [impr] add focus on first input of forms
|
* [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] 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
|
Version 0.2.5
|
||||||
*************
|
*************
|
||||||
|
@ -885,8 +885,19 @@ class LdapCherry(object):
|
|||||||
"""
|
"""
|
||||||
self._check_auth(must_admin=False)
|
self._check_auth(must_admin=False)
|
||||||
is_admin = self._check_admin()
|
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(
|
return self.temp['index.tmpl'].render(
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
|
attrs_list=attrs_list,
|
||||||
|
searchresult=user_attrs,
|
||||||
notifications=self._empty_notification(),
|
notifications=self._empty_notification(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,4 +1,33 @@
|
|||||||
## -*- coding: utf-8 -*-
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%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>
|
</%block>
|
||||||
|
Loading…
Reference in New Issue
Block a user