[CalendarServer-changes] [5452] CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav /directory

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 9 10:28:22 PDT 2010


Revision: 5452
          http://trac.macosforge.org/projects/calendarserver/changeset/5452
Author:   sagen at apple.com
Date:     2010-04-09 10:28:19 -0700 (Fri, 09 Apr 2010)
Log Message:
-----------
Apply "Don't query Groups record type when querying EMailAddress" (aka changeset 4765) to release branch.

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/appleopendirectory.py
    CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/test/test_opendirectory.py

Modified: CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/appleopendirectory.py	2010-04-08 23:22:56 UTC (rev 5451)
+++ CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/appleopendirectory.py	2010-04-09 17:28:19 UTC (rev 5452)
@@ -557,9 +557,10 @@
                 listRecordTypes.append(dsattributes.kDSStdRecordTypeUsers)
     
             elif recordType == DirectoryService.recordType_groups:
-                listRecordTypes.append(dsattributes.kDSStdRecordTypeGroups)
-                attrs.append(dsattributes.kDSNAttrGroupMembers)
-                attrs.append(dsattributes.kDSNAttrNestedGroups)
+                if queryattr != dsattributes.kDSNAttrEMailAddress:
+                    listRecordTypes.append(dsattributes.kDSStdRecordTypeGroups)
+                    attrs.append(dsattributes.kDSNAttrGroupMembers)
+                    attrs.append(dsattributes.kDSNAttrNestedGroups)
     
             elif recordType == DirectoryService.recordType_locations:
                 if queryattr != dsattributes.kDSNAttrEMailAddress:

Modified: CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/test/test_opendirectory.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/test/test_opendirectory.py	2010-04-08 23:22:56 UTC (rev 5451)
+++ CalendarServer/branches/release/CalendarServer-2.5-dev/twistedcaldav/directory/test/test_opendirectory.py	2010-04-09 17:28:19 UTC (rev 5452)
@@ -199,7 +199,22 @@
             self.service().queryDirectory(recordTypes, self.service().INDEX_TYPE_GUID, "1234567890", lookupMethod=lookupMethod)
             self.assertFalse(self.service().recordWithGUID("1234567890"))
 
+        def test_queryDirectoryEmailAddresses(self):
+            """ Test to ensure we only ask for users when email address is
+                part of the query """
 
+            def lookupMethod(obj, attr, value, matchType, casei, recordType, attributes, count=0):
+
+                if recordType != ['dsRecTypeStandard:Users']:
+                    raise ValueError
+
+                return []
+
+            recordTypes = [DirectoryService.recordType_users, DirectoryService.recordType_groups, DirectoryService.recordType_locations, DirectoryService.recordType_resources]
+            self.service().queryDirectory(recordTypes, self.service().INDEX_TYPE_CUA, "mailto:user1 at example.com", lookupMethod=lookupMethod)
+
+
+
         @inlineCallbacks
         def test_recordsMatchingFields(self):
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100409/051a9240/attachment.html>


More information about the calendarserver-changes mailing list