[Freeipa-devel] [PATCH] enhanced user search

Kevin McCarthy kmccarth at redhat.com
Thu Aug 23 20:26:42 UTC 2007


Kevin McCarthy wrote:
> Enhanced user search:
> - "configurable" fields to search on  (this is hardcoded but can be
>   moved to the external configuration easily)
> - tokenize search words
> - prioritize exact matches over partial matches
> Other updates:
> - use finally block to return ldap connections
> - update web gui to use new get_user methods

Just after I sent, realized I had the empty search check in the wrong
place.  This patch fixes that.

-Kevin
-------------- next part --------------
# HG changeset patch
# User Kevin McCarthy <kmccarth at redhat.com>
# Date 1187900938 25200
# Node ID e4014a2564a4c18a9f35eaecae921e1e1e743c12
# Parent  4ef808c8f4f0536c1aed310cf604bb9fdd8fb662
Move empty search check to the correct place.

diff -r 4ef808c8f4f0 -r e4014a2564a4 ipa-server/xmlrpc-server/funcs.py
--- a/ipa-server/xmlrpc-server/funcs.py	Thu Aug 23 13:16:29 2007 -0700
+++ b/ipa-server/xmlrpc-server/funcs.py	Thu Aug 23 13:28:58 2007 -0700
@@ -323,8 +323,6 @@ class IPAServer:
         #       is (illegally) ')' and make sure python-ldap
         #       bombs out.
         criteria = re.sub(r'[\(\)\\\*]', ldap_search_escape, criteria)
-        if len(criteria) == 0:
-            return []
 
         # Assume the list of fields to search will come from a central
         # configuration repository.  A good format for that would be
@@ -342,6 +340,8 @@ class IPAServer:
 
         criteria_words = re.split(r'\s+', criteria)
         criteria_words = filter(lambda value:value!="", criteria_words)
+        if len(criteria_words) == 0:
+            return []
 
         # construct the giant match for all words
         exact_match_filter = "(&"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070823/ceb0d081/attachment.bin>


More information about the Freeipa-devel mailing list