[Freeipa-devel] [PATCH] a bunch of small tweeks

Kevin McCarthy kmccarth at redhat.com
Tue Sep 25 18:30:06 UTC 2007


This is a set of small tweeks suggested in my meeting with Bob and Pete
yesterday.

The most controversial is adding a search timeout for find users and
groups.  I've put this at 2 seconds for now.  The problem with this
approach is that it makes the number of results that come back random -
depending on the server.

So, consider it a test.  Please send your feedback if you have opinions
(it's pushed to demo).

Thanks,

-Kevin

-------------- next part --------------
# HG changeset patch
# User Kevin McCarthy <kmccarth at redhat.com>
# Date 1190744748 25200
# Node ID 5d98050287aaaf9a6e9918f285c35615c6a8da2f
# Parent  352318dff857cf339f5385e4ab6062ca4ed85fb2
Misc small fixes:
- Members of groups are clickable
- Combine name and uid into a single column in find users
- Remove license plate from searching
- Mailto links on user emails
- Add timelimit to finds.  This is experimental...
- Fix usersearch to only search on objectClass=Person
- Change search to use get parameter

diff -r 352318dff857 -r 5d98050287aa ipa-server/ipa-gui/ipagui/templates/grouplist.kid
--- a/ipa-server/ipa-gui/ipagui/templates/grouplist.kid	Tue Sep 25 09:13:14 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/grouplist.kid	Tue Sep 25 11:25:48 2007 -0700
@@ -7,7 +7,7 @@
 </head>
 <body>
     <div id="search">
-        <form action="${tg.url('/grouplist')}" method="post">
+        <form action="${tg.url('/grouplist')}" method="get">
             <input id="criteria" type="text" name="criteria" value="${criteria}" />
             <input type="submit" value="Find Groups"/>
         </form>
diff -r 352318dff857 -r 5d98050287aa ipa-server/ipa-gui/ipagui/templates/groupshow.kid
--- a/ipa-server/ipa-gui/ipagui/templates/groupshow.kid	Tue Sep 25 09:13:14 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/groupshow.kid	Tue Sep 25 11:25:48 2007 -0700
@@ -37,8 +37,10 @@
       <?python
       member_name = "%s %s" % (member.get('givenname', ''),
                                member.get('sn', ''))
+      member_uid = member.get('uid')
       ?>
-      ${member_name} (${member.get('uid')})
+      <a href="${tg.url('usershow', uid=member_uid)}"
+        >${member_name}</a> (${member_uid})
     </div>
 
     <br/>
diff -r 352318dff857 -r 5d98050287aa ipa-server/ipa-gui/ipagui/templates/userlist.kid
--- a/ipa-server/ipa-gui/ipagui/templates/userlist.kid	Tue Sep 25 09:13:14 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/userlist.kid	Tue Sep 25 11:25:48 2007 -0700
@@ -8,7 +8,7 @@
 <body>
     <script type="text/javascript" charset="utf-8" src="${tg.url('/static/javascript/tablekit.js')}"></script>
     <div id="search">
-        <form action="${tg.url('/userlist')}" method="post">
+        <form action="${tg.url('/userlist')}" method="get">
             <input id="uid" type="text" name="uid" value="${uid}" />
             <input type="submit" value="Find People"/>
         </form>
@@ -22,10 +22,7 @@
           <thead>
             <tr>
                 <th>
-                    ${fields.uid.label}
-                </th>
-                <th>
-                    Name
+                    Person
                 </th>
                 <th>
                     Phone
@@ -36,18 +33,14 @@
                 <th>
                     Title
                 </th>
-                <th>
-                    License Plate
-                </th>
             </tr>
           </thead>
           <tbody>
             <tr py:for="user in users">
                 <td>
-                    <a href="${tg.url('/usershow',uid=user.uid)}">${user.uid}</a>
-                </td>
-                <td>
-                    ${user.givenName} ${user.sn}
+                    <a href="${tg.url('/usershow',uid=user.uid)}"
+                    >${user.givenName} ${user.sn}</a>
+                    (${user.uid})
                 </td>
                 <td>
                     ${user.telephoneNumber}
@@ -58,9 +51,6 @@
                 <td>
                     ${user.title}
                 </td>
-                <td>
-                    ${user.carLicense}
-                </td>
             </tr>
           </tbody>
         </table>
diff -r 352318dff857 -r 5d98050287aa ipa-server/ipa-gui/ipagui/templates/usershow.kid
--- a/ipa-server/ipa-gui/ipagui/templates/usershow.kid	Tue Sep 25 09:13:14 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/usershow.kid	Tue Sep 25 11:25:48 2007 -0700
@@ -70,7 +70,7 @@ else:
           <th>
             <label class="fieldlabel" py:content="fields.mail.label" />:
           </th>
-          <td>${user.get("mail")}</td>
+          <td><a href="mailto:${user.get('mail')}">${user.get("mail")}</a></td>
         </tr>
         <tr>
           <th>
diff -r 352318dff857 -r 5d98050287aa ipa-server/ipaserver/ipaldap.py
--- a/ipa-server/ipaserver/ipaldap.py	Tue Sep 25 09:13:14 2007 -0700
+++ b/ipa-server/ipaserver/ipaldap.py	Tue Sep 25 11:25:48 2007 -0700
@@ -343,7 +343,8 @@ class IPAdmin(SimpleLDAPObject):
                 for result in result_list:
                     entries.append(result)
                 type, result_list = self.result(msgid, 0)
-        except (ldap.ADMINLIMIT_EXCEEDED, ldap.SIZELIMIT_EXCEEDED), e:
+        except (ldap.ADMINLIMIT_EXCEEDED, ldap.SIZELIMIT_EXCEEDED,
+                ldap.TIMELIMIT_EXCEEDED), e:
             partial = 1
         except ldap.LDAPError, e:
             raise ipaerror.gen_exception(ipaerror.LDAP_DATABASE_ERROR, None, e)
diff -r 352318dff857 -r 5d98050287aa ipa-server/xmlrpc-server/funcs.py
--- a/ipa-server/xmlrpc-server/funcs.py	Tue Sep 25 09:13:14 2007 -0700
+++ b/ipa-server/xmlrpc-server/funcs.py	Tue Sep 25 11:25:48 2007 -0700
@@ -424,10 +424,14 @@ class IPAServer:
     def find_users (self, criteria, sattrs=None, searchlimit=0, opts=None):
         """Returns a list: counter followed by the results.
            If the results are truncated, counter will be set to -1."""
+
+        # TODO - retrieve from config
+        timelimit = 2
+
         # Assume the list of fields to search will come from a central
         # configuration repository.  A good format for that would be
         # a comma-separated list of fields
-        search_fields_conf_str = "uid,givenName,sn,telephoneNumber,ou,carLicense,title"
+        search_fields_conf_str = "uid,givenName,sn,telephoneNumber,ou,title"
         search_fields = string.split(search_fields_conf_str, ",")
 
         criteria = self.__safe_filter(criteria)
@@ -439,17 +443,27 @@ class IPAServer:
         (exact_match_filter, partial_match_filter) = self.__generate_match_filters(
                 search_fields, criteria_words)
 
+        #
+        # further constrain search to just the objectClass
+        # TODO - need to parameterize this into generate_match_filters,
+        #        and work it into the field-specification search feature
+        #
+        exact_match_filter = "(&(objectClass=person)%s)" % exact_match_filter
+        partial_match_filter = "(&(objectClass=person)%s)" % partial_match_filter
+
         conn = self.getConnection(opts)
         try:
             try:
                 exact_results = conn.getListAsync(self.basedn, self.scope,
-                        exact_match_filter, sattrs, 0, None, None, -1, searchlimit)
+                        exact_match_filter, sattrs, 0, None, None, timelimit,
+                        searchlimit)
             except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
                 exact_results = [0]
 
             try:
                 partial_results = conn.getListAsync(self.basedn, self.scope,
-                        partial_match_filter, sattrs, 0, None, None, -1, searchlimit)
+                        partial_match_filter, sattrs, 0, None, None, timelimit,
+                        searchlimit)
             except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
                 partial_results = [0]
         finally:
@@ -615,6 +629,10 @@ class IPAServer:
         """Return a list containing a User object for each
         existing group that matches the criteria.
         """
+
+        # TODO - retrieve from config
+        timelimit = 2
+
         # Assume the list of fields to search will come from a central
         # configuration repository.  A good format for that would be
         # a comma-separated list of fields
@@ -645,13 +663,15 @@ class IPAServer:
         try:
             try:
                 exact_results = conn.getListAsync(self.basedn, self.scope,
-                        exact_match_filter, sattrs, 0, None, None, -1, searchlimit)
+                        exact_match_filter, sattrs, 0, None, None, timelimit,
+                        searchlimit)
             except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
                 exact_results = [0]
 
             try:
                 partial_results = conn.getListAsync(self.basedn, self.scope,
-                        partial_match_filter, sattrs, 0, None, None, -1, searchlimit)
+                        partial_match_filter, sattrs, 0, None, None, timelimit,
+                        searchlimit)
             except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
                 partial_results = [0]
         finally:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4054 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070925/0588d92f/attachment.bin>


More information about the Freeipa-devel mailing list