[CalendarServer-changes] [6077] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 13 09:55:42 PDT 2010
Revision: 6077
http://trac.macosforge.org/projects/calendarserver/changeset/6077
Author: glyph at apple.com
Date: 2010-08-13 09:55:41 -0700 (Fri, 13 Aug 2010)
Log Message:
-----------
replicate previous commit for addressbooks
Modified Paths:
--------------
CalendarServer/trunk/txcaldav/calendarstore/postgres.py
CalendarServer/trunk/txcarddav/addressbookstore/test/common.py
Modified: CalendarServer/trunk/txcaldav/calendarstore/postgres.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/postgres.py 2010-08-13 16:51:35 UTC (rev 6076)
+++ CalendarServer/trunk/txcaldav/calendarstore/postgres.py 2010-08-13 16:55:41 UTC (rev 6077)
@@ -1978,8 +1978,9 @@
"""
data = self._txn.execSQL(
"select ADDRESSBOOK_RESOURCE_ID from ADDRESSBOOK_BIND where "
- "ADDRESSBOOK_RESOURCE_NAME = %s",
- [name]
+ "ADDRESSBOOK_RESOURCE_NAME = %s and "
+ "ADDRESSBOOK_HOME_RESOURCE_ID = %s",
+ [name, self._resourceID]
)
if not data:
return None
Modified: CalendarServer/trunk/txcarddav/addressbookstore/test/common.py
===================================================================
--- CalendarServer/trunk/txcarddav/addressbookstore/test/common.py 2010-08-13 16:51:35 UTC (rev 6076)
+++ CalendarServer/trunk/txcarddav/addressbookstore/test/common.py 2010-08-13 16:55:41 UTC (rev 6077)
@@ -842,8 +842,37 @@
)
+ def test_dontLeakAddressbooks(self):
+ """
+ Addressbooks in one user's addressbook home should not show up in another
+ user's addressbook home.
+ """
+ home2 = self.transactionUnderTest().addressbookHomeWithUID(
+ "home2", create=True)
+ self.assertIdentical(home2.addressbookWithName("addressbook_1"), None)
+ def test_dontLeakObjects(self):
+ """
+ Addressbook objects in one user's addressbook should not show up in another
+ user's via uid or name queries.
+ """
+ home1 = self.homeUnderTest()
+ home2 = self.transactionUnderTest().addressbookHomeWithUID(
+ "home2", create=True)
+ addressbook1 = home1.addressbookWithName("addressbook_1")
+ addressbook2 = home2.addressbookWithName("addressbook")
+ objects = list(home2.addressbookWithName("addressbook").addressbookObjects())
+ self.assertEquals(objects, [])
+ for resourceName in self.requirements['home1']['addressbook_1'].keys():
+ obj = addressbook1.addressbookObjectWithName(resourceName)
+ self.assertIdentical(
+ addressbook2.addressbookObjectWithName(resourceName), None)
+ self.assertIdentical(
+ addressbook2.addressbookObjectWithUID(obj.uid()), None)
+
+
+
class StubNotifierFactory(object):
""" For testing push notifications without an XMPP server """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100813/30ea4405/attachment.html>
More information about the calendarserver-changes
mailing list