Skip to content

Commit

Permalink
adding not admin search
Browse files Browse the repository at this point in the history
  • Loading branch information
kakwa committed May 31, 2015
1 parent 53660ee commit fb0bfb4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 9 deletions.
4 changes: 3 additions & 1 deletion ldapcherry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ def index(self):
def searchuser(self, searchstring):
""" search user page """
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
def searchadmin(self, searchstring=None):
Expand Down
56 changes: 48 additions & 8 deletions resources/templates/searchuser.tmpl
Original file line number Diff line number Diff line change
@@ -1,15 +1,55 @@
<%inherit file="navbar.tmpl"/>
<%block name="core">
<div class="row clearfix" style="margin-top:30px">
<div class="col-md-4 column"></div>
<div class="col-md-4 column well">
<form method='POST' action='/searchadmin' class="navbar-form navbar-right" role="search">
<div class="row clearfix">
<div class="col-md-12 column">
<form method='get' action='/searchuser' role="form" class="form-inline">
<div class="form-group">
<input type="text" class="form-control" name="searchstring" placeholder="Search User">
</div>
<button type="submit" class="btn btn-default">Submit</button>
<label for="searchstring">Search user</label>
<input type="text" class="form-control" name="searchstring" placeholder="Search User">
</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>
</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>
</%block>

0 comments on commit fb0bfb4

Please sign in to comment.