mango r216 - in branches/django: . mango



Author: ovitters
Date: Sat Jun 21 23:45:57 2008
New Revision: 216
URL: http://svn.gnome.org/viewvc/mango?rev=216&view=rev

Log:
	* mango/views.py (edit_user): Make use of Users ldap helper class.
	Further, add group information to XML.


Modified:
   branches/django/   (props changed)
   branches/django/ChangeLog
   branches/django/mango/views.py

Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py	(original)
+++ branches/django/mango/views.py	Sat Jun 21 23:45:57 2008
@@ -77,26 +77,26 @@
         return HttpResponseServerError('Cannot connect to LDAP?')
 
     filter = ldap.filter.filter_format('(&(objectClass=posixAccount)(uid=%s))', (user,))
-    users = l.search_s(settings.MANGO_CFG['ldap_users_basedn'],
-                       ldap.SCOPE_SUBTREE, filter, None)
+    users = models.Users.search(filter)
 
     if len(users) != 1:
         raise Http404()
 
-    user = users[0][1]
+    user = users[0]
 
     for item in ('uid', 'cn', 'mail', 'description'):
         node = ET.SubElement(el, item)
-        node.text = user[item][0]
+        node.text = user.__dict__[item]
 
-    for key in user.get('authorizedKey', [''])[0].splitlines():
-        if key != "":
+    for key in user.__dict__.get('authorizedKey', []):
+        # TODO:
+        #  - add fingerprint of above keys
+        if key:
             node = ET.SubElement(el, 'authorizedKey')
             node.text = key
 
-    # TODO:
-    #  - add fingerprint of above keys
-    #  - add groups
+    for group in user.groups:
+        node = ET.SubElement(el, 'group', {'cn': group.cn})
 
     return get_xmlresponse(doc, "../../../www/update_user.xsl")
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]