mango r215 - in branches/django: . mango
- From: ovitters svn gnome org
- To: svn-commits-list gnome org,gnome-sysadmin gnome org
- Subject: mango r215 - in branches/django: . mango
- Date: Sat, 21 Jun 2008 23:45:55 +0000 (UTC)
Author: ovitters
Date: Sat Jun 21 23:45:55 2008
New Revision: 215
URL: http://svn.gnome.org/viewvc/mango?rev=215&view=rev
Log:
* mango/models.py (UserGroups, Users, Users.__init__, Users.groups):
Add UserGroups, representing an LDAP group. Make use of this group as
a lazily initialized property within the Users group.
Modified:
branches/django/ (props changed)
branches/django/ChangeLog
branches/django/mango/models.py
Modified: branches/django/mango/models.py
==============================================================================
--- branches/django/mango/models.py (original)
+++ branches/django/mango/models.py Sat Jun 21 23:45:55 2008
@@ -129,10 +129,24 @@
return items
+class UserGroups(LdapObject):
+
+ BASEDN = settings.MANGO_CFG['ldap_groups_basedn']
+ MULTI_ATTRS = set(('memberUid', 'objectClass'))
+
class Users(LdapObject):
BASEDN = settings.MANGO_CFG['ldap_users_basedn']
MULTI_ATTRS = set(('authorizedKey','objectClass'))
+ def __init__(self, *foo):
+ self._groups = None
+ super(Users, self).__init__(*foo)
+
+ @property
+ def groups(self):
+ if self._groups is None:
+ self._groups = UserGroups.search('(memberUid=%s)' % self.__dict__['uid'])
+ return self._groups
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]