From fb0bfb48cccd2ca70c5534f6c6db28ce803b24c8 Mon Sep 17 00:00:00 2001 From: kakwa Date: Sun, 31 May 2015 19:46:50 +0200 Subject: [PATCH] adding not admin search --- ldapcherry/__init__.py | 4 ++- resources/templates/searchuser.tmpl | 56 ++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 53ce65c..9962816 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -421,7 +421,9 @@ class LdapCherry(object): 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): diff --git a/resources/templates/searchuser.tmpl b/resources/templates/searchuser.tmpl index 6bc875c..f9f7129 100644 --- a/resources/templates/searchuser.tmpl +++ b/resources/templates/searchuser.tmpl @@ -1,15 +1,55 @@ <%inherit file="navbar.tmpl"/> <%block name="core"> -
-
-
- -
+
+
+
+
+ + + + %for attr in attrs_list: + + % endfor + + + + %for user in searchresult: + + %for attr in attrs_list: + + % endfor + + % endfor + + + %for attr in attrs_list: + + % endfor + +
+ ${attrs_list[attr]} +
+ % if attr in searchresult[user]: + ${searchresult[user][attr]} + % endif +
+ ${attrs_list[attr]} +
+
+