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

adding not admin search

This commit is contained in:
kakwa 2015-05-31 19:46:50 +02:00
parent 53660ee1d2
commit fb0bfb48cc
2 changed files with 51 additions and 9 deletions

View File

@ -421,7 +421,9 @@ class LdapCherry(object):
def searchuser(self, searchstring): def searchuser(self, searchstring):
""" search user page """ """ search user page """
self._check_auth(must_admin=False) self._check_auth(must_admin=False)
pass res = self._search(searchstring)
attrs_list = self.attributes.get_search_attributes()
return self.temp_searchuser.render(searchresult = res, attrs_list = attrs_list)
@cherrypy.expose @cherrypy.expose
def searchadmin(self, searchstring=None): def searchadmin(self, searchstring=None):

View File

@ -1,15 +1,55 @@
<%inherit file="navbar.tmpl"/> <%inherit file="navbar.tmpl"/>
<%block name="core"> <%block name="core">
<div class="row clearfix" style="margin-top:30px"> <div class="row clearfix">
<div class="col-md-4 column"></div> <div class="col-md-12 column">
<div class="col-md-4 column well"> <form method='get' action='/searchuser' role="form" class="form-inline">
<form method='POST' action='/searchadmin' class="navbar-form navbar-right" role="search">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" name="searchstring" placeholder="Search User"> <label for="searchstring">Search user</label>
</div> <input type="text" class="form-control" name="searchstring" placeholder="Search User">
<button type="submit" class="btn btn-default">Submit</button> </div>
<div class="form-group">
<label for="submit">Submit</label>
<button type="submit" class="form-control btn btn-default green">
<span class="glyphicon glyphicon-search"></span> Search</button>
</div>
</form> </form>
</div> </div>
<div class="col-md-4 column"></div> </div>
<div class="row clearfix top-buffer bottom-buffer">
<div class="col-md-12 column">
<div class="well well-sm">
<table id="RecordTable" class="table table-hover table-condensed tablesorter">
<thead>
<tr>
%for attr in attrs_list:
<th>
${attrs_list[attr]}
</th>
% endfor
</tr>
</thead>
<tbody>
%for user in searchresult:
<tr>
%for attr in attrs_list:
<td>
% if attr in searchresult[user]:
${searchresult[user][attr]}
% endif
</td>
% endfor
</tr>
% endfor
</tbody>
<tr>
%for attr in attrs_list:
<th>
${attrs_list[attr]}
</th>
% endfor
</tr>
</table>
</div>
</div>
</div> </div>
</%block> </%block>