[CalendarServer-changes] [7708] CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 5 10:11:07 PDT 2011
Revision: 7708
http://trac.macosforge.org/projects/calendarserver/changeset/7708
Author: sagen at apple.com
Date: 2011-07-05 10:11:06 -0700 (Tue, 05 Jul 2011)
Log Message:
-----------
Honor augmentService if enabled
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
Modified: CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py 2011-07-05 16:54:26 UTC (rev 7707)
+++ CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py 2011-07-05 17:11:06 UTC (rev 7708)
@@ -75,7 +75,7 @@
defaults = {
"augmentService" : None,
- "cacheTimeout": 1,
+ "cacheTimeout": 1, # Minutes
"negativeCaching": False,
"restrictEnabledRecords": False,
"restrictToGroup": "",
@@ -99,7 +99,7 @@
"emailSuffix": None, # used only to synthesize email address
"filter": None, # additional filter for this type
"recordName": "uid", # uniquely identifies user records
- "loginEnabledAttr" : "loginEnabled", # attribute controlling login
+ "loginEnabledAttr" : "", # attribute controlling login
"loginEnabledValue" : "yes", # value of above attribute
},
"groups": {
@@ -425,13 +425,6 @@
enabledForCalendaring = True
enabledForAddressBooks = True
- # Check login control attribute
- loginEnabledAttr = self.rdnSchema[recordType]["loginEnabledAttr"]
- if loginEnabledAttr:
- loginEnabledValue = self.rdnSchema[recordType]["loginEnabledValue"]
- enabledForLogin = self._getUniqueLdapAttribute(attrs,
- loginEnabledAttr) == loginEnabledValue
-
elif recordType == self.recordType_groups:
fullName = self._getUniqueLdapAttribute(attrs, "cn")
enabledForCalendaring = False
@@ -460,19 +453,37 @@
attrs = attrs,
)
- # Generate an augment record based on information retrieved from LDAP
- augmentRecord = AugmentRecord(
- guid,
- enabled=True,
- serverID="", # TODO: add to LDAP?
- partitionID="", # TODO: add to LDAP?
- enabledForCalendaring=enabledForCalendaring,
- autoSchedule=False, # TODO: add to LDAP?
- enabledForAddressBooks=enabledForAddressBooks, # TODO: add to LDAP?
- enabledForLogin=enabledForLogin,
- )
- record.addAugmentInformation(augmentRecord)
+ if self.augmentService is not None:
+ # Look up augment information
+ # TODO: this needs to be deferred but for now we hard code
+ # the deferred result because we know it is completing
+ # immediately.
+ d = self.augmentService.getAugmentRecord(record.guid,
+ recordType)
+ d.addCallback(lambda x:record.addAugmentInformation(x))
+ else:
+ # Generate augment record based on information retrieved from LDAP
+ augmentRecord = AugmentRecord(
+ guid,
+ enabled=True,
+ serverID="", # TODO: add to LDAP?
+ partitionID="", # TODO: add to LDAP?
+ enabledForCalendaring=enabledForCalendaring,
+ autoSchedule=False, # TODO: add to LDAP?
+ enabledForAddressBooks=enabledForAddressBooks, # TODO: add to LDAP?
+ enabledForLogin=enabledForLogin,
+ )
+ record.addAugmentInformation(augmentRecord)
+
+ # Override with LDAP login control if attribute specified
+ if recordType == self.recordType_users:
+ loginEnabledAttr = self.rdnSchema[recordType]["loginEnabledAttr"]
+ if loginEnabledAttr:
+ loginEnabledValue = self.rdnSchema[recordType]["loginEnabledValue"]
+ record.enabledForLogin = self._getUniqueLdapAttribute(attrs,
+ loginEnabledAttr) == loginEnabledValue
+
return record
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110705/e5ed6805/attachment.html>
More information about the calendarserver-changes
mailing list