<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12143] CalendarServer/trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/12143">12143</a></dd>
<dt>Author</dt> <dd>gaya@apple.com</dd>
<dt>Date</dt> <dd>2013-12-18 22:18:02 -0800 (Wed, 18 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>merge in sharedgroupfixes, sharedgroupfixestester branches</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgroupone4xml">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/4.xml</a></li>
<li><a href="#CalDAVTestertrunkscriptstestsCalDAVsharingnotificationsyncxml">CalDAVTester/trunk/scripts/tests/CalDAV/sharing-notification-sync.xml</a></li>
<li><a href="#CalDAVTestertrunkscriptstestsCalDAVsharingsyncxml">CalDAVTester/trunk/scripts/tests/CalDAV/sharing-sync.xml</a></li>
<li><a href="#CalDAVTestertrunkscriptstestsCardDAVsharingsyncxml">CalDAVTester/trunk/scripts/tests/CardDAV/sharing-sync.xml</a></li>
<li><a href="#CalendarServertrunktwistedcaldavstorebridgepy">CalendarServer/trunk/twistedcaldav/storebridge.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoretesttest_sql_sharingpy">CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py</a></li>
<li><a href="#CalendarServertrunktxdavcarddavdatastoresqlpy">CalendarServer/trunk/txdav/carddav/datastore/sql.py</a></li>
<li><a href="#CalendarServertrunktxdavcarddavdatastoretesttest_sqlpy">CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py</a></li>
<li><a href="#CalendarServertrunktxdavcarddavdatastoretesttest_sql_sharingpy">CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoresqlpy">CalendarServer/trunk/txdav/common/datastore/sql.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoresql_schemacurrentoracledialectsql">CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoresql_schemacurrentsql">CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgroupone5xml">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/5.xml</a></li>
<li>CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/</li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo1vcf">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/1.vcf</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo11xml">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/11.xml</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo12xml">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/12.xml</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo14xml">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/14.xml</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo15xml">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/15.xml</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo2vcf">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/2.vcf</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo3vcf">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/3.vcf</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo4vcf">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/4.vcf</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo5vcf">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/5.vcf</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo6vcf">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/6.vcf</a></li>
<li><a href="#CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo7vcf">CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/7.vcf</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoresql_schemaoldoracledialectv29sql">CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoresql_schemaoldpostgresdialectv29sql">CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoresql_schemaupgradesoracledialectupgrade_from_29_to_30sql">CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoresql_schemaupgradespostgresdialectupgrade_from_29_to_30sql">CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li>CalendarServer/trunk/txdav/carddav/datastore/test/addressbook_store/ho/me/home_empty/</li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#CalendarServertrunk">CalendarServer/trunk/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgroupone4xml"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/4.xml (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/4.xml        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/4.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -1,20 +1,8 @@
</span><del>-<?xml version='1.0' encoding='UTF-8'?>
-<notification xmlns='http://calendarserver.org/ns/'>
- <dtstamp></dtstamp>
- <invite-notification shared-type='group'>
- <uid></uid>
- <href xmlns='DAV:'>$cuaddrurn2:</href>
- <invite-noresponse/>
- <access>
- <read-write/>
- </access>
- <hosturl>
- <href xmlns='DAV:'>$addressbookpath1:/3.vcf</href>
- </hosturl>
- <organizer>
- <href xmlns='DAV:'>$cuaddrurn1:</href>
- <common-name>User 01</common-name>
- </organizer>
- <summary>My Shared Calendar</summary>
- </invite-notification>
-</notification>
</del><ins>+<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:set>
+ <D:href>$cuaddrurn2:</D:href>
+ <CS:summary>Shared Group</CS:summary>
+ <CS:read-write/>
+ </CS:set>
+</CS:share>
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgroupone5xml"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/5.xml (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/5.xml         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-one/5.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?xml version='1.0' encoding='UTF-8'?>
+<invite-reply xmlns='http://calendarserver.org/ns/'>
+ <href xmlns='DAV:'>$cuaddrurn2:</href>
+ <invite-accepted/>
+ <hosturl>
+ <href xmlns='DAV:'>$addressbookpath1:/3.vcf</href>
+ </hosturl>
+ <in-reply-to>$inviteuid:</in-reply-to>
+ <summary>Shared Group</summary>
+ <common-name>$username2:</common-name>
+ <first-name>$firstname2:</first-name>
+ <last-name>$lastname2:</last-name>
+</invite-reply>
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo1vcf"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/1.vcf (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/1.vcf         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/1.vcf        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+BEGIN:VCARD
+VERSION:3.0
+N:Thompson;Default;;;
+FN:Default Thompson
+EMAIL;type=INTERNET;type=WORK;type=pref:lthompson@example.com
+TEL;type=WORK;type=pref:1-555-555-5555
+TEL;type=CELL:1-444-444-4444
+item1.ADR;type=WORK;type=pref:;;1245 Test;Sesame Street;California;11111;USA
+item1.X-ABADR:us
+UID:ED7A5AEC-AB19-4CE0-AD6A-2923A3E5C4E1
+END:VCARD
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo11xml"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/11.xml (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/11.xml         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/11.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:set>
+ <D:href>$cuaddrurn2:</D:href>
+ <CS:summary>Shared Group12</CS:summary>
+ <CS:read-write/>
+ </CS:set>
+</CS:share>
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo12xml"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/12.xml (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/12.xml         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/12.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?xml version='1.0' encoding='UTF-8'?>
+<invite-reply xmlns='http://calendarserver.org/ns/'>
+ <href xmlns='DAV:'>$cuaddrurn1:</href>
+ <invite-accepted/>
+ <hosturl>
+ <href xmlns='DAV:'>$addressbookpath1:/6.vcf</href>
+ </hosturl>
+ <in-reply-to>$inviteuid:</in-reply-to>
+ <summary>Shared Group12</summary>
+ <common-name>$username2:</common-name>
+ <first-name>$firstname2:</first-name>
+ <last-name>$lastname2:</last-name>
+</invite-reply>
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo14xml"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/14.xml (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/14.xml         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/14.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:set>
+ <D:href>$cuaddrurn2:</D:href>
+ <CS:summary>Shared Group45</CS:summary>
+ <CS:read-write/>
+ </CS:set>
+</CS:share>
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo15xml"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/15.xml (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/15.xml         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/15.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<?xml version='1.0' encoding='UTF-8'?>
+<invite-reply xmlns='http://calendarserver.org/ns/'>
+ <href xmlns='DAV:'>$cuaddrurn1:</href>
+ <invite-accepted/>
+ <hosturl>
+ <href xmlns='DAV:'>$addressbookpath1:/7.vcf</href>
+ </hosturl>
+ <in-reply-to>$inviteuid:</in-reply-to>
+ <summary>Shared Group45</summary>
+ <common-name>$username2:</common-name>
+ <first-name>$firstname2:</first-name>
+ <last-name>$lastname2:</last-name>
+</invite-reply>
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo2vcf"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/2.vcf (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/2.vcf         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/2.vcf        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+BEGIN:VCARD
+VERSION:3.0
+N:Contact;Mulberry;;;
+FN:Mulberry Contact
+NICKNAME:mulberry
+ORG:Apple Inc.;
+EMAIL;type=INTERNET;type=WORK;type=pref:mulberry@example.com
+TEL;type=HOME;type=pref:777-777-7777
+TEL;type=WORK:8888888888
+TEL;type=WORK;type=FAX:5555555555
+item1.ADR;type=WORK;type=pref:;;1234 Infinite Circle;Exampletino\, CA 99999;USA;;
+item1.X-ABADR:us
+NOTE:This is a contact created in Mulberry.
+item2.URL;type=pref:http://www.example.com/~magic
+item2.X-ABLabel:_$!<HomePage>!$_
+UID:ED7A5AEC-AB19-4CE0-AD6A-2923A3E5C4E2
+END:VCARD
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo3vcf"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/3.vcf (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/3.vcf         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/3.vcf        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+BEGIN:VCARD
+VERSION:3.0
+N:Kawado;Saeko;;;
+FN:Snow Leopard
+ORG:Snow Leopard;
+EMAIL;type=INTERNET;type=WORK;type=pref:snowleopard@example.com
+TEL;type=WORK;type=pref:777-777-7777
+item1.ADR;type=WORK;type=pref:;;1 Fidel Ave. Suite 100;Mountain Top;CA;99999;USA
+item1.X-ABADR:us
+X-ABShowAs:COMPANY
+UID:FCBA0FA3-00B2-4C95-B4EC-4CCC4843F8B1
+END:VCARD
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo4vcf"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/4.vcf (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/4.vcf         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/4.vcf        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+BEGIN:VCARD
+VERSION:3.0
+N:Mariotte;WithNote;;;
+FN:WithNote Mariotte
+EMAIL;type=INTERNET;type=WORK;type=pref:withnmariotte@example.com
+TEL;type=WORK;type=pref:1-777-777-7777
+TEL;type=CELL:1-8888888888
+item1.ADR;type=WORK;type=pref:;;1 North Blvd;Cupertino;CA;99999;United States
+item1.X-ABADR:us
+NOTE: Address book server test contact that hsa note field filled in.
+UID:44745975-AE6D-4FB0-80A6-A298427E047A
+END:VCARD
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo5vcf"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/5.vcf (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/5.vcf         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/5.vcf        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+BEGIN:VCARD
+VERSION:3.0
+N:InfoIn;All;;;
+FN:All InfoIn
+ORG:allinfo Company;
+EMAIL;type=INTERNET;type=WORK;type=pref:allinfomationin@example.com
+TEL;type=WORK;type=pref:777-777-7777
+TEL;type=CELL:8888888888
+item1.ADR;type=WORK;type=pref:;;1 Gally Street Apt #2;Mountain Top;CA;99999;USA
+item1.X-ABADR:us
+X-YAHOO;type=WORK;type=pref:saeko.where@example.com
+X-YAHOO-ID;type=WORK;type=pref:saeko.where@example.com
+item2.X-ABRELATEDNAMES;type=pref:Mayumi Yan
+item2.X-ABLabel:_$!<Friend>!$_
+item3.X-ABRELATEDNAMES:Shane
+item3.X-ABLabel:_$!<Assistant>!$_
+UID:3765A955-1B96-41EA-994D-335192BEDCCD
+END:VCARD
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo6vcf"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/6.vcf (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/6.vcf         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/6.vcf        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+BEGIN:VCARD
+VERSION:3.0
+PRODID:-//Apple Inc.//AddressBook 6.1//EN
+UID:760d9b28-5a13-4880-b7eb-5769e6688fa3
+FN:Group 123
+N:Group123;;;;
+REV:20120503T194243Z
+X-ADDRESSBOOKSERVER-KIND:group
+X-ADDRESSBOOKSERVER-MEMBER:urn:uuid:ED7A5AEC-AB19-4CE0-AD6A-2923A3E5C4E1
+X-ADDRESSBOOKSERVER-MEMBER:urn:uuid:ED7A5AEC-AB19-4CE0-AD6A-2923A3E5C4E2
+END:VCARD
</ins></span></pre></div>
<a id="CalDAVTestertrunkResourceCardDAVsharingsyncgrouptwo7vcf"></a>
<div class="addfile"><h4>Added: CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/7.vcf (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/7.vcf         (rev 0)
+++ CalDAVTester/trunk/Resource/CardDAV/sharing/sync/group-two/7.vcf        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+BEGIN:VCARD
+VERSION:3.0
+PRODID:-//Apple Inc.//AddressBook 6.1//EN
+UID:760d9b28-5a13-4880-b7eb-5769e6688fa4
+FN:Group 345
+N:Group345;;;;
+REV:20120503T194243Z
+X-ADDRESSBOOKSERVER-KIND:group
+X-ADDRESSBOOKSERVER-MEMBER:urn:uuid:3765A955-1B96-41EA-994D-335192BEDCCD
+X-ADDRESSBOOKSERVER-MEMBER:urn:uuid:44745975-AE6D-4FB0-80A6-A298427E047A
+END:VCARD
</ins></span></pre></div>
<a id="CalDAVTestertrunkscriptstestsCalDAVsharingnotificationsyncxml"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/scripts/tests/CalDAV/sharing-notification-sync.xml (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/scripts/tests/CalDAV/sharing-notification-sync.xml        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/sharing-notification-sync.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -419,8 +419,34 @@
</span><span class="cx">                                         <name>{DAV:}href</name>
</span><span class="cx">                                         <variable>$sharedcalendar:</variable>
</span><span class="cx">                                 </grabelement>
</span><ins>+                                <grabelement>
+                                        <name>{DAV:}href</name>
+                                        <variable>basename($sharedcalendarbasename:)</variable>
+                                </grabelement>
</ins><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><ins>+                <test name='6-' ignore='no'>
+                        <description>bad sync token</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$calendarhome2:/</ruri>
+                                <header>
+                                        <name>Depth</name>
+                                        <value>infinity</value>
+                                </header>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CalDAV/sharing/notification-sync/4.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
</ins><span class="cx">                 <test name='6' ignore='no'>
</span><span class="cx">                         <description>new calendar</description>
</span><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="lines">@@ -432,18 +458,46 @@
</span><span class="cx">                                 </header>
</span><span class="cx">                                 <data substitutions='yes'>
</span><span class="cx">                                         <content-type>text/xml; charset=utf-8</content-type>
</span><del>-                                        <filepath>Resource/CalDAV/sharing/notification-sync/4.xml</filepath>
</del><ins>+                                        <filepath>Resource/CalDAV/sharing/notification-sync/2.xml</filepath>
</ins><span class="cx">                                 </data>
</span><span class="cx">                                 <verify>
</span><ins>+                                        <exclude-feature>
+                                                <feature>split-calendars</feature>
+                                        </exclude-feature>
</ins><span class="cx">                                         <callback>multistatusItems</callback>
</span><span class="cx">                                         <arg>
</span><del>-                                                <name>prefix</name>
-                                                <value/>
</del><ins>+                                                <name>okhrefs</name>
+                                                <value>$sharedcalendarbasename:/</value>
+                                                <value>$calendar:/</value>
+                                                <value>$inbox:/</value>
+                                                <value>$outbox:/</value>
+                                                <value>$freebusy:</value>
+                                                <value>$notification:/</value>
</ins><span class="cx">                                         </arg>
</span><span class="cx">                                         <arg>
</span><ins>+                                                <name>badhrefs</name>
+                                                <value>$dropbox:/</value>
+                                        </arg>
+                                </verify>
+                                <verify>
+                                        <require-feature>
+                                                <feature>split-calendars</feature>
+                                        </require-feature>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
</ins><span class="cx">                                                 <name>okhrefs</name>
</span><del>-                                                <value>$sharedcalendar:/</value>
</del><ins>+                                                <value>$sharedcalendarbasename:/</value>
+                                                <value>$calendar:/</value>
+                                                <value>$tasks:/</value>
+                                                <value>$inbox:/</value>
+                                                <value>$outbox:/</value>
+                                                <value>$freebusy:</value>
+                                                <value>$notification:/</value>
</ins><span class="cx">                                         </arg>
</span><ins>+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$dropbox:/</value>
+                                        </arg>
</ins><span class="cx">                                 </verify>
</span><span class="cx">                                 <grabelement>
</span><span class="cx">                                         <name>/{DAV:}multistatus/{DAV:}sync-token</name>
</span><span class="lines">@@ -615,8 +669,34 @@
</span><span class="cx">                                         <name>{DAV:}href</name>
</span><span class="cx">                                         <variable>$sharedcalendar:</variable>
</span><span class="cx">                                 </grabelement>
</span><ins>+                                <grabelement>
+                                        <name>{DAV:}href</name>
+                                        <variable>basename($sharedcalendarbasename:)</variable>
+                                </grabelement>
</ins><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><ins>+                <test name='6-' ignore='no'>
+                        <description>bad sync token</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$calendarhome2:/</ruri>
+                                <header>
+                                        <name>Depth</name>
+                                        <value>infinity</value>
+                                </header>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CalDAV/sharing/notification-sync/4.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
</ins><span class="cx">                 <test name='6' ignore='no'>
</span><span class="cx">                         <description>new calendar</description>
</span><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="lines">@@ -628,18 +708,46 @@
</span><span class="cx">                                 </header>
</span><span class="cx">                                 <data substitutions='yes'>
</span><span class="cx">                                         <content-type>text/xml; charset=utf-8</content-type>
</span><del>-                                        <filepath>Resource/CalDAV/sharing/notification-sync/4.xml</filepath>
</del><ins>+                                        <filepath>Resource/CalDAV/sharing/notification-sync/2.xml</filepath>
</ins><span class="cx">                                 </data>
</span><span class="cx">                                 <verify>
</span><ins>+                                        <exclude-feature>
+                                                <feature>split-calendars</feature>
+                                        </exclude-feature>
</ins><span class="cx">                                         <callback>multistatusItems</callback>
</span><span class="cx">                                         <arg>
</span><del>-                                                <name>prefix</name>
-                                                <value/>
</del><ins>+                                                <name>okhrefs</name>
+                                                <value>$sharedcalendarbasename:/</value>
+                                                <value>$calendar:/</value>
+                                                <value>$inbox:/</value>
+                                                <value>$outbox:/</value>
+                                                <value>$freebusy:</value>
+                                                <value>$notification:/</value>
</ins><span class="cx">                                         </arg>
</span><span class="cx">                                         <arg>
</span><ins>+                                                <name>badhrefs</name>
+                                                <value>$dropbox:/</value>
+                                        </arg>
+                                </verify>
+                                <verify>
+                                        <require-feature>
+                                                <feature>split-calendars</feature>
+                                        </require-feature>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
</ins><span class="cx">                                                 <name>okhrefs</name>
</span><del>-                                                <value>$sharedcalendar:/</value>
</del><ins>+                                                <value>$sharedcalendarbasename:/</value>
+                                                <value>$calendar:/</value>
+                                                <value>$tasks:/</value>
+                                                <value>$inbox:/</value>
+                                                <value>$outbox:/</value>
+                                                <value>$freebusy:</value>
+                                                <value>$notification:/</value>
</ins><span class="cx">                                         </arg>
</span><ins>+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$dropbox:/</value>
+                                        </arg>
</ins><span class="cx">                                 </verify>
</span><span class="cx">                                 <grabelement>
</span><span class="cx">                                         <name>/{DAV:}multistatus/{DAV:}sync-token</name>
</span><span class="lines">@@ -849,8 +957,34 @@
</span><span class="cx">                                         <name>{DAV:}href</name>
</span><span class="cx">                                         <variable>$sharedcalendar:</variable>
</span><span class="cx">                                 </grabelement>
</span><ins>+                                <grabelement>
+                                        <name>{DAV:}href</name>
+                                        <variable>basename($sharedcalendarbasename:)</variable>
+                                </grabelement>
</ins><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><ins>+                <test name='6-' ignore='no'>
+                        <description>bad sync token</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$calendarhome2:/</ruri>
+                                <header>
+                                        <name>Depth</name>
+                                        <value>infinity</value>
+                                </header>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CalDAV/sharing/notification-sync/4.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
</ins><span class="cx">                 <test name='6' ignore='no'>
</span><span class="cx">                         <description>new calendar</description>
</span><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="lines">@@ -862,19 +996,48 @@
</span><span class="cx">                                 </header>
</span><span class="cx">                                 <data substitutions='yes'>
</span><span class="cx">                                         <content-type>text/xml; charset=utf-8</content-type>
</span><del>-                                        <filepath>Resource/CalDAV/sharing/notification-sync/4.xml</filepath>
</del><ins>+                                        <filepath>Resource/CalDAV/sharing/notification-sync/2.xml</filepath>
</ins><span class="cx">                                 </data>
</span><span class="cx">                                 <verify>
</span><ins>+                                        <exclude-feature>
+                                                <feature>split-calendars</feature>
+                                        </exclude-feature>
</ins><span class="cx">                                         <callback>multistatusItems</callback>
</span><span class="cx">                                         <arg>
</span><del>-                                                <name>prefix</name>
-                                                <value/>
</del><ins>+                                                <name>okhrefs</name>
+                                                <value>$sharedcalendarbasename:/</value>
+                                                <value>$sharedcalendarbasename:/1.ics</value>
+                                                <value>$calendar:/</value>
+                                                <value>$inbox:/</value>
+                                                <value>$outbox:/</value>
+                                                <value>$freebusy:</value>
+                                                <value>$notification:/</value>
</ins><span class="cx">                                         </arg>
</span><span class="cx">                                         <arg>
</span><ins>+                                                <name>badhrefs</name>
+                                                <value>$dropbox:/</value>
+                                        </arg>
+                                </verify>
+                                <verify>
+                                        <require-feature>
+                                                <feature>split-calendars</feature>
+                                        </require-feature>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
</ins><span class="cx">                                                 <name>okhrefs</name>
</span><del>-                                                <value>$sharedcalendar:/</value>
-                                                <value>$sharedcalendar:/1.ics</value>
</del><ins>+                                                <value>$sharedcalendarbasename:/</value>
+                                                <value>$sharedcalendarbasename:/1.ics</value>
+                                                <value>$calendar:/</value>
+                                                <value>$tasks:/</value>
+                                                <value>$inbox:/</value>
+                                                <value>$outbox:/</value>
+                                                <value>$freebusy:</value>
+                                                <value>$notification:/</value>
</ins><span class="cx">                                         </arg>
</span><ins>+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$dropbox:/</value>
+                                        </arg>
</ins><span class="cx">                                 </verify>
</span><span class="cx">                                 <grabelement>
</span><span class="cx">                                         <name>/{DAV:}multistatus/{DAV:}sync-token</name>
</span></span></pre></div>
<a id="CalDAVTestertrunkscriptstestsCalDAVsharingsyncxml"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/scripts/tests/CalDAV/sharing-sync.xml (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/scripts/tests/CalDAV/sharing-sync.xml        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/sharing-sync.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -292,6 +292,21 @@
</span><span class="cx">                                         <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
</span><span class="cx">                                 </data>
</span><span class="cx">                                 <verify>
</span><ins>+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$calendarhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
</ins><span class="cx">                                         <callback>multistatusItems</callback>
</span><span class="cx">                                         <arg>
</span><span class="cx">                                                 <name>ignoremissing</name>
</span></span></pre></div>
<a id="CalDAVTestertrunkscriptstestsCardDAVsharingsyncxml"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/scripts/tests/CardDAV/sharing-sync.xml (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/scripts/tests/CardDAV/sharing-sync.xml        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalDAVTester/trunk/scripts/tests/CardDAV/sharing-sync.xml        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -37,8 +37,9 @@
</span><span class="cx">                 </request>
</span><span class="cx">         </start>
</span><span class="cx">         
</span><del>-        <test-suite name='Read-write addressbook' ignore='yes'>
-                <test name='1' ignore='no'>
</del><ins>+        <!-- test suite below is similar to test suite in ../CalDAV/sharing-sync.xml -->
+        <test-suite name='shared addressbook' ignore='no'>
+                <test name='1a' ignore='no'>
</ins><span class="cx">                         <description>Initial sync tokens</description>
</span><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="lines">@@ -55,6 +56,8 @@
</span><span class="cx">                                         <variable>$synctoken1:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='1b' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="lines">@@ -70,6 +73,8 @@
</span><span class="cx">                                         <variable>$synctoken2:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='1c' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookpath1:/</ruri>
</span><span class="lines">@@ -85,6 +90,8 @@
</span><span class="cx">                                         <variable>$synctoken3:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='1d' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -100,6 +107,8 @@
</span><span class="cx">                                         <variable>$synctoken4:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='1e' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -184,7 +193,7 @@
</span><span class="cx">                                 <ruri>$notificationpath2:/</ruri>
</span><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><del>-                <test name='5' ignore='no'>
</del><ins>+                <test name='5a' ignore='no'>
</ins><span class="cx">                         <description>Updated tokens</description>
</span><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="lines">@@ -205,6 +214,8 @@
</span><span class="cx">                                         <variable>$synctoken1:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='5b' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="lines">@@ -224,6 +235,8 @@
</span><span class="cx">                                         <variable>$synctoken2:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='5c' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookpath1:/</ruri>
</span><span class="lines">@@ -242,6 +255,8 @@
</span><span class="cx">                                         <variable>$synctoken3:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='5d' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -261,17 +276,37 @@
</span><span class="cx">                                         <variable>$synctoken4:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='5e-' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><del>-                                <ruri>$addressbookhome2:/</ruri>
</del><ins>+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
</ins><span class="cx">                                 <data substitutions='yes'>
</span><span class="cx">                                         <content-type>text/xml; charset=utf-8</content-type>
</span><span class="cx">                                         <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
</span><span class="cx">                                 </data>
</span><span class="cx">                                 <verify>
</span><ins>+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='5e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
</ins><span class="cx">                                         <callback>multistatusItems</callback>
</span><span class="cx">                                         <arg>
</span><span class="cx">                                                 <name>okhrefs</name>
</span><ins>+                                                <value>$addressbook:/</value>
</ins><span class="cx">                                                 <value>$sharedaddressbook:/</value>
</span><span class="cx">                                         </arg>
</span><span class="cx">                                 </verify>
</span><span class="lines">@@ -280,8 +315,27 @@
</span><span class="cx">                                         <variable>$synctoken5:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='5f-' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><ins>+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='5f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
</ins><span class="cx">                                 <ruri>$addressbookhome2:/$sharedaddressbook:/</ruri>
</span><span class="cx">                                 <data substitutions='yes'>
</span><span class="cx">                                         <content-type>text/xml; charset=utf-8</content-type>
</span><span class="lines">@@ -310,7 +364,7 @@
</span><span class="cx">                                 </verify>
</span><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><del>-                <test name='7' ignore='no'>
</del><ins>+                <test name='7a' ignore='no'>
</ins><span class="cx">                         <description>Updated tokens</description>
</span><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="lines">@@ -331,6 +385,8 @@
</span><span class="cx">                                         <variable>$synctoken1:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='7b' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="lines">@@ -351,6 +407,8 @@
</span><span class="cx">                                         <variable>$synctoken2:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='7c' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookpath1:/</ruri>
</span><span class="lines">@@ -370,6 +428,8 @@
</span><span class="cx">                                         <variable>$synctoken3:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='7d' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -389,6 +449,8 @@
</span><span class="cx">                                         <variable>$synctoken4:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='7e' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -409,6 +471,8 @@
</span><span class="cx">                                         <variable>$synctoken5:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='7f' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/$sharedaddressbook:/</ruri>
</span><span class="lines">@@ -443,7 +507,7 @@
</span><span class="cx">                                 </verify>
</span><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><del>-                <test name='9' ignore='no'>
</del><ins>+                <test name='9a' ignore='no'>
</ins><span class="cx">                         <description>Updated tokens</description>
</span><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="lines">@@ -464,6 +528,8 @@
</span><span class="cx">                                         <variable>$synctoken1:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='9b' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="lines">@@ -484,6 +550,8 @@
</span><span class="cx">                                         <variable>$synctoken2:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='9c' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookpath1:/</ruri>
</span><span class="lines">@@ -503,6 +571,8 @@
</span><span class="cx">                                         <variable>$synctoken3:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='9d' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -522,6 +592,8 @@
</span><span class="cx">                                         <variable>$synctoken4:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='9e' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -542,6 +614,8 @@
</span><span class="cx">                                         <variable>$synctoken5:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='9f' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/$sharedaddressbook:/</ruri>
</span><span class="lines">@@ -572,7 +646,7 @@
</span><span class="cx">                                 </verify>
</span><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><del>-                <test name='11' ignore='no'>
</del><ins>+                <test name='11a' ignore='no'>
</ins><span class="cx">                         <description>Updated tokens</description>
</span><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="lines">@@ -593,6 +667,8 @@
</span><span class="cx">                                         <variable>$synctoken1:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='11b' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="lines">@@ -616,6 +692,8 @@
</span><span class="cx">                                         <variable>$synctoken2:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='11c' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookpath1:/</ruri>
</span><span class="lines">@@ -635,6 +713,8 @@
</span><span class="cx">                                         <variable>$synctoken3:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='11d' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -654,6 +734,8 @@
</span><span class="cx">                                         <variable>$synctoken4:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='11e' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -677,6 +759,8 @@
</span><span class="cx">                                         <variable>$synctoken5:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='11f' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/$sharedaddressbook:/</ruri>
</span><span class="lines">@@ -711,7 +795,7 @@
</span><span class="cx">                                 </verify>
</span><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><del>-                <test name='13' ignore='no'>
</del><ins>+                <test name='13a' ignore='no'>
</ins><span class="cx">                         <description>Updated tokens</description>
</span><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="lines">@@ -732,6 +816,8 @@
</span><span class="cx">                                         <variable>$synctoken1:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='13b' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="lines">@@ -751,6 +837,8 @@
</span><span class="cx">                                         <variable>$synctoken2:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='13c' ignore='no'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookpath1:/</ruri>
</span><span class="lines">@@ -766,6 +854,8 @@
</span><span class="cx">                                         <variable>$synctoken3:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='13d' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -785,6 +875,8 @@
</span><span class="cx">                                         <variable>$synctoken4:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='13e' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/</ruri>
</span><span class="lines">@@ -804,6 +896,8 @@
</span><span class="cx">                                         <variable>$synctoken5:</variable>
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='13f' ignore='no'>
</ins><span class="cx">                         <request user="$userid2:" pswd="$pswd2:" print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome2:/$sharedaddressbook:/</ruri>
</span><span class="lines">@@ -822,6 +916,2676 @@
</span><span class="cx">                 </test>
</span><span class="cx">         </test-suite>
</span><span class="cx">
</span><ins>+        <!-- test suite below is similar to test suite in ../CalDAV/sharing-sync.xml -->
+        <test-suite name='one shared group' ignore='no'>
+                <test name='0' ignore='no'>
+                        <description>clean up old data</description>
+                        <request user="$useradmin:" pswd="$pswdadmin:">
+                                <method>DELETEALL</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <ruri>$notificationpath1:/</ruri>
+                                <ruri>$notificationpath2:/</ruri>
+                        </request>
+                        <description>create empty group</description>
+                        <request>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/3.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-one/3.vcf</filepath>
+                                </data>
+                        </request>
+                </test>
+                <test name='1a' ignore='no'>
+                        <description>Initial sync tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='2' ignore='no'>
+                        <description>user1 POSTs invitation</description>
+                        <request print-response="no">
+                                <method>POST</method>
+                                <ruri>$addressbookpath1:/3.vcf</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-one/4.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='3'>
+                        <description>Check user2 notification collection and get invite uid</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>WAITCOUNT 1</method>
+                                <ruri>$notificationpath2:/</ruri>
+                        </request>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>GETNEW</method>
+                                <ruri>$notificationpath2:/</ruri>
+                                <grabelement>
+                                        <name>{http://calendarserver.org/ns/}invite-notification/{http://calendarserver.org/ns/}uid</name>
+                                        <variable>$inviteuid:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='4'>
+                        <description>user2 replies ACCEPTED and deletes notification</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>POST</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions="yes">
+                                        <content-type>application/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-one/5.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>DELETE</method>
+                                <ruri>$notificationpath2:/$inviteuid:</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='5a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5e-' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='5e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5f-' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='5f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='6'>
+                        <description>Sharee creates vcard</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>PUT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/1.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-one/1.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='7a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='7b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/1.vcf</value>
+                                                <value>$addressbook:/3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='7c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>1.vcf</value>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='7d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='7e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/1.vcf</value>
+                                                <value>$userguid1:/3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='7f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>1.vcf</value>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='8'>
+                        <description>Sharer changes vcard</description>
+                        <request print-response='no'>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/1.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-one/1.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='9a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='10'>
+                        <description>Sharer adds unshared vCard</description>
+                        <request print-response='no'>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/2.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-one/2.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='11a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/2.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>2.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='12'>
+                        <description>Sharer changes unshared vCard</description>
+                        <request print-response='no'>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/2.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-one/2.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='13a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/2.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>2.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='14'>
+                        <description>Sharer changes unshared vCard</description>
+                        <request print-response='no'>
+                                <method>DELETE</method>
+                                <ruri>$addressbookpath1:/2.vcf</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='15a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='15b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$addressbook:/2.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='15c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>2.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='15d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='15e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='15f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='16'>
+                        <description>Sharee deletes vcard</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>DELETE</method>
+                                <ruri>$addressbookhome2:/$userguid1:/1.vcf</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='17a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='17b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/3.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$addressbook:/1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='17c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='17d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='17e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/3.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$userguid1:/1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='17f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>1.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='18'>
+                        <description>Sharer unshares</description>
+                        <request print-response='no'>
+                                <method>POST</method>
+                                <ruri>$addressbookpath1:/3.vcf</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/POST/sharingremove2.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='19a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='19b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='19c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='19d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='19e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='19f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>404</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+        </test-suite>
+        
+        <!-- test suite below is similar to test suite in ../CalDAV/sharing-sync.xml -->
+        <test-suite name='two shared groups' ignore='no'>
+                <test name='0' ignore='no'>
+                        <description>clean up old data</description>
+                        <request user="$useradmin:" pswd="$pswdadmin:">
+                                <method>DELETEALL</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <ruri>$notificationpath1:/</ruri>
+                                <ruri>$notificationpath2:/</ruri>
+                        </request>
+                        <description>create users groups</description>
+                        <request>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/1.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/1.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/2.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/2.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/4.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/4.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/5.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/5.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/6.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/6.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/7.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/7.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='1a' ignore='no'>
+                        <description>Initial sync tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='1e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='2' ignore='no'>
+                        <description>user1 POSTs invitation</description>
+                        <request print-response="no">
+                                <method>POST</method>
+                                <ruri>$addressbookpath1:/6.vcf</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/11.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='3'>
+                        <description>Check user2 notification collection and get invite uid</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>WAITCOUNT 1</method>
+                                <ruri>$notificationpath2:/</ruri>
+                        </request>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>GETNEW</method>
+                                <ruri>$notificationpath2:/</ruri>
+                                <grabelement>
+                                        <name>{http://calendarserver.org/ns/}invite-notification/{http://calendarserver.org/ns/}uid</name>
+                                        <variable>$inviteuid:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='4'>
+                        <description>user2 replies ACCEPTED and deletes notification</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>POST</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions="yes">
+                                        <content-type>application/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/12.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>DELETE</method>
+                                <ruri>$notificationpath2:/$inviteuid:</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='5a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5e-' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='5e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/1.vcf</value>
+                                                <value>$userguid1:/2.vcf</value>
+                                                <value>$userguid1:/6.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='5f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>1.vcf</value>
+                                                <value>2.vcf</value>
+                                                <value>6.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='6' ignore='no'>
+                        <description>user1 POSTs invitation</description>
+                        <request print-response="no">
+                                <method>POST</method>
+                                <ruri>$addressbookpath1:/7.vcf</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/14.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='7'>
+                        <description>Check user2 notification collection and get invite uid</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>WAITCOUNT 1</method>
+                                <ruri>$notificationpath2:/</ruri>
+                        </request>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>GETNEW</method>
+                                <ruri>$notificationpath2:/</ruri>
+                                <grabelement>
+                                        <name>{http://calendarserver.org/ns/}invite-notification/{http://calendarserver.org/ns/}uid</name>
+                                        <variable>$inviteuid:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='8'>
+                        <description>user2 replies ACCEPTED and deletes notification</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>POST</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions="yes">
+                                        <content-type>application/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/15.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>DELETE</method>
+                                <ruri>$notificationpath2:/$inviteuid:</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='9a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9e-' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='9e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/1.vcf</value>
+                                                <value>$userguid1:/2.vcf</value>
+                                                <value>$userguid1:/4.vcf</value>
+                                                <value>$userguid1:/5.vcf</value>
+                                                <value>$userguid1:/6.vcf</value>
+                                                <value>$userguid1:/7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='9f-' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='9f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>1.vcf</value>
+                                                <value>2.vcf</value>
+                                                <value>4.vcf</value>
+                                                <value>5.vcf</value>
+                                                <value>6.vcf</value>
+                                                <value>7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+
+                <test name='10'>
+                        <description>Sharee creates vcard</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>PUT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/3.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/3.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='11a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/3.vcf</value>
+                                                <value>$addressbook:/6.vcf</value>
+                                                <value>$addressbook:/7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>3.vcf</value>
+                                                <value>6.vcf</value>
+                                                <value>7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/3.vcf</value>
+                                                <value>$userguid1:/6.vcf</value>
+                                                <value>$userguid1:/7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='11f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>3.vcf</value>
+                                                <value>6.vcf</value>
+                                                <value>7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='12'>
+                        <description>Sharer changes vcard</description>
+                        <request print-response='no'>
+                                <method>PUT</method>
+                                <ruri>$addressbookpath1:/3.vcf</ruri>
+                                <data>
+                                        <content-type>text/vcard; charset=utf-8</content-type>
+                                        <filepath>Resource/CardDAV/sharing/sync/group-two/3.vcf</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='13a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='13'>
+                        <description>Sharee deletes vcard</description>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>DELETE</method>
+                                <ruri>$addressbookhome2:/$userguid1:/3.vcf</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='14a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='14b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$addressbook:/6.vcf</value>
+                                                <value>$addressbook:/7.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$addressbook:/3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='14c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>6.vcf</value>
+                                                <value>7.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='14d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='14e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/6.vcf</value>
+                                                <value>$userguid1:/7.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$userguid1:/3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='14f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>6.vcf</value>
+                                                <value>7.vcf</value>
+                                        </arg>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>3.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='15'>
+                        <description>Sharer unshares first group</description>
+                        <request print-response='no'>
+                                <method>POST</method>
+                                <ruri>$addressbookpath1:/6.vcf</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/POST/sharingremove2.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='16a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='16b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='16c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='16d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='16e-' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='16e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                                <value>$userguid1:/</value>
+                                                <value>$userguid1:/4.vcf</value>
+                                                <value>$userguid1:/5.vcf</value>
+                                                <value>$userguid1:/7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='16f-' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>403</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+                <test name='16f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-init-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>4.vcf</value>
+                                                <value>5.vcf</value>
+                                                <value>7.vcf</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken6:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='17'>
+                        <description>Sharer unshares 2nd group</description>
+                        <request print-response='no'>
+                                <method>POST</method>
+                                <ruri>$addressbookpath1:/7.vcf</ruri>
+                                <data>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/POST/sharingremove2.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                </test>
+                <test name='18a' ignore='no'>
+                        <description>Updated tokens</description>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken1:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='18b' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>okhrefs</name>
+                                                <value>$addressbook:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken2:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='18c' ignore='no'>
+                        <request print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookpath1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken3:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='18d' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken4:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='18e' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>multistatusItems</callback>
+                                        <arg>
+                                                <name>badhrefs</name>
+                                                <value>$userguid1:/</value>
+                                        </arg>
+                                </verify>
+                                <grabelement>
+                                        <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+                                        <variable>$synctoken5:</variable>
+                                </grabelement>
+                        </request>
+                </test>
+                <test name='18f' ignore='no'>
+                        <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+                                <method>REPORT</method>
+                                <ruri>$addressbookhome2:/$userguid1:/</ruri>
+                                <data substitutions='yes'>
+                                        <content-type>text/xml; charset=utf-8</content-type>
+                                        <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+                                </data>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                        <arg>
+                                                <name>status</name>
+                                                <value>404</value>
+                                        </arg>
+                                </verify>
+                        </request>
+                </test>
+        </test-suite>
+
+        <!-- test suites below are similar to those in ../CalDAV/sync-report.xml but
+                        use shared address books instead of calendars -->
+        
</ins><span class="cx">         <test-suite name='support-report-set/sync-token property' ignore='no'>
</span><span class="cx">                 <test name='0' ignore='no'>
</span><span class="cx">                         <!-- clean up old data -->
</span><span class="lines">@@ -2916,7 +5680,7 @@
</span><span class="cx">                 </test>
</span><span class="cx">         </test-suite>
</span><span class="cx">
</span><del>-        <test-suite name='simple reports - diff token - delete/create addressbook - home depth:infinity' ignore='no'>
</del><ins>+        <test-suite name='simple reports - diff token - delete/create addressbook - home depth:infinity' ignore='yes'>
</ins><span class="cx">                 <require-feature>
</span><span class="cx">                         <feature>sync-report-home</feature>
</span><span class="cx">                 </require-feature>
</span><span class="lines">@@ -2956,6 +5720,20 @@
</span><span class="cx">                         <description>remove resource then addressbook</description>
</span><span class="cx">                         <request user="$userid3:" pswd="$pswd3:" print-response='no'>
</span><span class="cx">                                 <method>DELETE</method>
</span><ins>+                                <ruri>$addressbookpath3:/2.vcf</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request user="$userid3:" pswd="$pswd3:" print-response='no'>
+                                <method>DELETE</method>
+                                <ruri>$addressbookpath3:/1.vcf</ruri>
+                                <verify>
+                                        <callback>statusCode</callback>
+                                </verify>
+                        </request>
+                        <request user="$userid3:" pswd="$pswd3:" print-response='no'>
+                                <method>DELETE</method>
</ins><span class="cx">                                 <ruri>$addressbookpath3:/</ruri>
</span><span class="cx">                                 <verify>
</span><span class="cx">                                         <callback>statusCode</callback>
</span><span class="lines">@@ -3037,7 +5815,7 @@
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="cx">                                 <header>
</span><span class="cx">                                         <name>Depth</name>
</span><del>-                                        <value>infinity</value>
</del><ins>+                                        <value>1</value>
</ins><span class="cx">                                 </header>
</span><span class="cx">                                 <data>
</span><span class="cx">                                         <content-type>text/xml; charset=utf-8</content-type>
</span><span class="lines">@@ -3059,7 +5837,7 @@
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="cx">                                 <header>
</span><span class="cx">                                         <name>Depth</name>
</span><del>-                                        <value>infinity</value>
</del><ins>+                                        <value>1</value>
</ins><span class="cx">                                 </header>
</span><span class="cx">                                 <data>
</span><span class="cx">                                         <content-type>text/xml; charset=utf-8</content-type>
</span><span class="lines">@@ -3693,7 +6471,7 @@
</span><span class="cx">                                 </grabelement>
</span><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><del>-                <test name='3' ignore='no'>
</del><ins>+                <test name='-3' ignore='no'>
</ins><span class="cx">                         <description>add addressbook - test last sync</description>
</span><span class="cx">                         <!-- share user3 address book with user1 -->
</span><span class="cx">                         <!-- user3 POSTs invitation -->
</span><span class="lines">@@ -3733,6 +6511,8 @@
</span><span class="cx">                                 <method>DELETE</method>
</span><span class="cx">                                 <ruri>$notificationpath1:/$inviteuid:</ruri>
</span><span class="cx">                         </request>
</span><ins>+                </test>
+                <test name='3' ignore='yes'>
</ins><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="cx">                                 <ruri>$addressbookhome1:/</ruri>
</span><span class="lines">@@ -3753,7 +6533,7 @@
</span><span class="cx">                                 </verify>
</span><span class="cx">                         </request>
</span><span class="cx">                 </test>
</span><del>-                <test name='4' ignore='no'>
</del><ins>+                <test name='4' ignore='yes'>
</ins><span class="cx">                         <description>add addressbook - test previous sync</description>
</span><span class="cx">                         <request print-response='no'>
</span><span class="cx">                                 <method>REPORT</method>
</span><span class="lines">@@ -3777,30 +6557,6 @@
</span><span class="cx">                 </test>
</span><span class="cx">         </test-suite>
</span><span class="cx">
</span><del>-        <test-suite name='simple reports - empty inbox' ignore='yes'>
-                <test name='1' ignore='no'>
-                        <description>initial query</description>
-                        <request print-response='no'>
-                                <method>REPORT</method>
-                                <ruri>$inboxpath1:/</ruri>
-                                <header>
-                                        <name>Depth</name>
-                                        <value>1</value>
-                                </header>
-                                <data>
-                                        <content-type>text/xml; charset=utf-8</content-type>
-                                        <filepath>Resource/CardDAV/sharing/sync/addressbook/22.xml</filepath>
-                                </data>
-                                <verify>
-                                        <callback>multistatusItems</callback>
-                                        <arg>
-                                                <name>okhrefs</name>
-                                        </arg>
-                                </verify>
-                        </request>
-                </test>
-        </test-suite>
-
</del><span class="cx">         <test-suite name='simple reports - valid token' ignore='no'>
</span><span class="cx">                 <test name='1' ignore='no'>
</span><span class="cx">                         <description>initial query</description>
</span></span></pre></div>
<a id="CalendarServertrunk"></a>
<div class="propset"><h4>Property changes: CalendarServer/trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/json:11622-11912
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/reverse-proxy-pods:11875-11900
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/sharing-in-the-store:11935-12016
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><span class="cx"> + /CalDAVTester/trunk:11193-11198
</span><span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/json:11622-11912
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/reverse-proxy-pods:11875-11900
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/sharing-in-the-store:11935-12016
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroupfixes:12120-12142
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><a id="CalendarServertrunktwistedcaldavstorebridgepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/storebridge.py (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/storebridge.py        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -2785,7 +2785,7 @@
</span><span class="cx"> content_type = request.headers.getHeader("content-type")
</span><span class="cx"> format = self.determineType(content_type)
</span><span class="cx"> if format is None:
</span><del>- log.error("MIME type %s not allowed in calendar collection" % (content_type,))
</del><ins>+ log.error("MIME type {content_type} not allowed in calendar collection", content_type=content_type)
</ins><span class="cx"> raise HTTPError(ErrorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (caldav_namespace, "supported-calendar-data"),
</span><span class="lines">@@ -3395,7 +3395,7 @@
</span><span class="cx"> content_type = request.headers.getHeader("content-type")
</span><span class="cx"> format = self.determineType(content_type)
</span><span class="cx"> if format is None:
</span><del>- log.error("MIME type %s not allowed in vcard collection" % (content_type,))
</del><ins>+ log.error("MIME type {content_type} not allowed in vcard collection", content_type=content_type)
</ins><span class="cx"> raise HTTPError(ErrorResponse(
</span><span class="cx"> responsecode.FORBIDDEN,
</span><span class="cx"> (carddav_namespace, "supported-address-data"),
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoretesttest_sql_sharingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -554,7 +554,7 @@
</span><span class="cx"> otherCal = yield self.calendarUnderTest(home="user02", name=sharedName)
</span><span class="cx"> self.assertNotEqual(otherCal._bindRevision, 0)
</span><span class="cx">
</span><del>- changed, deleted = yield otherCal.resourceNamesSinceRevision(otherCal._bindRevision - 1)
</del><ins>+ changed, deleted = yield otherCal.resourceNamesSinceRevision(0)
</ins><span class="cx"> self.assertNotEqual(len(changed), 0)
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span><span class="lines">@@ -563,7 +563,7 @@
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span><span class="cx"> for depth in ("1", "infinity",):
</span><del>- changed, deleted = yield otherHome.resourceNamesSinceRevision(otherCal._bindRevision - 1, depth)
</del><ins>+ changed, deleted = yield otherHome.resourceNamesSinceRevision(0, depth)
</ins><span class="cx"> self.assertNotEqual(len(changed), 0)
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcarddavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/carddav/datastore/sql.py (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/carddav/datastore/sql.py        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/txdav/carddav/datastore/sql.py        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -56,12 +56,12 @@
</span><span class="cx"> from txdav.common.datastore.sql_tables import _ABO_KIND_PERSON, \
</span><span class="cx"> _ABO_KIND_GROUP, _ABO_KIND_RESOURCE, _ABO_KIND_LOCATION, schema, \
</span><span class="cx"> _BIND_MODE_OWN, _BIND_MODE_WRITE, _BIND_STATUS_ACCEPTED, \
</span><del>- _BIND_STATUS_INVITED, _BIND_MODE_READ, _BIND_MODE_INDIRECT, \
- _BIND_STATUS_DECLINED
</del><ins>+ _BIND_STATUS_INVITED, _BIND_MODE_INDIRECT, _BIND_STATUS_DECLINED
</ins><span class="cx"> from txdav.common.icommondatastore import InternalDataStoreError, \
</span><span class="cx"> InvalidUIDError, UIDExistsError, ObjectResourceTooBigError, \
</span><span class="cx"> InvalidObjectResourceError, InvalidComponentForStoreError, \
</span><del>- AllRetriesFailed, ObjectResourceNameAlreadyExistsError
</del><ins>+ AllRetriesFailed, ObjectResourceNameAlreadyExistsError, \
+ SyncTokenValidException
</ins><span class="cx">
</span><span class="cx"> from zope.interface.declarations import implements
</span><span class="cx">
</span><span class="lines">@@ -266,6 +266,8 @@
</span><span class="cx"> """
</span><span class="cx"> rev = cls._revisionsSchema
</span><span class="cx"> bind = cls._bindSchema
</span><ins>+ abo = cls._objectSchema
+ groupBind = AddressBookObject._bindSchema
</ins><span class="cx"> return Select(
</span><span class="cx"> [Max(rev.REVISION)],
</span><span class="cx"> # active shared address books
</span><span class="lines">@@ -278,6 +280,22 @@
</span><span class="cx"> [bind.RESOURCE_ID],
</span><span class="cx"> From=bind,
</span><span class="cx"> Where=bind.HOME_RESOURCE_ID == Parameter("resourceID"),
</span><ins>+ SetExpression=Union(
+ Select(
+ [abo.ADDRESSBOOK_HOME_RESOURCE_ID],
+ From=abo,
+ Where=(
+ abo.RESOURCE_ID.In(
+ Select(
+ [groupBind.GROUP_RESOURCE_ID],
+ From=groupBind,
+ Where=groupBind.ADDRESSBOOK_HOME_RESOURCE_ID == Parameter("resourceID"),
+ )
+ )
+ )
+ ),
+ optype=Union.OPTYPE_ALL,
+ )
</ins><span class="cx"> )
</span><span class="cx"> )
</span><span class="cx"> ),
</span><span class="lines">@@ -288,7 +306,7 @@
</span><span class="cx"> From=rev,
</span><span class="cx"> Where=(rev.HOME_RESOURCE_ID == Parameter("resourceID")).And(rev.RESOURCE_ID == None),
</span><span class="cx"> SetExpression=Union(
</span><del>- # owned address book: owned address book cannot be deleted: See AddressBook.remove()
</del><ins>+ # owned address book
</ins><span class="cx"> Select(
</span><span class="cx"> [rev.REVISION],
</span><span class="cx"> From=rev,
</span><span class="lines">@@ -307,7 +325,7 @@
</span><span class="cx"> def _changesQuery(cls): #@NoSelf
</span><span class="cx"> rev = cls._revisionsSchema
</span><span class="cx"> return Select(
</span><del>- [rev.COLLECTION_NAME,
</del><ins>+ [rev.ADDRESSBOOK_NAME,
</ins><span class="cx"> rev.RESOURCE_NAME,
</span><span class="cx"> rev.DELETED],
</span><span class="cx"> From=rev,
</span><span class="lines">@@ -319,9 +337,11 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def doChangesQuery(self, revision):
</span><span class="cx">
</span><del>- rows = yield self._changesQuery.on(self._txn,
- resourceID=self._resourceID,
- revision=revision)
</del><ins>+ rows = yield self._changesQuery.on(
+ self._txn,
+ resourceID=self._resourceID,
+ revision=revision
+ )
</ins><span class="cx">
</span><span class="cx"> # If the collection name is None that means we have a change to the owner's default address book,
</span><span class="cx"> # so substitute in the name of that. If collection name is not None, then we have a revision
</span><span class="lines">@@ -441,7 +461,10 @@
</span><span class="cx">
</span><span class="cx"> def __init__(self, home, name, resourceID, mode, status, revision=0, message=None, ownerHome=None, ownerName=None):
</span><span class="cx"> ownerName = ownerHome.addressbook().name() if ownerHome else None
</span><del>- super(AddressBook, self).__init__(home, name, resourceID, mode, status, revision=revision, message=message, ownerHome=ownerHome, ownerName=ownerName)
</del><ins>+ super(AddressBook, self).__init__(
+ home, name, resourceID, mode, status, revision=revision,
+ message=message, ownerHome=ownerHome, ownerName=ownerName
+ )
</ins><span class="cx"> self._index = PostgresLegacyABIndexEmulator(self)
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -470,7 +493,221 @@
</span><span class="cx"> _modified = property(getModified, setModified,)
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @classproperty
+ def _deleteBumpTokenQuery(cls): #@NoSelf
+ rev = cls._revisionsSchema
+ return Update({rev.REVISION: schema.REVISION_SEQ,
+ rev.OBJECT_RESOURCE_ID: Parameter("id"),
+ rev.DELETED: True},
+ Where=(rev.RESOURCE_ID == Parameter("resourceID")).And(
+ rev.RESOURCE_NAME == Parameter("name")),
+ Return=rev.REVISION)
+
+
</ins><span class="cx"> @inlineCallbacks
</span><ins>+ def _changeRevision(self, action, name, id=0):
+
+ # Need to handle the case where for some reason the revision entry is
+ # actually missing. For a "delete" we don't care, for an "update" we
+ # will turn it into an "insert".
+ if action == "delete":
+ rows = (
+ yield self._deleteBumpTokenQuery.on(
+ self._txn, resourceID=self._resourceID, name=name, id=id))
+ if rows:
+ self._syncTokenRevision = rows[0][0]
+ elif action == "update":
+ rows = (
+ yield self._updateBumpTokenQuery.on(
+ self._txn, resourceID=self._resourceID, name=name))
+ if rows:
+ self._syncTokenRevision = rows[0][0]
+ else:
+ action = "insert"
+
+ if action == "insert":
+ # Note that an "insert" may happen for a resource that previously
+ # existed and then was deleted. In that case an entry in the
+ # REVISIONS table still exists so we have to detect that and do db
+ # INSERT or UPDATE as appropriate
+
+ found = bool((
+ yield self._insertFindPreviouslyNamedQuery.on(
+ self._txn, resourceID=self._resourceID, name=name)))
+ if found:
+ self._syncTokenRevision = (
+ yield self._updatePreviouslyNamedQuery.on(
+ self._txn, resourceID=self._resourceID, name=name)
+ )[0][0]
+ else:
+ self._syncTokenRevision = (
+ yield self._completelyNewRevisionQuery.on(
+ self._txn, homeID=self.ownerHome()._resourceID,
+ resourceID=self._resourceID, name=name)
+ )[0][0]
+ self._maybeNotify()
+ returnValue(self._syncTokenRevision)
+
+
+ def _deleteRevision(self, name, id=0):
+ return self._changeRevision("delete", name, id)
+
+
+ @inlineCallbacks
+ def resourceNamesSinceRevision(self, revision):
+ """
+ Return the changed and deleted resources since a particular revision. This implementation takes
+ into account sharing by making use of the bindRevision attribute to determine if the requested
+ revision is earlier than the share acceptance. If so, then we need to return all resources in
+ the results since the collection is in effect "new".
+
+ @param revision: the revision to determine changes since
+ @type revision: C{int}
+ """
+ if self.owned():
+ returnValue((yield super(AddressBook, self).resourceNamesSinceRevision(revision)))
+
+ # call sharedChildResourceNamesSinceRevision() and filter results
+ sharedChildChanged, sharedChildDeleted = yield self.sharedChildResourceNamesSinceRevision(revision, "infinity")
+
+ selfPath = self.name() + '/'
+ lenpath = len(selfPath)
+ changed = [item[lenpath:] for item in sharedChildChanged if item.startswith(selfPath) and item != selfPath]
+ deleted = [item[lenpath:] for item in sharedChildDeleted if item.startswith(selfPath) and item != selfPath]
+ returnValue((changed, deleted,))
+
+
+ @inlineCallbacks
+ def sharedChildResourceNamesSinceRevision(self, revision, depth):
+ """
+ Determine the list of child resources that have changed since the specified sync revision.
+ We do the same SQL query for both depth "1" and "infinity", but filter the results for
+ "1" to only account for a collection change.
+
+ We need to handle shared collection a little differently from owned ones. When a shared collection
+ is bound into a home we record a revision for it using the sharee home id and sharee collection name.
+ That revision is the "starting point" for changes: so if sync occurs with a revision earlier than
+ that, we return the list of all resources in the shared collection since they are all "new" as far
+ as the client is concerned since the shared collection has just appeared. For a later revision, we
+ just report the changes since that one. When a shared collection is removed from a home, we again
+ record a revision for the sharee home and sharee collection name with the "deleted" flag set. That way
+ the shared collection can be reported as removed.
+
+ For shared groups. Find the items that have be added and removed since revision in the aboMembers
+ tables. Then add in changes from the revision table.
+
+ TODO: Cover the case where the sharing changes. Then we can handle revision < bindRevision
+
+ @param revision: the sync revision to compare to
+ @type revision: C{str}
+ @param depth: depth for determine what changed
+ @type depth: C{str}
+ """
+ assert not self.owned()
+
+ bindRevisions = [self._bindRevision] if self.fullyShared() else []
+
+ groupBindRows = yield AddressBookObject._acceptedBindForHomeIDAndAddressBookID.on(
+ self._txn, homeID=self._home._resourceID, addressbookID=self._resourceID
+ )
+ if groupBindRows:
+ bindRevisions += [groupBindRow[5] for groupBindRow in groupBindRows]
+
+ if revision != 0 and revision < max(bindRevisions):
+ if depth != '1':
+ raise SyncTokenValidException
+ else:
+ revision = 0
+
+ path = self.name()
+
+ if self.fullyShared():
+ # add change for addressbook group
+ changed, deleted = yield super(AddressBook, self).sharedChildResourceNamesSinceRevision(revision, depth)
+
+ #===================================================================
+ # # Add the following to add the addressbook group in sync report:
+ #
+ # if changed or deleted and depth != "1":
+ # changed.add("%s/%s" % (path, self._groupForSharedAddressBookName(),))
+ #===================================================================
+
+ returnValue((changed, deleted))
+
+ changed = set()
+ deleted = set()
+ acceptedGroupIDs = set([groupBindRow[2] for groupBindRow in groupBindRows])
+
+ allowedObjectIDs = set((yield self.expandGroupIDs(self._txn, acceptedGroupIDs)))
+ oldAllowedObjectIDs = set((yield self.expandGroupIDs(self._txn, acceptedGroupIDs, revision)))
+ addedObjectIDs = allowedObjectIDs - oldAllowedObjectIDs
+ removedObjectIDs = oldAllowedObjectIDs - allowedObjectIDs
+
+ # get revision table changes
+ rev = self._revisionsSchema
+ results = [(
+ name,
+ id,
+ wasdeleted,
+ ) for name, id, wasdeleted in (
+ yield Select([rev.RESOURCE_NAME, rev.OBJECT_RESOURCE_ID, rev.DELETED],
+ From=rev,
+ Where=(rev.REVISION > revision).And(
+ rev.RESOURCE_ID == self._resourceID)).on(self._txn)
+ ) if name
+ ]
+
+ # get deleted object names if any
+ idToNameMap = dict([(id, name) for name, id, wasdeleted in results if wasdeleted])
+
+ # now get other names of existing objects
+ missingNameIDs = (allowedObjectIDs | oldAllowedObjectIDs) - set(idToNameMap.keys())
+ if missingNameIDs:
+ abo = schema.ADDRESSBOOK_OBJECT
+ memberIDNameRows = (
+ yield AddressBookObject._columnsWithResourceIDsQuery(
+ [abo.RESOURCE_ID, abo.RESOURCE_NAME],
+ missingNameIDs
+ ).on(self._txn, resourceIDs=missingNameIDs)
+ )
+ idToNameMap = dict(dict(idToNameMap), **dict(memberIDNameRows))
+
+ # now do revisions
+ if revision:
+
+ # handled added or removed objects
+ if removedObjectIDs or addedObjectIDs:
+ changed.add("%s/" % (path,))
+
+ if depth != "1":
+ for removedObjectID in removedObjectIDs:
+ deleted.add("%s/%s" % (path, idToNameMap[removedObjectID],))
+
+ for addedObjectID in addedObjectIDs:
+ changed.add("%s/%s" % (path, idToNameMap[addedObjectID],))
+
+ # use revisions to handle changed objects
+ for name, id, wasdeleted in results:
+ if not wasdeleted and name in idToNameMap.values():
+ # Always report collection as changed
+ changed.add("%s/" % (path,))
+
+ # Resource changed - for depth "infinity" report resource as changed
+ if depth != "1":
+ item = "%s/%s" % (path, name,)
+ if item not in deleted:
+ changed.add("%s/%s" % (path, name,))
+
+ else:
+ changed.add("%s/" % (path,))
+ if depth != "1":
+ for addedObjectID in allowedObjectIDs:
+ changed.add("%s/%s" % (path, idToNameMap[addedObjectID],))
+
+ returnValue((changed, deleted))
+
+
+ @inlineCallbacks
</ins><span class="cx"> def _loadPropertyStore(self, props=None):
</span><span class="cx"> if props is None:
</span><span class="cx"> props = yield PropertyStore.load(
</span><span class="lines">@@ -513,6 +750,19 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><ins>+ def removedObjectResource(self, child):
+ """
+ just like CommonHomeChild.removedObjectResource() but does not call self._deleteRevision()
+ """
+ self._objects.pop(child.name(), None)
+ self._objects.pop(child.uid(), None)
+ if self._objectNames and child.name() in self._objectNames:
+ self._objectNames.remove(child.name())
+ #yield self._deleteRevision(child.name())
+ yield self.notifyChanged()
+
+
+ @inlineCallbacks
</ins><span class="cx"> def remove(self):
</span><span class="cx">
</span><span class="cx"> if self._resourceID == self._home._resourceID:
</span><span class="lines">@@ -523,9 +773,6 @@
</span><span class="cx">
</span><span class="cx"> yield self.unshare() # storebridge should already have done this
</span><span class="cx">
</span><del>- # Note that revision table is NOT queried for removes
- yield self._updateRevision(self.name())
-
</del><span class="cx"> yield self.properties()._removeResource()
</span><span class="cx"> yield self._loadPropertyStore()
</span><span class="cx">
</span><span class="lines">@@ -571,6 +818,7 @@
</span><span class="cx"> if self.fullyShared():
</span><span class="cx"> if not self._groupForSharedAddressBookName() in self._objectNames:
</span><span class="cx"> self._objectNames.append(self._groupForSharedAddressBookName())
</span><ins>+ self._objectNames.sort()
</ins><span class="cx">
</span><span class="cx"> returnValue(self._objectNames)
</span><span class="cx">
</span><span class="lines">@@ -675,9 +923,6 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def bumpModified(self):
</span><del>- # TODO: The next line seems the next line work too. Why?
- # returnValue((yield self.ownerHome().bumpModified()))
- #
</del><span class="cx"> if self._resourceID == self._home._resourceID:
</span><span class="cx"> returnValue((yield self._home.bumpModified()))
</span><span class="cx"> else:
</span><span class="lines">@@ -747,9 +992,7 @@
</span><span class="cx"> ownerHome = yield home.ownerHomeWithChildID(ownerAddressBookID)
</span><span class="cx"> if ownerHome not in ownerHomeToDataRowMap:
</span><span class="cx"> groupBindRow[0] = _BIND_MODE_INDIRECT
</span><del>- groupBindRow[3] = None # bindName
- groupBindRow[4] = None # bindStatus
- groupBindRow[6] = None # bindMessage
</del><ins>+ groupBindRow[3:7] = 4 * [None] # bindName, bindStatus, bindRevision, bindMessage
</ins><span class="cx"> ownerHomeToDataRowMap[ownerHome] = groupBindRow
</span><span class="cx">
</span><span class="cx"> if ownerHomeToDataRowMap:
</span><span class="lines">@@ -921,19 +1164,65 @@
</span><span class="cx"> @classmethod
</span><span class="cx"> def _memberIDsWithGroupIDsQuery(cls, groupIDs):
</span><span class="cx"> """
</span><del>- DAL query to load all object resource names for a home child.
</del><ins>+ DAL query to find members and revisions
</ins><span class="cx"> """
</span><span class="cx"> aboMembers = schema.ABO_MEMBERS
</span><del>- return Select(
- [aboMembers.MEMBER_ID],
- From=aboMembers,
- Where=aboMembers.GROUP_ID.In(Parameter("groupIDs", len(groupIDs))),
- )
</del><ins>+ return Select([aboMembers.MEMBER_ID, aboMembers.REMOVED, aboMembers.REVISION],
+ From=aboMembers,
+ Where=aboMembers.GROUP_ID.In(Parameter("groupIDs", len(groupIDs))),
+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @classmethod
</span><ins>+ def _memberIDsWithGroupIDsAndRevisionQuery(cls, groupIDs):
+ """
+ DAL query to find members and revisions
+ """
+ aboMembers = schema.ABO_MEMBERS
+ return Select([aboMembers.MEMBER_ID, aboMembers.REMOVED, aboMembers.REVISION],
+ From=aboMembers,
+ Where=aboMembers.GROUP_ID.In(Parameter("groupIDs", len(groupIDs)))
+ .And(aboMembers.REVISION <= Parameter("revision")),
+ )
+
+
+ @classmethod
+ def _currentMemberIDsFromMemberIDRemovedRevisionRows(cls, memberRows):
+ memberIDs = set()
+ objectIDToVersionToRemovedMap = {}
+ for id, removed, version in memberRows:
+ versionRemovedRow = objectIDToVersionToRemovedMap.get(id, [])
+ versionRemovedRow.append((version, removed,))
+ objectIDToVersionToRemovedMap[id] = versionRemovedRow
+
+ for id, versionRemovedRows in objectIDToVersionToRemovedMap.iteritems():
+ versionToRemovedMap = dict(versionRemovedRows)
+ if not versionToRemovedMap[max(versionToRemovedMap.keys())]:
+ memberIDs.add(id)
+
+ return memberIDs
+
+
+ @classmethod
</ins><span class="cx"> @inlineCallbacks
</span><del>- def expandGroupIDs(cls, txn, groupIDs, includeGroupIDs=True):
</del><ins>+ def memberIDsWithGroupIDs(cls, txn, groupIDs, atRevision=0):
+
+ if atRevision == 0:
+ memberRows = yield cls._memberIDsWithGroupIDsQuery(groupIDs).on(
+ txn, groupIDs=groupIDs
+ )
+ else:
+ memberRows = yield cls._memberIDsWithGroupIDsAndRevisionQuery(groupIDs).on(
+ txn, groupIDs=groupIDs, revision=atRevision
+ )
+
+ memberIDs = cls._currentMemberIDsFromMemberIDRemovedRevisionRows(memberRows)
+ returnValue(memberIDs)
+
+
+ @classmethod
+ @inlineCallbacks
+ def expandGroupIDs(cls, txn, groupIDs, atRevision=0, includeGroupIDs=True):
</ins><span class="cx"> """
</span><span class="cx"> Get all AddressBookObject resource IDs contained in the given shared groups with the given groupIDs
</span><span class="cx"> """
</span><span class="lines">@@ -941,14 +1230,14 @@
</span><span class="cx"> examinedIDs = set()
</span><span class="cx"> remainingIDs = set(groupIDs)
</span><span class="cx"> while remainingIDs:
</span><del>- memberRows = yield cls._memberIDsWithGroupIDsQuery(remainingIDs).on(
- txn, groupIDs=remainingIDs
- )
- objectIDs |= set(memberRow[0] for memberRow in memberRows)
</del><ins>+
+ memberIDs = yield cls.memberIDsWithGroupIDs(txn, remainingIDs, atRevision)
+
+ objectIDs |= memberIDs
</ins><span class="cx"> examinedIDs |= remainingIDs
</span><span class="cx"> remainingIDs = objectIDs - examinedIDs
</span><span class="cx">
</span><del>- returnValue(tuple(objectIDs))
</del><ins>+ returnValue(objectIDs)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -980,26 +1269,26 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def accessControlGroupIDs(self):
</del><ins>+ def _groupIDAccessSets(self):
</ins><span class="cx"> """
</span><span class="cx"> For each accepted shared group, determine what its access mode is and return the sets of read-only
</span><span class="cx"> and read-write groups. Handle the case where a read-only group is actually nested in a read-write
</span><span class="cx"> group by putting the read-only one into the read-write list.
</span><span class="cx"> """
</span><span class="cx"> if self.owned():
</span><del>- returnValue(([], []))
</del><ins>+ returnValue((set(), set()))
</ins><span class="cx"> else:
</span><span class="cx"> groupBindRows = yield AddressBookObject._acceptedBindForHomeIDAndAddressBookID.on(
</span><span class="cx"> self._txn, homeID=self._home._resourceID, addressbookID=self._resourceID
</span><span class="cx"> )
</span><del>- readWriteGroupIDs = []
- readOnlyGroupIDs = []
</del><ins>+ readWriteGroupIDs = set()
+ readOnlyGroupIDs = set()
</ins><span class="cx"> for groupBindRow in groupBindRows:
</span><span class="cx"> bindMode, homeID, resourceID, name, bindStatus, bindRevision, bindMessage = groupBindRow[:AddressBookObject.bindColumnCount] #@UnusedVariable
</span><span class="cx"> if bindMode == _BIND_MODE_WRITE:
</span><del>- readWriteGroupIDs.append(resourceID)
</del><ins>+ readWriteGroupIDs.add(resourceID)
</ins><span class="cx"> else:
</span><del>- readOnlyGroupIDs.append(resourceID)
</del><ins>+ readOnlyGroupIDs.add(resourceID)
</ins><span class="cx">
</span><span class="cx"> if readOnlyGroupIDs and readWriteGroupIDs:
</span><span class="cx"> # expand read-write groups and remove any subgroups from read-only group list
</span><span class="lines">@@ -1009,20 +1298,20 @@
</span><span class="cx"> else:
</span><span class="cx"> adjustedReadOnlyGroupIDs = readOnlyGroupIDs
</span><span class="cx"> adjustedReadWriteGroupIDs = readWriteGroupIDs
</span><del>- returnValue((tuple(adjustedReadOnlyGroupIDs), tuple(adjustedReadWriteGroupIDs)))
</del><ins>+ returnValue((adjustedReadOnlyGroupIDs, adjustedReadWriteGroupIDs))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> # FIXME: Unused
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def readOnlyGroupIDs(self):
</span><del>- returnValue((yield self.accessControlGroupIDs())[0])
</del><ins>+ returnValue((yield self._groupIDAccessSets())[0])
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def readWriteGroupIDs(self):
</span><del>- returnValue((yield self.accessControlGroupIDs())[1])
</del><ins>+ returnValue((yield self._groupIDAccessSets())[1])
</ins><span class="cx">
</span><del>-
</del><ins>+ '''
</ins><span class="cx"> # FIXME: Unused: Use for caching access
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def accessControlObjectIDs(self):
</span><span class="lines">@@ -1072,13 +1361,13 @@
</span><span class="cx">
</span><span class="cx"> # FIXME: Unused: Use for caching access
</span><span class="cx"> @inlineCallbacks
</span><del>- def readOnlyObjectIDs(self):
</del><ins>+ def readOnlyGroupIDs(self):
</ins><span class="cx"> returnValue((yield self.accessControlObjectIDs())[1])
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> # FIXME: Unused: Use for caching access
</span><span class="cx"> @inlineCallbacks
</span><del>- def readWriteObjectIDs(self):
</del><ins>+ def readWriteGroupIDs(self):
</ins><span class="cx"> returnValue((yield self.accessControlObjectIDs())[1])
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1087,6 +1376,7 @@
</span><span class="cx"> def allObjectIDs(self):
</span><span class="cx"> readOnlyIDs, readWriteIDs = yield self.accessControlObjectIDs()
</span><span class="cx"> returnValue((readOnlyIDs + readWriteIDs))
</span><ins>+ '''
</ins><span class="cx">
</span><span class="cx"> # Convenient names for some methods
</span><span class="cx"> ownerAddressBookHome = CommonHomeChild.ownerHome
</span><span class="lines">@@ -1202,7 +1492,8 @@
</span><span class="cx"> yield self.setShared(True)
</span><span class="cx">
</span><span class="cx"> # Must send notification to ensure cache invalidation occurs
</span><del>- yield self.notifyChanged()
</del><ins>+ yield self.addressbook().notifyPropertyChanged()
+ yield shareeHome.notifyChanged()
</ins><span class="cx">
</span><span class="cx"> returnValue(bindName)
</span><span class="cx">
</span><span class="lines">@@ -1230,14 +1521,23 @@
</span><span class="cx"> yield super(AddressBookObjectSharingMixIn, self).unshare()
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @property
+ def _syncTokenRevision(self):
+ return self.addressbook()._syncTokenRevision
+
+
+ def syncToken(self):
+ return self.addressbook().syncToken() # init self.addressbook()._syncTokenRevision
+
+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def updateShare(self, shareeView, mode=None, status=None, summary=None):
</span><span class="cx"> """
</span><del>- Update share mode, status, and message for a home child shared with
- this (owned) L{CommonHomeChild}.
</del><ins>+ Update share mode, status, and message for a address book group with
+ this (owned) L{AddressBookObject}.
</ins><span class="cx">
</span><del>- @param shareeView: The sharee home child that shares this.
- @type shareeView: L{CommonHomeChild}
</del><ins>+ @param shareeView: The sharee addressbook group that shares this.
+ @type shareeView: L{AddressBookObject}
</ins><span class="cx">
</span><span class="cx"> @param mode: The sharing mode; L{_BIND_MODE_READ} or
</span><span class="cx"> L{_BIND_MODE_WRITE} or None to not update
</span><span class="lines">@@ -1248,64 +1548,80 @@
</span><span class="cx"> L{_BIND_STATUS_INVALID} or None to not update
</span><span class="cx"> @type status: L{str}
</span><span class="cx">
</span><del>- @param summary: The proposed message to go along with the share, which
</del><ins>+ @param message: The proposed message to go along with the share, which
</ins><span class="cx"> will be used as the default display name, or None to not update
</span><del>- @type summary: L{str}
-
- @return: the name of the shared item in the sharee's home.
- @rtype: a L{Deferred} which fires with a L{str}
</del><ins>+ @type message: L{str}
</ins><span class="cx"> """
</span><span class="cx"> # TODO: raise a nice exception if shareeView is not, in fact, a shared
</span><span class="cx"> # version of this same L{CommonHomeChild}
</span><span class="cx">
</span><span class="cx"> # remove None parameters, and substitute None for empty string
</span><span class="cx"> bind = self._bindSchema
</span><del>- columnMap = dict([(k, v if v != "" else None) for k, v in {
- bind.BIND_MODE:mode,
- bind.BIND_STATUS:status,
- bind.MESSAGE:summary
- }.iteritems() if v is not None])
</del><ins>+ columnMap = {}
+ if mode != None and mode != shareeView._bindMode:
+ columnMap[bind.BIND_MODE] = mode
+ if status != None and status != shareeView._bindStatus:
+ columnMap[bind.BIND_STATUS] = status
+ if summary != None and summary != shareeView._bindMessage:
+ columnMap[bind.MESSAGE] = summary
</ins><span class="cx">
</span><del>- if len(columnMap):
</del><ins>+ if columnMap:
</ins><span class="cx">
</span><span class="cx"> # count accepted
</span><del>- if status is not None:
- previouslyAcceptedBindCount = 1 if self.addressbook().fullyShared() else 0
- previouslyAcceptedBindCount += len((
- yield AddressBookObject._acceptedBindForHomeIDAndAddressBookID.on(
- self._txn, homeID=shareeView.viewerHome()._resourceID, addressbookID=self.addressbook()._resourceID
- )
- ))
</del><ins>+ if bind.BIND_STATUS in columnMap:
+ previouslyAcceptedBindCount = 1 if shareeView.addressbook().fullyShared() else 0
+ groupBindRows = yield AddressBookObject._acceptedBindForHomeIDAndAddressBookID.on(
+ self._txn, homeID=shareeView.viewerHome()._resourceID, addressbookID=self.addressbook()._resourceID
+ )
+ previouslyAcceptedBindCount += len(groupBindRows)
</ins><span class="cx">
</span><span class="cx"> yield self._updateBindColumnsQuery(columnMap).on(
</span><span class="cx"> self._txn,
</span><span class="cx"> resourceID=self._resourceID,
</span><del>- homeID=shareeView.addressbook().viewerHome()._resourceID
</del><ins>+ homeID=shareeView.viewerHome()._resourceID
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> # update affected attributes
</span><del>- if mode is not None:
</del><ins>+ if bind.BIND_MODE in columnMap:
</ins><span class="cx"> shareeView._bindMode = columnMap[bind.BIND_MODE]
</span><span class="cx">
</span><del>- if status is not None:
</del><ins>+ if bind.BIND_STATUS in columnMap:
</ins><span class="cx"> shareeView._bindStatus = columnMap[bind.BIND_STATUS]
</span><span class="cx"> if shareeView._bindStatus == _BIND_STATUS_ACCEPTED:
</span><span class="cx"> if 0 == previouslyAcceptedBindCount:
</span><span class="cx"> yield shareeView.addressbook()._initSyncToken()
</span><del>- yield shareeView._initBindRevision()
- shareeView.viewerHome()._children[shareeView.addressbook().name()] = shareeView.addressbook()
- shareeView.viewerHome()._children[shareeView.addressbook().id()] = shareeView.addressbook()
- elif shareeView._bindStatus != _BIND_STATUS_INVITED:
</del><ins>+ shareeView.viewerHome()._children[self.addressbook().ownerHome().uid()] = shareeView.addressbook()
+ shareeView.viewerHome()._children[shareeView._resourceID] = shareeView.addressbook()
+ yield shareeView._initBindRevision()
+ elif shareeView._bindStatus == _BIND_STATUS_DECLINED:
</ins><span class="cx"> if 1 == previouslyAcceptedBindCount:
</span><span class="cx"> yield shareeView.addressbook()._deletedSyncToken(sharedRemoval=True)
</span><del>- shareeView.viewerHome()._children.pop(shareeView.addressbook().name(), None)
- shareeView.viewerHome()._children.pop(shareeView.addressbook().id(), None)
</del><ins>+ shareeView.viewerHome()._children.pop(self.addressbook().ownerHome().uid(), None)
+ shareeView.viewerHome()._children.pop(shareeView._resourceID, None)
+ else:
+ # update revision in all remaining bind table rows for this address book
+ yield shareeView.addressbook().notifyPropertyChanged()
+ for groupBindRow in groupBindRows:
+ if groupBindRow[2] != shareeView._resourceID:
+ groupObject = yield shareeView.addressbook().objectResourceWithID(groupBindRow[2])
+ yield groupObject._initBindRevision()
+ if shareeView.addressbook().fullyShared():
+ yield shareeView.addressbook()._initBindRevision()
+ shareeView.addressbook()._objects = {}
+ shareeView.addressbook()._objectNames = None
</ins><span class="cx">
</span><del>- if summary is not None:
</del><ins>+ if bind.MESSAGE in columnMap:
</ins><span class="cx"> shareeView._bindMessage = columnMap[bind.MESSAGE]
</span><span class="cx">
</span><ins>+ # safer to just invalidate in all cases rather than calculate when to invalidate
+ queryCacher = self._txn._queryCacher
+ if queryCacher:
+ cacheKey = queryCacher.keyForObjectWithName(shareeView.viewerHome()._resourceID, self.addressbook().ownerHome().uid())
+ queryCacher.invalidateAfterCommit(self._txn, cacheKey)
+
</ins><span class="cx"> # Must send notification to ensure cache invalidation occurs
</span><del>- yield self.notifyChanged()
</del><ins>+ yield self.addressbook().notifyPropertyChanged()
+ yield shareeView.viewerHome().notifyChanged()
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -1323,41 +1639,37 @@
</span><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> shareeHome = shareeView.addressbook().viewerHome()
</span><del>- sharedAddressBook = yield shareeHome.addressbookWithName(self.addressbook().name())
</del><ins>+ addressbookAsShared = yield shareeHome.addressbookWithName(self.addressbook().ownerHome().uid())
+ if addressbookAsShared:
</ins><span class="cx">
</span><del>- if sharedAddressBook:
-
- acceptedBindCount = 1 if sharedAddressBook.fullyShared() else 0
- acceptedBindCount += len((
- yield AddressBookObject._acceptedBindForHomeIDAndAddressBookID.on(
- self._txn, homeID=shareeHome._resourceID, addressbookID=sharedAddressBook._resourceID
- )
- ))
-
</del><ins>+ acceptedBindCount = 1 if addressbookAsShared.fullyShared() else 0
+ groupBindRows = yield AddressBookObject._acceptedBindForHomeIDAndAddressBookID.on(
+ self._txn, homeID=shareeHome._resourceID, addressbookID=addressbookAsShared._resourceID
+ )
+ acceptedBindCount += len(groupBindRows)
</ins><span class="cx"> if acceptedBindCount == 1:
</span><del>- yield sharedAddressBook._deletedSyncToken(sharedRemoval=True)
- shareeHome._children.pop(shareeView.addressbook().name(), None)
- shareeHome._children.pop(shareeView.addressbook().id(), None)
</del><ins>+ yield addressbookAsShared._deletedSyncToken(sharedRemoval=True)
+ shareeHome._children.pop(self.ownerHome().uid(), None)
+ shareeHome._children.pop(addressbookAsShared._resourceID, None)
+ else:
+ yield addressbookAsShared.notifyPropertyChanged()
+ #update revision in all remaining bind table rows for this address book
+ for groupBindRow in groupBindRows:
+ groupObject = yield addressbookAsShared.objectResourceWithID(groupBindRow[2])
+ yield groupObject._initBindRevision()
+ addressbookAsShared._objects = {}
+ addressbookAsShared._objectNames = None
</ins><span class="cx">
</span><span class="cx"> # Must send notification to ensure cache invalidation occurs
</span><del>- yield self.notifyChanged()
</del><ins>+ yield self.notifyPropertyChanged()
+ yield shareeHome.notifyChanged()
</ins><span class="cx">
</span><del>- # Must send notification to ensure cache invalidation occurs
- yield self.notifyChanged()
-
- # delete binds including invites
- yield self._deleteBindForResourceIDAndHomeID.on(
- self._txn,
- resourceID=self._resourceID,
- homeID=shareeHome._resourceID,
</del><ins>+ # delete bind table rows for this share
+ yield self._deleteBindForResourceIDAndHomeID.on(self._txn,
+ resourceID=self._resourceID, homeID=shareeHome._resourceID
</ins><span class="cx"> )
</span><span class="cx">
</span><del>- queryCacher = self._txn._queryCacher
- if queryCacher:
- cacheKey = queryCacher.keyForObjectWithName(shareeHome._resourceID, self.addressbook().name())
- queryCacher.invalidateAfterCommit(self._txn, cacheKey)
</del><span class="cx">
</span><del>-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def sharingInvites(self):
</span><span class="cx"> """
</span><span class="lines">@@ -1411,7 +1723,7 @@
</span><span class="cx"> """
</span><span class="cx"> @see: L{ICalendar.shareUID}
</span><span class="cx"> """
</span><del>- return self._bindName if self._bindName else self._name
</del><ins>+ return self._bindName
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1440,6 +1752,7 @@
</span><span class="cx"> self._bindStatus = None
</span><span class="cx"> self._bindMessage = None
</span><span class="cx"> self._bindName = None
</span><ins>+ self._bindRevision = None
</ins><span class="cx"> super(AddressBookObject, self).__init__(addressbook, name, uid, resourceID, options)
</span><span class="cx"> self._options = {} if options is None else options
</span><span class="cx">
</span><span class="lines">@@ -1465,15 +1778,6 @@
</span><span class="cx"> return self._resourceID == self.addressbook()._resourceID
</span><span class="cx">
</span><span class="cx">
</span><del>- @classmethod
- def _deleteMembersWithMemberIDAndGroupIDsQuery(cls, memberID, groupIDs):
- aboMembers = schema.ABO_MEMBERS
- return Delete(
- aboMembers,
- Where=(aboMembers.MEMBER_ID == memberID).And(
- aboMembers.GROUP_ID.In(Parameter("groupIDs", len(groupIDs)))))
-
-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def remove(self):
</span><span class="cx">
</span><span class="lines">@@ -1481,44 +1785,94 @@
</span><span class="cx"> yield self.unshare() # storebridge should already have done this
</span><span class="cx"> else:
</span><span class="cx"> # handled in storebridge as unshare, should not be here. assert instead?
</span><del>- if self.isGroupForSharedAddressBook() or self._bindMode is not None:
</del><ins>+ if self.isGroupForSharedAddressBook() or self.shareUID():
</ins><span class="cx"> raise HTTPError(FORBIDDEN)
</span><span class="cx">
</span><del>- if not self.owned() and not self.addressbook().fullyShared():
- readWriteObjectIDs = []
</del><ins>+ partiallyShared = not self.owned() and not self.addressbook().fullyShared()
+ if partiallyShared:
</ins><span class="cx"> readWriteGroupIDs = yield self.addressbook().readWriteGroupIDs()
</span><del>- if readWriteGroupIDs:
- readWriteObjectIDs = yield self.addressbook().expandGroupIDs(self._txn, readWriteGroupIDs)
-
- # can't delete item in shared group, even if user has addressbook unbind
</del><ins>+ readWriteObjectIDs = (
+ set((yield self.addressbook().expandGroupIDs(self._txn, readWriteGroupIDs)))
+ if readWriteGroupIDs else set()
+ )
+ # can't delete item in read-only shared group, even if user has addressbook unbind
</ins><span class="cx"> if self._resourceID not in readWriteObjectIDs:
</span><span class="cx"> raise HTTPError(FORBIDDEN)
</span><span class="cx">
</span><del>- # convert delete in sharee shared group address book to remove of memberships
- # that make this object visible to the sharee
- if readWriteObjectIDs:
- yield self._deleteMembersWithMemberIDAndGroupIDsQuery(self._resourceID, readWriteObjectIDs).on(
- self._txn, groupIDs=readWriteObjectIDs
- )
</del><ins>+ # get sync token for delete now
+ yield self.addressbook()._deleteRevision(self.name(), self._resourceID)
</ins><span class="cx">
</span><ins>+ # get groups where this object was once a member and version info
</ins><span class="cx"> aboMembers = schema.ABO_MEMBERS
</span><del>- aboForeignMembers = schema.ABO_FOREIGN_MEMBERS
-
- groupIDRows = yield Delete(
- aboMembers,
</del><ins>+ groupRows = yield Select([aboMembers.GROUP_ID, aboMembers.MEMBER_ID, aboMembers.REMOVED, aboMembers.REVISION],
+ From=aboMembers,
</ins><span class="cx"> Where=aboMembers.MEMBER_ID == self._resourceID,
</span><del>- Return=aboMembers.GROUP_ID
</del><span class="cx"> ).on(self._txn)
</span><span class="cx">
</span><del>- # add to foreign member table row by UID (aboForeignMembers on address books)
</del><ins>+ # combine by groupID
+ groupIDToMemberRowMap = {}
+ for groupID, id, removed, revision in groupRows:
+ memberRow = groupIDToMemberRowMap.get(groupID, [])
+ memberRow.append((id, removed, revision))
+ groupIDToMemberRowMap[groupID] = memberRow
+
+ # see if this object is in current version
+ groupIDs = set([
+ groupID for groupID, memberRows in groupIDToMemberRowMap.iteritems()
+ if self._resourceID in AddressBook._currentMemberIDsFromMemberIDRemovedRevisionRows(memberRows)
+ ])
+
+ if partiallyShared:
+ groupIDsToRemoveFrom = groupIDs & readWriteObjectIDs
+ groupIDs -= readWriteObjectIDs
+
+ # add to member table rows marked removed
+ for groupIDToRemoveFrom in groupIDsToRemoveFrom:
+ yield self._insertMemberIDQuery.on(self._txn,
+ groupID=groupIDToRemoveFrom,
+ addressbookID=self._ownerAddressBookResourceID,
+ memberID=self._resourceID,
+ revision=self._syncTokenRevision,
+ removed=True,
+ )
+ groupObject = yield self.addressbook().objectResourceWithID(groupIDToRemoveFrom)
+ yield self.addressbook()._updateRevision(groupObject.name())
+
+ else:
+ yield Delete(
+ aboMembers,
+ Where=aboMembers.MEMBER_ID == self._resourceID,
+ ).on(self._txn)
+
+ # add to foreign member table row by member address (aboForeignMembers on address books)
</ins><span class="cx"> memberAddress = "urn:uuid:" + self._uid
</span><del>- for groupID in set([groupIDRow[0] for groupIDRow in groupIDRows]) - set([self._ownerAddressBookResourceID]):
</del><ins>+ aboForeignMembers = schema.ABO_FOREIGN_MEMBERS
+ for groupID in groupIDs:
</ins><span class="cx"> yield Insert(
</span><span class="cx"> {aboForeignMembers.GROUP_ID: groupID,
</span><span class="cx"> aboForeignMembers.ADDRESSBOOK_ID: self._ownerAddressBookResourceID,
</span><span class="cx"> aboForeignMembers.MEMBER_ADDRESS: memberAddress, }
</span><span class="cx"> ).on(self._txn)
</span><span class="cx">
</span><ins>+ if self.kind() == _ABO_KIND_GROUP:
+ if partiallyShared:
+ # mark members as deleted
+ memberIDsToRemove = yield AddressBook.memberIDsWithGroupIDs(self._txn, [self._resourceID])
+ for memberIDToRemove in memberIDsToRemove:
+ yield self._insertMemberIDQuery.on(
+ self._txn,
+ groupID=self._resourceID,
+ addressbookID=self._ownerAddressBookResourceID,
+ memberID=memberIDToRemove,
+ revision=self._syncTokenRevision,
+ removed=True,
+ )
+ else:
+ yield Delete(
+ aboMembers,
+ Where=aboMembers.GROUP_ID == self._resourceID,
+ ).on(self._txn)
+
</ins><span class="cx"> yield super(AddressBookObject, self).remove()
</span><span class="cx"> self._kind = None
</span><span class="cx"> self._ownerAddressBookResourceID = None
</span><span class="lines">@@ -1539,8 +1893,8 @@
</span><span class="cx">
</span><span class="cx"> # Otherwise, must be in a read-write group
</span><span class="cx"> readWriteGroupIDs = yield self.addressbook().readWriteGroupIDs()
</span><del>- readWriteIDs = yield self.addressbook().expandGroupIDs(self._txn, readWriteGroupIDs)
- returnValue(self._resourceID in readWriteIDs)
</del><ins>+ readWriteObjectIDs = yield self.addressbook().expandGroupIDs(self._txn, readWriteGroupIDs)
+ returnValue(self._resourceID in readWriteObjectIDs)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @classmethod
</span><span class="lines">@@ -1656,10 +2010,8 @@
</span><span class="cx"> resourceIDs=allowedObjectIDs,
</span><span class="cx"> ))
</span><span class="cx"> elif self._resourceID:
</span><del>- if self._resourceID not in allowedObjectIDs:
- # allow invited groups
- allowedObjectIDs = yield self.addressbook().unacceptedGroupIDs()
- if self._resourceID in allowedObjectIDs:
</del><ins>+ if (self._resourceID in allowedObjectIDs or
+ self._resourceID in (yield self.addressbook().unacceptedGroupIDs())): # allow invited groups
</ins><span class="cx"> rows = (yield self._allColumnsWithResourceID.on(
</span><span class="cx"> self._txn, resourceID=self._resourceID,
</span><span class="cx"> ))
</span><span class="lines">@@ -1682,11 +2034,14 @@
</span><span class="cx"> self._bindStatus = bindStatus
</span><span class="cx"> self._bindMessage = bindMessage
</span><span class="cx"> self._bindName = bindName
</span><ins>+ self._bindRevision = bindRevision
</ins><span class="cx"> else:
</span><span class="cx"> invites = yield self.sharingInvites()
</span><span class="cx"> if len(invites):
</span><span class="cx"> self._bindMessage = "shared"
</span><span class="cx">
</span><ins>+ yield self._loadPropertyStore()
+
</ins><span class="cx"> returnValue(self)
</span><span class="cx"> else:
</span><span class="cx"> returnValue(None)
</span><span class="lines">@@ -1779,16 +2134,6 @@
</span><span class="cx"> returnValue(rows)
</span><span class="cx">
</span><span class="cx">
</span><del>- @inlineCallbacks
- def _changeAddressBookRevision(self, addressbook, inserting=False):
- if inserting:
- yield addressbook._insertRevision(self._name)
- else:
- yield addressbook._updateRevision(self._name)
-
- yield addressbook.notifyChanged()
-
-
</del><span class="cx"> # Stuff from put_addressbook_common
</span><span class="cx"> def fullValidation(self, component, inserting):
</span><span class="cx"> """
</span><span class="lines">@@ -1799,7 +2144,14 @@
</span><span class="cx">
</span><span class="cx"> # Valid data sizes
</span><span class="cx"> if config.MaxResourceSize:
</span><del>- vcardsize = len(str(component))
</del><ins>+ if self._componentResourceKindToKind(component) == _ABO_KIND_GROUP:
+ thinGroup = deepcopy(component)
+ thinGroup.removeProperties("X-ADDRESSBOOKSERVER-MEMBER")
+ thinGroup.removeProperties("X-ADDRESSBOOKSERVER-KIND")
+ thinGroup.removeProperties("UID")
+ vcardsize = len(str(thinGroup))
+ else:
+ vcardsize = len(str(component))
</ins><span class="cx"> if vcardsize > config.MaxResourceSize:
</span><span class="cx"> raise ObjectResourceTooBigError()
</span><span class="cx">
</span><span class="lines">@@ -1878,30 +2230,22 @@
</span><span class="cx">
</span><span class="cx"> self._componentChanged = False
</span><span class="cx">
</span><del>- # Handle all validation operations here.
- self.fullValidation(component, inserting)
</del><ins>+ if "coaddedUIDs" not in self._options:
+ # Handle all validation operations here.
+ self.fullValidation(component, inserting)
</ins><span class="cx">
</span><del>- # UID lock - this will remain active until the end of the current txn
- if not inserting or self._options.get("coaddedUIDs") is None:
</del><ins>+ # UID lock - this will remain active until the end of the current txn
</ins><span class="cx"> yield self._lockUID(component, inserting)
</span><span class="cx">
</span><ins>+ if inserting:
+ yield self.addressbook()._insertRevision(self._name)
+ else:
+ yield self.addressbook()._updateRevision(self._name)
+
+ yield self.addressbook().notifyChanged()
+
</ins><span class="cx"> yield self.updateDatabase(component, inserting=inserting)
</span><del>- yield self._changeAddressBookRevision(self._addressbook, inserting)
</del><span class="cx">
</span><del>- if self.owned():
- # update revision table of the sharee group address book
- if self._kind == _ABO_KIND_GROUP: # optimization
- invites = yield self.sharingInvites()
- for invite in invites:
- shareeHome = (yield self._txn.homeWithResourceID(self.addressbook()._home._homeType, invite.shareeHomeID))
- yield self._changeAddressBookRevision(shareeHome.addressbook(), inserting)
- # one is enough because all have the same resourceID
- break
- else:
- if self.addressbook()._resourceID != self._ownerAddressBookResourceID:
- # update revisions table of shared group's containing address book
- yield self._changeAddressBookRevision(self.ownerHome().addressbook(), inserting)
-
</del><span class="cx"> returnValue(self._componentChanged)
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1935,7 +2279,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @classproperty
</span><del>- def _insertABObject(cls): #@NoSelf
</del><ins>+ def _insertABObjectQuery(cls): #@NoSelf
</ins><span class="cx"> """
</span><span class="cx"> DAL statement to create an addressbook object with all default values.
</span><span class="cx"> """
</span><span class="lines">@@ -1954,6 +2298,43 @@
</span><span class="cx"> abo.MODIFIED))
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @classproperty
+ def _insertMemberIDQuery(cls): #@NoSelf
+ """
+ DAL statement to add a member table row
+ """
+ aboMembers = schema.ABO_MEMBERS
+ return Insert(
+ {aboMembers.GROUP_ID: Parameter("groupID"),
+ aboMembers.ADDRESSBOOK_ID: Parameter("addressbookID"),
+ aboMembers.MEMBER_ID: Parameter("memberID"),
+ aboMembers.REVISION: Parameter("revision"),
+ aboMembers.REMOVED: Parameter("removed"),
+ }
+ )
+
+
+ @classmethod
+ def _deleteMembersIDsThruRevisionQuery(cls, groupIDs, memberIDs):
+ """
+ DAL statement deletes rows with groupsIDs and memberIDs < revision
+
+ Note: Used after adding a member row in an owned address book, where only the last revision is needed.
+ Could be used after adding a member row to a partially shared address book if the
+ minimum valid revision is known.
+ "minimum valid revision" is the max of the bind revisions on a home over all
+ shared address books that have group binds.
+ """
+ aboMembers = schema.ABO_MEMBERS
+ return Delete(
+ aboMembers,
+ Where=(aboMembers.GROUP_ID.In(Parameter("groupIDs", len(groupIDs)))).And(
+ aboMembers.GROUP_ID.In(Parameter("memberIDs", len(memberIDs)))).And(
+ aboMembers.REVISION < Parameter("revision")
+ )
+ )
+
+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def updateDatabase(self, component, expand_until=None, reCreate=False, #@UnusedVariable
</span><span class="cx"> inserting=False):
</span><span class="lines">@@ -2000,7 +2381,7 @@
</span><span class="cx"> if not self.owned() and not self.addressbook().fullyShared():
</span><span class="cx"> # in partially shared addressbook, all members UIDs must be inside the shared groups
</span><span class="cx"> # except during bulk operations, when other UIDs added are OK
</span><del>- coaddedUIDs = set() if self._options.get("coaddedUIDs") is None else self._options["coaddedUIDs"]
</del><ins>+ coaddedUIDs = self._options.get("coaddedUIDs", set())
</ins><span class="cx"> if missingUIDs - coaddedUIDs:
</span><span class="cx"> raise GroupWithUnsharedAddressNotAllowedError(missingUIDs)
</span><span class="cx">
</span><span class="lines">@@ -2015,16 +2396,16 @@
</span><span class="cx">
</span><span class="cx"> # sort unique members
</span><span class="cx"> component.removeProperties("X-ADDRESSBOOKSERVER-MEMBER")
</span><del>- for memberAddress in sorted(list(memberAddresses)): # sort unique
</del><ins>+ for memberAddress in sorted(memberAddresses):
</ins><span class="cx"> component.addProperty(Property("X-ADDRESSBOOKSERVER-MEMBER", memberAddress))
</span><span class="cx"> componentText = str(component)
</span><span class="cx">
</span><span class="cx"> # remove unneeded fields to get stored _objectText
</span><del>- thinComponent = deepcopy(component)
- thinComponent.removeProperties("X-ADDRESSBOOKSERVER-MEMBER")
- thinComponent.removeProperties("X-ADDRESSBOOKSERVER-KIND")
- thinComponent.removeProperties("UID")
- self._objectText = str(thinComponent)
</del><ins>+ thinGroup = deepcopy(component)
+ thinGroup.removeProperties("X-ADDRESSBOOKSERVER-MEMBER")
+ thinGroup.removeProperties("X-ADDRESSBOOKSERVER-KIND")
+ thinGroup.removeProperties("UID")
+ self._objectText = str(thinGroup)
</ins><span class="cx"> else:
</span><span class="cx"> componentText = str(component)
</span><span class="cx"> self._objectText = componentText
</span><span class="lines">@@ -2040,11 +2421,11 @@
</span><span class="cx">
</span><span class="cx"> abo = schema.ADDRESSBOOK_OBJECT
</span><span class="cx"> aboForeignMembers = schema.ABO_FOREIGN_MEMBERS
</span><del>- aboMembers = schema.ABO_MEMBERS
</del><ins>+ partiallyShared = not self.owned() and not self.addressbook().fullyShared()
</ins><span class="cx">
</span><span class="cx"> if inserting:
</span><span class="cx"> self._resourceID, self._created, self._modified = (
</span><del>- yield self._insertABObject.on(
</del><ins>+ yield self._insertABObjectQuery.on(
</ins><span class="cx"> self._txn,
</span><span class="cx"> addressbookResourceID=self._ownerAddressBookResourceID,
</span><span class="cx"> name=self._name,
</span><span class="lines">@@ -2055,28 +2436,39 @@
</span><span class="cx"> )
</span><span class="cx"> )[0]
</span><span class="cx">
</span><del>- # delete foreign members table row for this object
</del><ins>+ # delete foreign members table rows for this object
</ins><span class="cx"> groupIDRows = yield Delete(
</span><span class="cx"> aboForeignMembers,
</span><del>- # should this be scoped to the owner address book?
</del><span class="cx"> Where=aboForeignMembers.MEMBER_ADDRESS == "urn:uuid:" + self._uid,
</span><span class="cx"> Return=aboForeignMembers.GROUP_ID
</span><span class="cx"> ).on(self._txn)
</span><span class="cx"> groupIDs = set([groupIDRow[0] for groupIDRow in groupIDRows])
</span><span class="cx">
</span><del>- if not self.owned() and not self.addressbook().fullyShared():
</del><ins>+ # add this object to shared groups
+ if partiallyShared:
</ins><span class="cx"> readWriteGroupIDs = yield self.addressbook().readWriteGroupIDs()
</span><span class="cx"> assert readWriteGroupIDs, "no access"
</span><del>- groupIDs |= set(readWriteGroupIDs)
</del><ins>+ groupIDs |= readWriteGroupIDs
</ins><span class="cx">
</span><ins>+ for readWriteGroupID in readWriteGroupIDs:
+ groupObject = yield self.addressbook().objectResourceWithID(readWriteGroupID)
+ yield self.addressbook()._updateRevision(groupObject.name())
+
</ins><span class="cx"> # add to member table rows
</span><span class="cx"> for groupID in groupIDs:
</span><del>- yield Insert(
- {aboMembers.GROUP_ID: groupID,
- aboMembers.ADDRESSBOOK_ID: self._ownerAddressBookResourceID,
- aboMembers.MEMBER_ID: self._resourceID, }
- ).on(self._txn)
</del><ins>+ yield self._insertMemberIDQuery.on(self._txn,
+ groupID=groupID,
+ addressbookID=self._ownerAddressBookResourceID,
+ memberID=self._resourceID,
+ revision=self._syncTokenRevision,
+ removed=False,
+ )
</ins><span class="cx">
</span><ins>+ # clean old revisions
+ if groupIDs and not partiallyShared:
+ yield self._deleteMembersIDsThruRevisionQuery(groupIDs, [self._resourceID]).on(
+ self._txn, groupIDs=groupIDs, memberIDs=[self._resourceID], revision=self._syncTokenRevision)
+
</ins><span class="cx"> else:
</span><span class="cx"> self._modified = (yield Update(
</span><span class="cx"> {abo.VCARD_TEXT: self._objectText,
</span><span class="lines">@@ -2092,50 +2484,63 @@
</span><span class="cx"> memberIDs.append(self._resourceID)
</span><span class="cx">
</span><span class="cx"> # get current members
</span><del>- currentMemberRows = yield Select([aboMembers.MEMBER_ID],
- From=aboMembers,
- Where=aboMembers.GROUP_ID == self._resourceID,).on(self._txn)
- currentMemberIDs = [currentMemberRow[0] for currentMemberRow in currentMemberRows]
-
- memberIDsToDelete = set(currentMemberIDs) - set(memberIDs)
</del><ins>+ currentMemberIDs = yield AddressBook.memberIDsWithGroupIDs(self._txn, [self._resourceID])
+ memberIDsToRemove = set(currentMemberIDs) - set(memberIDs)
</ins><span class="cx"> memberIDsToAdd = set(memberIDs) - set(currentMemberIDs)
</span><span class="cx">
</span><del>- if memberIDsToDelete:
- yield self._deleteMembersWithGroupIDAndMemberIDsQuery(self._resourceID, memberIDsToDelete).on(
- self._txn, memberIDs=memberIDsToDelete
</del><ins>+ for memberID in memberIDsToAdd:
+ yield self._insertMemberIDQuery.on(
+ self._txn,
+ groupID=self._resourceID,
+ addressbookID=self._ownerAddressBookResourceID,
+ memberID=memberID,
+ revision=self._syncTokenRevision,
+ removed=False,
</ins><span class="cx"> )
</span><span class="cx">
</span><del>- for memberIDToAdd in memberIDsToAdd:
- yield Insert(
- {aboMembers.GROUP_ID: self._resourceID,
- aboMembers.ADDRESSBOOK_ID: self._ownerAddressBookResourceID,
- aboMembers.MEMBER_ID: memberIDToAdd, }
- ).on(self._txn)
</del><ins>+ if partiallyShared:
+ for memberID in memberIDsToRemove:
+ yield self._insertMemberIDQuery.on(
+ self._txn,
+ groupID=self._resourceID,
+ addressbookID=self._ownerAddressBookResourceID,
+ memberID=memberID,
+ revision=self._syncTokenRevision,
+ removed=True,
+ )
+ else:
+ # clean old revisions
+ if memberIDsToAdd:
+ yield self._deleteMembersIDsThruRevisionQuery([self._resourceID], memberIDsToAdd).on(
+ self._txn, groupIDs=[self._resourceID], memberIDs=memberIDsToAdd, revision=self._syncTokenRevision)
</ins><span class="cx">
</span><del>- # don't bother with aboForeignMembers on address books
- if self._resourceID != self._ownerAddressBookResourceID:
</del><ins>+ if memberIDsToRemove:
+ yield self._deleteMembersWithGroupIDAndMemberIDsQuery(self._resourceID, memberIDsToRemove).on(
+ self._txn, memberIDs=memberIDsToRemove
+ )
</ins><span class="cx">
</span><del>- # get current foreign members
- currentForeignMemberRows = yield Select(
- [aboForeignMembers.MEMBER_ADDRESS],
- From=aboForeignMembers,
- Where=aboForeignMembers.GROUP_ID == self._resourceID,).on(self._txn)
- currentForeignMemberAddrs = [currentForeignMemberRow[0] for currentForeignMemberRow in currentForeignMemberRows]
</del><ins>+ # get current foreign members
+ currentForeignMemberRows = yield Select(
+ [aboForeignMembers.MEMBER_ADDRESS],
+ From=aboForeignMembers,
+ Where=aboForeignMembers.GROUP_ID == self._resourceID,
+ ).on(self._txn)
+ currentForeignMemberAddrs = [currentForeignMemberRow[0] for currentForeignMemberRow in currentForeignMemberRows]
</ins><span class="cx">
</span><del>- foreignMemberAddrsToDelete = set(currentForeignMemberAddrs) - set(foreignMemberAddrs)
- foreignMemberAddrsToAdd = set(foreignMemberAddrs) - set(currentForeignMemberAddrs)
</del><ins>+ foreignMemberAddrsToDelete = set(currentForeignMemberAddrs) - set(foreignMemberAddrs)
+ foreignMemberAddrsToAdd = set(foreignMemberAddrs) - set(currentForeignMemberAddrs)
</ins><span class="cx">
</span><del>- if foreignMemberAddrsToDelete:
- yield self._deleteForeignMembersWithGroupIDAndMembeAddrsQuery(self._resourceID, foreignMemberAddrsToDelete).on(
- self._txn, memberAddrs=foreignMemberAddrsToDelete
- )
</del><ins>+ if foreignMemberAddrsToDelete:
+ yield self._deleteForeignMembersWithGroupIDAndMembeAddrsQuery(self._resourceID, foreignMemberAddrsToDelete).on(
+ self._txn, memberAddrs=foreignMemberAddrsToDelete
+ )
</ins><span class="cx">
</span><del>- for foreignMemberAddrToAdd in foreignMemberAddrsToAdd:
- yield Insert(
- {aboForeignMembers.GROUP_ID: self._resourceID,
- aboForeignMembers.ADDRESSBOOK_ID: self._ownerAddressBookResourceID,
- aboForeignMembers.MEMBER_ADDRESS: foreignMemberAddrToAdd, }
- ).on(self._txn)
</del><ins>+ for foreignMemberAddrToAdd in foreignMemberAddrsToAdd:
+ yield Insert(
+ {aboForeignMembers.GROUP_ID: self._resourceID,
+ aboForeignMembers.ADDRESSBOOK_ID: self._ownerAddressBookResourceID,
+ aboForeignMembers.MEMBER_ADDRESS: foreignMemberAddrToAdd, }
+ ).on(self._txn)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -2177,13 +2582,7 @@
</span><span class="cx">
</span><span class="cx"> # generate "X-ADDRESSBOOKSERVER-MEMBER" properties
</span><span class="cx"> # first get member resource ids
</span><del>- aboMembers = schema.ABO_MEMBERS
- memberRows = yield Select(
- [aboMembers.MEMBER_ID],
- From=aboMembers,
- Where=aboMembers.GROUP_ID == self._resourceID,
- ).on(self._txn)
- memberIDs = [memberRow[0] for memberRow in memberRows]
</del><ins>+ memberIDs = yield AddressBook.memberIDsWithGroupIDs(self._txn, [self._resourceID])
</ins><span class="cx">
</span><span class="cx"> # then get member UIDs
</span><span class="cx"> abo = schema.ADDRESSBOOK_OBJECT
</span><span class="lines">@@ -2266,10 +2665,6 @@
</span><span class="cx"> ).And(bind.BIND_STATUS == _BIND_STATUS_ACCEPTED))
</span><span class="cx">
</span><span class="cx">
</span><del>- def notifyChanged(self):
- return self.addressbook().notifyChanged()
-
-
</del><span class="cx"> def notifyPropertyChanged(self):
</span><span class="cx"> """
</span><span class="cx"> Send notifications when properties on this object change.
</span></span></pre></div>
<a id="CalendarServertrunktxdavcarddavdatastoretesttest_sqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> from txdav.common.datastore.sql import EADDRESSBOOKTYPE, CommonObjectResource
</span><span class="cx"> from txdav.common.datastore.sql_tables import _ABO_KIND_PERSON, _ABO_KIND_GROUP, schema
</span><span class="cx"> from txdav.common.datastore.test.util import buildStore
</span><ins>+from txdav.carddav.datastore.sql import AddressBook
</ins><span class="cx">
</span><span class="cx"> from txdav.xml.rfc2518 import GETContentLanguage, ResourceType
</span><span class="cx">
</span><span class="lines">@@ -572,11 +573,11 @@
</span><span class="cx"> )
</span><span class="cx"> groupObject = yield adbk.createAddressBookObjectWithName("g.vcf", group)
</span><span class="cx">
</span><del>- aboForeignMembers = schema.ABO_FOREIGN_MEMBERS
</del><span class="cx"> aboMembers = schema.ABO_MEMBERS
</span><del>- memberRows = yield Select([aboMembers.GROUP_ID, aboMembers.MEMBER_ID], From=aboMembers,).on(txn)
</del><ins>+ memberRows = yield Select([aboMembers.GROUP_ID, aboMembers.MEMBER_ID], From=aboMembers, Where=aboMembers.REMOVED == False).on(txn)
</ins><span class="cx"> self.assertEqual(memberRows, [])
</span><span class="cx">
</span><ins>+ aboForeignMembers = schema.ABO_FOREIGN_MEMBERS
</ins><span class="cx"> foreignMemberRows = yield Select([aboForeignMembers.GROUP_ID, aboForeignMembers.MEMBER_ADDRESS], From=aboForeignMembers).on(txn)
</span><span class="cx"> self.assertEqual(foreignMemberRows, [[groupObject._resourceID, "urn:uuid:uid3"]])
</span><span class="cx">
</span><span class="lines">@@ -595,7 +596,7 @@
</span><span class="cx"> )
</span><span class="cx"> subgroupObject = yield adbk.createAddressBookObjectWithName("sg.vcf", subgroup)
</span><span class="cx">
</span><del>- memberRows = yield Select([aboMembers.GROUP_ID, aboMembers.MEMBER_ID], From=aboMembers,).on(txn)
</del><ins>+ memberRows = yield Select([aboMembers.GROUP_ID, aboMembers.MEMBER_ID], From=aboMembers, Where=aboMembers.REMOVED == False).on(txn)
</ins><span class="cx"> self.assertEqual(sorted(memberRows), sorted([
</span><span class="cx"> [groupObject._resourceID, subgroupObject._resourceID],
</span><span class="cx"> [subgroupObject._resourceID, personObject._resourceID],
</span><span class="lines">@@ -605,12 +606,26 @@
</span><span class="cx"> self.assertEqual(foreignMemberRows, [])
</span><span class="cx">
</span><span class="cx"> yield subgroupObject.remove()
</span><del>- memberRows = yield Select([aboMembers.GROUP_ID, aboMembers.MEMBER_ID], From=aboMembers,).on(txn)
- self.assertEqual(memberRows, [])
</del><ins>+ memberRows = yield Select([aboMembers.GROUP_ID, aboMembers.MEMBER_ID, aboMembers.REMOVED, aboMembers.REVISION], From=aboMembers).on(txn)
</ins><span class="cx">
</span><del>- foreignMemberRows = yield Select([aboForeignMembers.GROUP_ID, aboForeignMembers.MEMBER_ADDRESS], From=aboForeignMembers,
- #Where=(aboForeignMembers.GROUP_ID == groupObject._resourceID),
- ).on(txn)
</del><ins>+ # combine by groupID
+ groupIDToMemberRowMap = {}
+ for groupID, id, removed, version in memberRows:
+ memberRow = groupIDToMemberRowMap.get(groupID, [])
+ memberRow.append((id, removed, version))
+ groupIDToMemberRowMap[groupID] = memberRow
+
+ # see if this object is in current version
+ groupIDs = set([
+ groupID for groupID, memberIDRemovedRevisionRows in groupIDToMemberRowMap.iteritems()
+ if AddressBook._currentMemberIDsFromMemberIDRemovedRevisionRows(memberIDRemovedRevisionRows)
+ ])
+
+ self.assertEqual(len(groupIDs), 0)
+
+ foreignMemberRows = yield Select(
+ [aboForeignMembers.GROUP_ID, aboForeignMembers.MEMBER_ADDRESS], From=aboForeignMembers,
+ ).on(txn)
</ins><span class="cx"> self.assertEqual(foreignMemberRows, [[groupObject._resourceID, "urn:uuid:uid3"]])
</span><span class="cx">
</span><span class="cx"> yield home.removeAddressBookWithName("addressbook")
</span></span></pre></div>
<a id="CalendarServertrunktxdavcarddavdatastoretesttest_sql_sharingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -1134,7 +1134,7 @@
</span><span class="cx"> otherAB = yield self.addressbookUnderTest(home="user02", name="user01")
</span><span class="cx"> self.assertNotEqual(otherAB._bindRevision, 0)
</span><span class="cx">
</span><del>- changed, deleted = yield otherAB.resourceNamesSinceRevision(otherAB._bindRevision - 1)
</del><ins>+ changed, deleted = yield otherAB.resourceNamesSinceRevision(0)
</ins><span class="cx"> self.assertNotEqual(len(changed), 0)
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span><span class="lines">@@ -1144,7 +1144,7 @@
</span><span class="cx">
</span><span class="cx"> otherHome = yield self.addressbookHomeUnderTest(name="user02")
</span><span class="cx"> for depth in ("1", "infinity",):
</span><del>- changed, deleted = yield otherHome.resourceNamesSinceRevision(otherAB._bindRevision - 1, depth)
</del><ins>+ changed, deleted = yield otherHome.resourceNamesSinceRevision(0, depth)
</ins><span class="cx"> self.assertNotEqual(len(changed), 0)
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span><span class="lines">@@ -1166,21 +1166,29 @@
</span><span class="cx"> otherAB = yield self.addressbookUnderTest(home="user02", name="user01")
</span><span class="cx"> self.assertNotEqual(otherAB._bindRevision, 0)
</span><span class="cx">
</span><del>- changed, deleted = yield otherAB.resourceNamesSinceRevision(otherAB._bindRevision - 1)
- self.assertNotEqual(len(changed), 0)
</del><ins>+ changed, deleted = yield otherAB.resourceNamesSinceRevision(0)
+ self.assertEqual(set(changed), set(['card1.vcf', 'card2.vcf', 'group1.vcf']))
</ins><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span><span class="cx"> changed, deleted = yield otherAB.resourceNamesSinceRevision(otherAB._bindRevision)
</span><span class="cx"> self.assertEqual(len(changed), 0)
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span><del>- otherHome = yield self.addressbookHomeUnderTest(name="user02")
- for depth in ("1", "infinity",):
- changed, deleted = yield otherHome.resourceNamesSinceRevision(otherAB._bindRevision - 1, depth)
- self.assertNotEqual(len(changed), 0)
</del><ins>+ for depth, result in (
+ ("1", ['addressbook/',
+ 'user01/', ]
+ ),
+ ("infinity", ['addressbook/',
+ 'user01/',
+ 'user01/card1.vcf',
+ 'user01/card2.vcf',
+ 'user01/group1.vcf']
+ )):
+ changed, deleted = yield otherAB.viewerHome().resourceNamesSinceRevision(0, depth)
+ self.assertEqual(set(changed), set(result))
</ins><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span><del>- changed, deleted = yield otherHome.resourceNamesSinceRevision(otherAB._bindRevision, depth)
</del><ins>+ changed, deleted = yield otherAB.viewerHome().resourceNamesSinceRevision(otherAB._bindRevision, depth)
</ins><span class="cx"> self.assertEqual(len(changed), 0)
</span><span class="cx"> self.assertEqual(len(deleted), 0)
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/sql.py (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/sql.py        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -72,7 +72,8 @@
</span><span class="cx"> HomeChildNameAlreadyExistsError, NoSuchHomeChildError, \
</span><span class="cx"> ObjectResourceNameNotAllowedError, ObjectResourceNameAlreadyExistsError, \
</span><span class="cx"> NoSuchObjectResourceError, AllRetriesFailed, InvalidSubscriptionValues, \
</span><del>- InvalidIMIPTokenValues, TooManyObjectResourcesError
</del><ins>+ InvalidIMIPTokenValues, TooManyObjectResourcesError, \
+ SyncTokenValidException
</ins><span class="cx"> from txdav.common.idirectoryservice import IStoreDirectoryService
</span><span class="cx"> from txdav.common.inotifications import INotificationCollection, \
</span><span class="cx"> INotificationObject
</span><span class="lines">@@ -2043,7 +2044,6 @@
</span><span class="cx"> changed = set()
</span><span class="cx"> deleted = set()
</span><span class="cx"> deleted_collections = set()
</span><del>- changed_collections = set()
</del><span class="cx"> for path, name, wasdeleted in results:
</span><span class="cx"> if wasdeleted:
</span><span class="cx"> if revision:
</span><span class="lines">@@ -2059,7 +2059,6 @@
</span><span class="cx"> deleted.add("%s/" % (path,))
</span><span class="cx"> deleted_collections.add(path)
</span><span class="cx">
</span><del>- for path, name, wasdeleted in results:
</del><span class="cx"> if path not in deleted_collections:
</span><span class="cx"> # Always report collection as changed
</span><span class="cx"> changed.add("%s/" % (path,))
</span><span class="lines">@@ -2067,47 +2066,15 @@
</span><span class="cx"> # Resource changed - for depth "infinity" report resource as changed
</span><span class="cx"> if depth != "1":
</span><span class="cx"> changed.add("%s/%s" % (path, name,))
</span><del>- else:
- # Collection was changed
- changed_collections.add(path)
</del><span class="cx">
</span><span class="cx"> # Now deal with shared collections
</span><span class="cx"> # TODO: think about whether this can be done in one query rather than looping over each share
</span><del>- rev = self._revisionsSchema
- shares = yield self.children()
- for share in shares:
</del><ins>+ for share in (yield self.children()):
</ins><span class="cx"> if not share.owned():
</span><del>- sharerevision = 0 if revision < share._bindRevision else revision
- results = [
- (
- share.name(),
- name if name else "",
- wasdeleted
- )
- for name, wasdeleted in
- (yield Select([rev.RESOURCE_NAME, rev.DELETED],
- From=rev,
- Where=(rev.REVISION > sharerevision).And(
- rev.RESOURCE_ID == share._resourceID)).on(self._txn))
- if name
- ]
</del><ins>+ sharedChanged, sharedDeleted = yield share.sharedChildResourceNamesSinceRevision(revision, depth)
+ changed |= sharedChanged
+ deleted |= sharedDeleted
</ins><span class="cx">
</span><del>- for path, name, wasdeleted in results:
- if wasdeleted:
- if sharerevision:
- if depth == "1":
- changed.add("%s/" % (path,))
- else:
- deleted.add("%s/%s" % (path, name,))
-
- for path, name, wasdeleted in results:
- # Always report collection as changed
- changed.add("%s/" % (path,))
- if name:
- # Resource changed - for depth "infinity" report resource as changed
- if depth != "1":
- changed.add("%s/%s" % (path, name,))
-
</del><span class="cx"> changed = sorted(changed)
</span><span class="cx"> deleted = sorted(deleted)
</span><span class="cx"> returnValue((changed, deleted))
</span><span class="lines">@@ -2760,6 +2727,7 @@
</span><span class="cx"> resourceID=self._resourceID, name=name)
</span><span class="cx"> )[0][0]
</span><span class="cx"> self._maybeNotify()
</span><ins>+ returnValue(self._syncTokenRevision)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def _maybeNotify(self):
</span><span class="lines">@@ -3230,9 +3198,6 @@
</span><span class="cx"> @param summary: The proposed message to go along with the share, which
</span><span class="cx"> will be used as the default display name, or None to not update
</span><span class="cx"> @type summary: L{str}
</span><del>-
- @return: the name of the shared item in the sharee's home.
- @rtype: a L{Deferred} which fires with a L{str}
</del><span class="cx"> """
</span><span class="cx"> # TODO: raise a nice exception if shareeView is not, in fact, a shared
</span><span class="cx"> # version of this same L{CommonHomeChild}
</span><span class="lines">@@ -3245,7 +3210,7 @@
</span><span class="cx"> bind.MESSAGE:summary
</span><span class="cx"> }.iteritems() if v is not None])
</span><span class="cx">
</span><del>- if len(columnMap):
</del><ins>+ if columnMap:
</ins><span class="cx">
</span><span class="cx"> # Count accepted
</span><span class="cx"> if status is not None:
</span><span class="lines">@@ -3257,10 +3222,10 @@
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> # Update affected attributes
</span><del>- if mode is not None:
</del><ins>+ if bind.BIND_MODE in columnMap:
</ins><span class="cx"> shareeView._bindMode = columnMap[bind.BIND_MODE]
</span><span class="cx">
</span><del>- if status is not None:
</del><ins>+ if bind.BIND_STATUS in columnMap:
</ins><span class="cx"> shareeView._bindStatus = columnMap[bind.BIND_STATUS]
</span><span class="cx"> yield shareeView._changedStatus(previouslyAcceptedCount)
</span><span class="cx">
</span><span class="lines">@@ -3385,6 +3350,7 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def _initBindRevision(self):
</span><ins>+ yield self.syncToken() # init self._syncTokenRevision if None
</ins><span class="cx"> self._bindRevision = self._syncTokenRevision
</span><span class="cx">
</span><span class="cx"> bind = self._bindSchema
</span><span class="lines">@@ -4441,12 +4407,77 @@
</span><span class="cx"> @type revision: C{int}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- if revision < self._bindRevision:
- revision = 0
</del><ins>+ if revision != 0 and revision < self._bindRevision:
+ raise SyncTokenValidException
+
</ins><span class="cx"> return super(CommonHomeChild, self).resourceNamesSinceRevision(revision)
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><ins>+ def sharedChildResourceNamesSinceRevision(self, revision, depth):
+ """
+ Determine the list of child resources that have changed since the specified sync revision.
+ We do the same SQL query for both depth "1" and "infinity", but filter the results for
+ "1" to only account for a collection change.
+
+ We need to handle shared collection a little differently from owned ones. When a shared collection
+ is bound into a home we record a revision for it using the sharee home id and sharee collection name.
+ That revision is the "starting point" for changes: so if sync occurs with a revision earlier than
+ that, we return the list of all resources in the shared collection since they are all "new" as far
+ as the client is concerned since the shared collection has just appeared. For a later revision, we
+ just report the changes since that one. When a shared collection is removed from a home, we again
+ record a revision for the sharee home and sharee collection name with the "deleted" flag set. That way
+ the shared collection can be reported as removed.
+
+ @param revision: the sync revision to compare to
+ @type revision: C{str}
+ @param depth: depth for determine what changed
+ @type depth: C{str}
+ """
+ assert not self.owned()
+
+ if revision != 0 and revision < self._bindRevision:
+ if depth != '1':
+ raise SyncTokenValidException
+ else:
+ revision = 0
+
+ changed = set()
+ deleted = set()
+ rev = self._revisionsSchema
+ results = [
+ (
+ self.name(),
+ name if name else "",
+ wasdeleted
+ )
+ for name, wasdeleted in
+ (yield Select([rev.RESOURCE_NAME, rev.DELETED],
+ From=rev,
+ Where=(rev.REVISION > revision).And(
+ rev.RESOURCE_ID == self._resourceID)).on(self._txn))
+ if name
+ ]
+
+ for path, name, wasdeleted in results:
+ if wasdeleted:
+ if revision:
+ if depth == "1":
+ changed.add("%s/" % (path,))
+ else:
+ deleted.add("%s/%s" % (path, name,))
+
+ # Always report collection as changed
+ changed.add("%s/" % (path,))
+
+ # Resource changed - for depth "infinity" report resource as changed
+ if depth != "1":
+ changed.add("%s/%s" % (path, name,))
+
+ returnValue((changed, deleted))
+
+
+ @inlineCallbacks
</ins><span class="cx"> def _loadPropertyStore(self, props=None):
</span><span class="cx"> if props is None:
</span><span class="cx"> props = yield PropertyStore.load(
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoresql_schemacurrentoracledialectsql"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/current-oracle-dialect.sql        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -256,10 +256,12 @@
</span><span class="cx"> insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('resource', 2);
</span><span class="cx"> insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('location', 3);
</span><span class="cx"> create table ABO_MEMBERS (
</span><del>- "GROUP_ID" integer not null references ADDRESSBOOK_OBJECT on delete cascade,
</del><ins>+ "GROUP_ID" integer not null,
</ins><span class="cx"> "ADDRESSBOOK_ID" integer not null references ADDRESSBOOK_HOME on delete cascade,
</span><del>- "MEMBER_ID" integer not null references ADDRESSBOOK_OBJECT,
- primary key("GROUP_ID", "MEMBER_ID")
</del><ins>+ "MEMBER_ID" integer not null,
+ "REVISION" integer not null,
+ "REMOVED" integer default 0 not null,
+ primary key("GROUP_ID", "MEMBER_ID", "REVISION")
</ins><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> create table ABO_FOREIGN_MEMBERS (
</span><span class="lines">@@ -294,6 +296,7 @@
</span><span class="cx"> "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
</span><span class="cx"> "OWNER_HOME_RESOURCE_ID" integer references ADDRESSBOOK_HOME,
</span><span class="cx"> "ADDRESSBOOK_NAME" nvarchar2(255) default null,
</span><ins>+ "OBJECT_RESOURCE_ID" integer default 0,
</ins><span class="cx"> "RESOURCE_NAME" nvarchar2(255),
</span><span class="cx"> "REVISION" integer not null,
</span><span class="cx"> "DELETED" integer not null
</span><span class="lines">@@ -370,7 +373,7 @@
</span><span class="cx"> "VALUE" nvarchar2(255)
</span><span class="cx"> );
</span><span class="cx">
</span><del>-insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '29');
</del><ins>+insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '30');
</ins><span class="cx"> insert into CALENDARSERVER (NAME, VALUE) values ('CALENDAR-DATAVERSION', '5');
</span><span class="cx"> insert into CALENDARSERVER (NAME, VALUE) values ('ADDRESSBOOK-DATAVERSION', '2');
</span><span class="cx"> insert into CALENDARSERVER (NAME, VALUE) values ('NOTIFICATION-DATAVERSION', '1');
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoresql_schemacurrentsql"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql (12142 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql        2013-12-19 04:51:29 UTC (rev 12142)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/current.sql        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -454,16 +454,24 @@
</span><span class="cx"> insert into ADDRESSBOOK_OBJECT_KIND values (3, 'location');
</span><span class="cx">
</span><span class="cx">
</span><ins>+----------------------------------
+-- Revisions, forward reference --
+----------------------------------
+
+create sequence REVISION_SEQ;
+
</ins><span class="cx"> ---------------------------------
</span><span class="cx"> -- Address Book Object Members --
</span><span class="cx"> ---------------------------------
</span><span class="cx">
</span><span class="cx"> create table ABO_MEMBERS (
</span><del>- GROUP_ID integer not null references ADDRESSBOOK_OBJECT on delete cascade,        -- AddressBook Object's (kind=='group') RESOURCE_ID
</del><ins>+ GROUP_ID integer not null, -- references ADDRESSBOOK_OBJECT on delete cascade,        -- AddressBook Object's (kind=='group') RESOURCE_ID
</ins><span class="cx">         ADDRESSBOOK_ID                 integer not null references ADDRESSBOOK_HOME on delete cascade,
</span><del>- MEMBER_ID integer not null references ADDRESSBOOK_OBJECT,                                                -- member AddressBook Object's RESOURCE_ID
</del><ins>+ MEMBER_ID integer not null, -- references ADDRESSBOOK_OBJECT,                                                -- member AddressBook Object's RESOURCE_ID
+         REVISION integer default nextval('REVISION_SEQ') not null,
+         REMOVED boolean default false not null,
</ins><span class="cx">
</span><del>- primary key (GROUP_ID, MEMBER_ID) -- implicit index
</del><ins>+ primary key (GROUP_ID, MEMBER_ID, REVISION) -- implicit index
</ins><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> create index ABO_MEMBERS_ADDRESSBOOK_ID on
</span><span class="lines">@@ -502,7 +510,7 @@
</span><span class="cx"> MESSAGE                 text, -- FIXME: xml?
</span><span class="cx">
</span><span class="cx"> primary key (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_RESOURCE_ID), -- implicit index
</span><del>- unique (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_ADDRESSBOOK_NAME) -- implicit index
</del><ins>+ unique (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_ADDRESSBOOK_NAME) -- implicit index
</ins><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> create index SHARED_GROUP_BIND_RESOURCE_ID on
</span><span class="lines">@@ -513,7 +521,7 @@
</span><span class="cx"> -- Revisions --
</span><span class="cx"> ---------------
</span><span class="cx">
</span><del>-create sequence REVISION_SEQ;
</del><ins>+-- create sequence REVISION_SEQ;
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> -------------------------------
</span><span class="lines">@@ -547,6 +555,7 @@
</span><span class="cx"> ADDRESSBOOK_HOME_RESOURCE_ID                         integer                        not null references ADDRESSBOOK_HOME,
</span><span class="cx"> OWNER_HOME_RESOURCE_ID                         integer         references ADDRESSBOOK_HOME,
</span><span class="cx"> ADDRESSBOOK_NAME                         varchar(255)         default null,
</span><ins>+ OBJECT_RESOURCE_ID                                        integer                        default 0,
</ins><span class="cx"> RESOURCE_NAME                         varchar(255),
</span><span class="cx"> REVISION                         integer         default nextval('REVISION_SEQ') not null,
</span><span class="cx"> DELETED                         boolean         not null
</span><span class="lines">@@ -702,7 +711,7 @@
</span><span class="cx"> VALUE varchar(255)
</span><span class="cx"> );
</span><span class="cx">
</span><del>-insert into CALENDARSERVER values ('VERSION', '29');
</del><ins>+insert into CALENDARSERVER values ('VERSION', '30');
</ins><span class="cx"> insert into CALENDARSERVER values ('CALENDAR-DATAVERSION', '5');
</span><span class="cx"> insert into CALENDARSERVER values ('ADDRESSBOOK-DATAVERSION', '2');
</span><span class="cx"> insert into CALENDARSERVER values ('NOTIFICATION-DATAVERSION', '1');
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoresql_schemaoldoracledialectv29sqlfromrev12142CalendarServerbranchesusersgayasharedgroupfixestxdavcommondatastoresql_schemaoldoracledialectv29sql"></a>
<div class="copfile"><h4>Copied: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql (from rev 12142, CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql) (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql         (rev 0)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,505 @@
</span><ins>+create sequence RESOURCE_ID_SEQ;
+create sequence INSTANCE_ID_SEQ;
+create sequence ATTACHMENT_ID_SEQ;
+create sequence REVISION_SEQ;
+create sequence WORKITEM_SEQ;
+create table NODE_INFO (
+ "HOSTNAME" nvarchar2(255),
+ "PID" integer not null,
+ "PORT" integer not null,
+ "TIME" timestamp default CURRENT_TIMESTAMP at time zone 'UTC' not null,
+ primary key("HOSTNAME", "PORT")
+);
+
+create table NAMED_LOCK (
+ "LOCK_NAME" nvarchar2(255) primary key
+);
+
+create table CALENDAR_HOME (
+ "RESOURCE_ID" integer primary key,
+ "OWNER_UID" nvarchar2(255) unique,
+ "DATAVERSION" integer default 0 not null
+);
+
+create table CALENDAR (
+ "RESOURCE_ID" integer primary key
+);
+
+create table CALENDAR_HOME_METADATA (
+ "RESOURCE_ID" integer primary key references CALENDAR_HOME on delete cascade,
+ "QUOTA_USED_BYTES" integer default 0 not null,
+ "DEFAULT_EVENTS" integer default null references CALENDAR on delete set null,
+ "DEFAULT_TASKS" integer default null references CALENDAR on delete set null,
+ "DEFAULT_POLLS" integer default null references CALENDAR on delete set null,
+ "ALARM_VEVENT_TIMED" nclob default null,
+ "ALARM_VEVENT_ALLDAY" nclob default null,
+ "ALARM_VTODO_TIMED" nclob default null,
+ "ALARM_VTODO_ALLDAY" nclob default null,
+ "AVAILABILITY" nclob default null,
+ "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC'
+);
+
+create table CALENDAR_METADATA (
+ "RESOURCE_ID" integer primary key references CALENDAR on delete cascade,
+ "SUPPORTED_COMPONENTS" nvarchar2(255) default null,
+ "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC'
+);
+
+create table NOTIFICATION_HOME (
+ "RESOURCE_ID" integer primary key,
+ "OWNER_UID" nvarchar2(255) unique,
+ "DATAVERSION" integer default 0 not null
+);
+
+create table NOTIFICATION (
+ "RESOURCE_ID" integer primary key,
+ "NOTIFICATION_HOME_RESOURCE_ID" integer not null references NOTIFICATION_HOME,
+ "NOTIFICATION_UID" nvarchar2(255),
+ "NOTIFICATION_TYPE" nvarchar2(255),
+ "NOTIFICATION_DATA" nclob,
+ "MD5" nchar(32),
+ "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ unique("NOTIFICATION_UID", "NOTIFICATION_HOME_RESOURCE_ID")
+);
+
+create table CALENDAR_BIND (
+ "CALENDAR_HOME_RESOURCE_ID" integer not null references CALENDAR_HOME,
+ "CALENDAR_RESOURCE_ID" integer not null references CALENDAR on delete cascade,
+ "CALENDAR_RESOURCE_NAME" nvarchar2(255),
+ "BIND_MODE" integer not null,
+ "BIND_STATUS" integer not null,
+ "BIND_REVISION" integer default 0 not null,
+ "MESSAGE" nclob,
+ "TRANSP" integer default 0 not null,
+ "ALARM_VEVENT_TIMED" nclob default null,
+ "ALARM_VEVENT_ALLDAY" nclob default null,
+ "ALARM_VTODO_TIMED" nclob default null,
+ "ALARM_VTODO_ALLDAY" nclob default null,
+ "TIMEZONE" nclob default null,
+ primary key("CALENDAR_HOME_RESOURCE_ID", "CALENDAR_RESOURCE_ID"),
+ unique("CALENDAR_HOME_RESOURCE_ID", "CALENDAR_RESOURCE_NAME")
+);
+
+create table CALENDAR_BIND_MODE (
+ "ID" integer primary key,
+ "DESCRIPTION" nvarchar2(16) unique
+);
+
+insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('own', 0);
+insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('read', 1);
+insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('write', 2);
+insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('direct', 3);
+insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('indirect', 4);
+create table CALENDAR_BIND_STATUS (
+ "ID" integer primary key,
+ "DESCRIPTION" nvarchar2(16) unique
+);
+
+insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('invited', 0);
+insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('accepted', 1);
+insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('declined', 2);
+insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('invalid', 3);
+insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('deleted', 4);
+create table CALENDAR_TRANSP (
+ "ID" integer primary key,
+ "DESCRIPTION" nvarchar2(16) unique
+);
+
+insert into CALENDAR_TRANSP (DESCRIPTION, ID) values ('opaque', 0);
+insert into CALENDAR_TRANSP (DESCRIPTION, ID) values ('transparent', 1);
+create table CALENDAR_OBJECT (
+ "RESOURCE_ID" integer primary key,
+ "CALENDAR_RESOURCE_ID" integer not null references CALENDAR on delete cascade,
+ "RESOURCE_NAME" nvarchar2(255),
+ "ICALENDAR_TEXT" nclob,
+ "ICALENDAR_UID" nvarchar2(255),
+ "ICALENDAR_TYPE" nvarchar2(255),
+ "ATTACHMENTS_MODE" integer default 0 not null,
+ "DROPBOX_ID" nvarchar2(255),
+ "ORGANIZER" nvarchar2(255),
+ "RECURRANCE_MIN" date,
+ "RECURRANCE_MAX" date,
+ "ACCESS" integer default 0 not null,
+ "SCHEDULE_OBJECT" integer default 0,
+ "SCHEDULE_TAG" nvarchar2(36) default null,
+ "SCHEDULE_ETAGS" nclob default null,
+ "PRIVATE_COMMENTS" integer default 0 not null,
+ "MD5" nchar(32),
+ "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ unique("CALENDAR_RESOURCE_ID", "RESOURCE_NAME")
+);
+
+create table CALENDAR_OBJECT_ATTACHMENTS_MO (
+ "ID" integer primary key,
+ "DESCRIPTION" nvarchar2(16) unique
+);
+
+insert into CALENDAR_OBJECT_ATTACHMENTS_MO (DESCRIPTION, ID) values ('none', 0);
+insert into CALENDAR_OBJECT_ATTACHMENTS_MO (DESCRIPTION, ID) values ('read', 1);
+insert into CALENDAR_OBJECT_ATTACHMENTS_MO (DESCRIPTION, ID) values ('write', 2);
+create table CALENDAR_ACCESS_TYPE (
+ "ID" integer primary key,
+ "DESCRIPTION" nvarchar2(32) unique
+);
+
+insert into CALENDAR_ACCESS_TYPE (DESCRIPTION, ID) values ('', 0);
+insert into CALENDAR_ACCESS_TYPE (DESCRIPTION, ID) values ('public', 1);
+insert into CALENDAR_ACCESS_TYPE (DESCRIPTION, ID) values ('private', 2);
+insert into CALENDAR_ACCESS_TYPE (DESCRIPTION, ID) values ('confidential', 3);
+insert into CALENDAR_ACCESS_TYPE (DESCRIPTION, ID) values ('restricted', 4);
+create table TIME_RANGE (
+ "INSTANCE_ID" integer primary key,
+ "CALENDAR_RESOURCE_ID" integer not null references CALENDAR on delete cascade,
+ "CALENDAR_OBJECT_RESOURCE_ID" integer not null references CALENDAR_OBJECT on delete cascade,
+ "FLOATING" integer not null,
+ "START_DATE" timestamp not null,
+ "END_DATE" timestamp not null,
+ "FBTYPE" integer not null,
+ "TRANSPARENT" integer not null
+);
+
+create table FREE_BUSY_TYPE (
+ "ID" integer primary key,
+ "DESCRIPTION" nvarchar2(16) unique
+);
+
+insert into FREE_BUSY_TYPE (DESCRIPTION, ID) values ('unknown', 0);
+insert into FREE_BUSY_TYPE (DESCRIPTION, ID) values ('free', 1);
+insert into FREE_BUSY_TYPE (DESCRIPTION, ID) values ('busy', 2);
+insert into FREE_BUSY_TYPE (DESCRIPTION, ID) values ('busy-unavailable', 3);
+insert into FREE_BUSY_TYPE (DESCRIPTION, ID) values ('busy-tentative', 4);
+create table TRANSPARENCY (
+ "TIME_RANGE_INSTANCE_ID" integer not null references TIME_RANGE on delete cascade,
+ "USER_ID" nvarchar2(255),
+ "TRANSPARENT" integer not null
+);
+
+create table ATTACHMENT (
+ "ATTACHMENT_ID" integer primary key,
+ "CALENDAR_HOME_RESOURCE_ID" integer not null references CALENDAR_HOME,
+ "DROPBOX_ID" nvarchar2(255),
+ "CONTENT_TYPE" nvarchar2(255),
+ "SIZE" integer not null,
+ "MD5" nchar(32),
+ "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "PATH" nvarchar2(1024)
+);
+
+create table ATTACHMENT_CALENDAR_OBJECT (
+ "ATTACHMENT_ID" integer not null references ATTACHMENT on delete cascade,
+ "MANAGED_ID" nvarchar2(255),
+ "CALENDAR_OBJECT_RESOURCE_ID" integer not null references CALENDAR_OBJECT on delete cascade,
+ primary key("ATTACHMENT_ID", "CALENDAR_OBJECT_RESOURCE_ID"),
+ unique("MANAGED_ID", "CALENDAR_OBJECT_RESOURCE_ID")
+);
+
+create table RESOURCE_PROPERTY (
+ "RESOURCE_ID" integer not null,
+ "NAME" nvarchar2(255),
+ "VALUE" nclob,
+ "VIEWER_UID" nvarchar2(255),
+ primary key("RESOURCE_ID", "NAME", "VIEWER_UID")
+);
+
+create table ADDRESSBOOK_HOME (
+ "RESOURCE_ID" integer primary key,
+ "ADDRESSBOOK_PROPERTY_STORE_ID" integer not null,
+ "OWNER_UID" nvarchar2(255) unique,
+ "DATAVERSION" integer default 0 not null
+);
+
+create table ADDRESSBOOK_HOME_METADATA (
+ "RESOURCE_ID" integer primary key references ADDRESSBOOK_HOME on delete cascade,
+ "QUOTA_USED_BYTES" integer default 0 not null,
+ "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC'
+);
+
+create table SHARED_ADDRESSBOOK_BIND (
+ "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
+ "OWNER_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME on delete cascade,
+ "ADDRESSBOOK_RESOURCE_NAME" nvarchar2(255),
+ "BIND_MODE" integer not null,
+ "BIND_STATUS" integer not null,
+ "BIND_REVISION" integer default 0 not null,
+ "MESSAGE" nclob,
+ primary key("ADDRESSBOOK_HOME_RESOURCE_ID", "OWNER_HOME_RESOURCE_ID"),
+ unique("ADDRESSBOOK_HOME_RESOURCE_ID", "ADDRESSBOOK_RESOURCE_NAME")
+);
+
+create table ADDRESSBOOK_OBJECT (
+ "RESOURCE_ID" integer primary key,
+ "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME on delete cascade,
+ "RESOURCE_NAME" nvarchar2(255),
+ "VCARD_TEXT" nclob,
+ "VCARD_UID" nvarchar2(255),
+ "KIND" integer not null,
+ "MD5" nchar(32),
+ "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ unique("ADDRESSBOOK_HOME_RESOURCE_ID", "RESOURCE_NAME"),
+ unique("ADDRESSBOOK_HOME_RESOURCE_ID", "VCARD_UID")
+);
+
+create table ADDRESSBOOK_OBJECT_KIND (
+ "ID" integer primary key,
+ "DESCRIPTION" nvarchar2(16) unique
+);
+
+insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('person', 0);
+insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('group', 1);
+insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('resource', 2);
+insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('location', 3);
+create table ABO_MEMBERS (
+ "GROUP_ID" integer not null references ADDRESSBOOK_OBJECT on delete cascade,
+ "ADDRESSBOOK_ID" integer not null references ADDRESSBOOK_HOME on delete cascade,
+ "MEMBER_ID" integer not null references ADDRESSBOOK_OBJECT,
+ primary key("GROUP_ID", "MEMBER_ID")
+);
+
+create table ABO_FOREIGN_MEMBERS (
+ "GROUP_ID" integer not null references ADDRESSBOOK_OBJECT on delete cascade,
+ "ADDRESSBOOK_ID" integer not null references ADDRESSBOOK_HOME on delete cascade,
+ "MEMBER_ADDRESS" nvarchar2(255),
+ primary key("GROUP_ID", "MEMBER_ADDRESS")
+);
+
+create table SHARED_GROUP_BIND (
+ "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
+ "GROUP_RESOURCE_ID" integer not null references ADDRESSBOOK_OBJECT on delete cascade,
+ "GROUP_ADDRESSBOOK_NAME" nvarchar2(255),
+ "BIND_MODE" integer not null,
+ "BIND_STATUS" integer not null,
+ "BIND_REVISION" integer default 0 not null,
+ "MESSAGE" nclob,
+ primary key("ADDRESSBOOK_HOME_RESOURCE_ID", "GROUP_RESOURCE_ID"),
+ unique("ADDRESSBOOK_HOME_RESOURCE_ID", "GROUP_ADDRESSBOOK_NAME")
+);
+
+create table CALENDAR_OBJECT_REVISIONS (
+ "CALENDAR_HOME_RESOURCE_ID" integer not null references CALENDAR_HOME,
+ "CALENDAR_RESOURCE_ID" integer references CALENDAR,
+ "CALENDAR_NAME" nvarchar2(255) default null,
+ "RESOURCE_NAME" nvarchar2(255),
+ "REVISION" integer not null,
+ "DELETED" integer not null
+);
+
+create table ADDRESSBOOK_OBJECT_REVISIONS (
+ "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
+ "OWNER_HOME_RESOURCE_ID" integer references ADDRESSBOOK_HOME,
+ "ADDRESSBOOK_NAME" nvarchar2(255) default null,
+ "RESOURCE_NAME" nvarchar2(255),
+ "REVISION" integer not null,
+ "DELETED" integer not null
+);
+
+create table NOTIFICATION_OBJECT_REVISIONS (
+ "NOTIFICATION_HOME_RESOURCE_ID" integer not null references NOTIFICATION_HOME on delete cascade,
+ "RESOURCE_NAME" nvarchar2(255),
+ "REVISION" integer not null,
+ "DELETED" integer not null,
+ unique("NOTIFICATION_HOME_RESOURCE_ID", "RESOURCE_NAME")
+);
+
+create table APN_SUBSCRIPTIONS (
+ "TOKEN" nvarchar2(255),
+ "RESOURCE_KEY" nvarchar2(255),
+ "MODIFIED" integer not null,
+ "SUBSCRIBER_GUID" nvarchar2(255),
+ "USER_AGENT" nvarchar2(255) default null,
+ "IP_ADDR" nvarchar2(255) default null,
+ primary key("TOKEN", "RESOURCE_KEY")
+);
+
+create table IMIP_TOKENS (
+ "TOKEN" nvarchar2(255),
+ "ORGANIZER" nvarchar2(255),
+ "ATTENDEE" nvarchar2(255),
+ "ICALUID" nvarchar2(255),
+ "ACCESSED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ primary key("ORGANIZER", "ATTENDEE", "ICALUID")
+);
+
+create table IMIP_INVITATION_WORK (
+ "WORK_ID" integer primary key not null,
+ "NOT_BEFORE" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "FROM_ADDR" nvarchar2(255),
+ "TO_ADDR" nvarchar2(255),
+ "ICALENDAR_TEXT" nclob
+);
+
+create table IMIP_POLLING_WORK (
+ "WORK_ID" integer primary key not null,
+ "NOT_BEFORE" timestamp default CURRENT_TIMESTAMP at time zone 'UTC'
+);
+
+create table IMIP_REPLY_WORK (
+ "WORK_ID" integer primary key not null,
+ "NOT_BEFORE" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "ORGANIZER" nvarchar2(255),
+ "ATTENDEE" nvarchar2(255),
+ "ICALENDAR_TEXT" nclob
+);
+
+create table PUSH_NOTIFICATION_WORK (
+ "WORK_ID" integer primary key not null,
+ "NOT_BEFORE" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "PUSH_ID" nvarchar2(255),
+ "PRIORITY" integer not null
+);
+
+create table GROUP_CACHER_POLLING_WORK (
+ "WORK_ID" integer primary key not null,
+ "NOT_BEFORE" timestamp default CURRENT_TIMESTAMP at time zone 'UTC'
+);
+
+create table CALENDAR_OBJECT_SPLITTER_WORK (
+ "WORK_ID" integer primary key not null,
+ "NOT_BEFORE" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
+ "RESOURCE_ID" integer not null references CALENDAR_OBJECT on delete cascade
+);
+
+create table CALENDARSERVER (
+ "NAME" nvarchar2(255) primary key,
+ "VALUE" nvarchar2(255)
+);
+
+insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '29');
+insert into CALENDARSERVER (NAME, VALUE) values ('CALENDAR-DATAVERSION', '5');
+insert into CALENDARSERVER (NAME, VALUE) values ('ADDRESSBOOK-DATAVERSION', '2');
+insert into CALENDARSERVER (NAME, VALUE) values ('NOTIFICATION-DATAVERSION', '1');
+create index CALENDAR_HOME_METADAT_3cb9049e on CALENDAR_HOME_METADATA (
+ DEFAULT_EVENTS
+);
+
+create index CALENDAR_HOME_METADAT_d55e5548 on CALENDAR_HOME_METADATA (
+ DEFAULT_TASKS
+);
+
+create index CALENDAR_HOME_METADAT_910264ce on CALENDAR_HOME_METADATA (
+ DEFAULT_POLLS
+);
+
+create index NOTIFICATION_NOTIFICA_f891f5f9 on NOTIFICATION (
+ NOTIFICATION_HOME_RESOURCE_ID
+);
+
+create index CALENDAR_BIND_RESOURC_e57964d4 on CALENDAR_BIND (
+ CALENDAR_RESOURCE_ID
+);
+
+create index CALENDAR_OBJECT_CALEN_a9a453a9 on CALENDAR_OBJECT (
+ CALENDAR_RESOURCE_ID,
+ ICALENDAR_UID
+);
+
+create index CALENDAR_OBJECT_CALEN_96e83b73 on CALENDAR_OBJECT (
+ CALENDAR_RESOURCE_ID,
+ RECURRANCE_MAX
+);
+
+create index CALENDAR_OBJECT_ICALE_82e731d5 on CALENDAR_OBJECT (
+ ICALENDAR_UID
+);
+
+create index CALENDAR_OBJECT_DROPB_de041d80 on CALENDAR_OBJECT (
+ DROPBOX_ID
+);
+
+create index TIME_RANGE_CALENDAR_R_beb6e7eb on TIME_RANGE (
+ CALENDAR_RESOURCE_ID
+);
+
+create index TIME_RANGE_CALENDAR_O_acf37bd1 on TIME_RANGE (
+ CALENDAR_OBJECT_RESOURCE_ID
+);
+
+create index TRANSPARENCY_TIME_RAN_5f34467f on TRANSPARENCY (
+ TIME_RANGE_INSTANCE_ID
+);
+
+create index ATTACHMENT_CALENDAR_H_0078845c on ATTACHMENT (
+ CALENDAR_HOME_RESOURCE_ID
+);
+
+create index ATTACHMENT_CALENDAR_O_81508484 on ATTACHMENT_CALENDAR_OBJECT (
+ CALENDAR_OBJECT_RESOURCE_ID
+);
+
+create index SHARED_ADDRESSBOOK_BI_e9a2e6d4 on SHARED_ADDRESSBOOK_BIND (
+ OWNER_HOME_RESOURCE_ID
+);
+
+create index ABO_MEMBERS_ADDRESSBO_4effa879 on ABO_MEMBERS (
+ ADDRESSBOOK_ID
+);
+
+create index ABO_MEMBERS_MEMBER_ID_8d66adcf on ABO_MEMBERS (
+ MEMBER_ID
+);
+
+create index ABO_FOREIGN_MEMBERS_A_1fd2c5e9 on ABO_FOREIGN_MEMBERS (
+ ADDRESSBOOK_ID
+);
+
+create index SHARED_GROUP_BIND_RES_cf52f95d on SHARED_GROUP_BIND (
+ GROUP_RESOURCE_ID
+);
+
+create index CALENDAR_OBJECT_REVIS_3a3956c4 on CALENDAR_OBJECT_REVISIONS (
+ CALENDAR_HOME_RESOURCE_ID,
+ CALENDAR_RESOURCE_ID
+);
+
+create index CALENDAR_OBJECT_REVIS_6d9d929c on CALENDAR_OBJECT_REVISIONS (
+ CALENDAR_RESOURCE_ID,
+ RESOURCE_NAME,
+ DELETED,
+ REVISION
+);
+
+create index CALENDAR_OBJECT_REVIS_265c8acf on CALENDAR_OBJECT_REVISIONS (
+ CALENDAR_RESOURCE_ID,
+ REVISION
+);
+
+create index ADDRESSBOOK_OBJECT_RE_2bfcf757 on ADDRESSBOOK_OBJECT_REVISIONS (
+ ADDRESSBOOK_HOME_RESOURCE_ID,
+ OWNER_HOME_RESOURCE_ID
+);
+
+create index ADDRESSBOOK_OBJECT_RE_00fe8288 on ADDRESSBOOK_OBJECT_REVISIONS (
+ OWNER_HOME_RESOURCE_ID,
+ RESOURCE_NAME,
+ DELETED,
+ REVISION
+);
+
+create index ADDRESSBOOK_OBJECT_RE_45004780 on ADDRESSBOOK_OBJECT_REVISIONS (
+ OWNER_HOME_RESOURCE_ID,
+ REVISION
+);
+
+create index NOTIFICATION_OBJECT_R_036a9cee on NOTIFICATION_OBJECT_REVISIONS (
+ NOTIFICATION_HOME_RESOURCE_ID,
+ REVISION
+);
+
+create index APN_SUBSCRIPTIONS_RES_9610d78e on APN_SUBSCRIPTIONS (
+ RESOURCE_KEY
+);
+
+create index IMIP_TOKENS_TOKEN_e94b918f on IMIP_TOKENS (
+ TOKEN
+);
+
+create index CALENDAR_OBJECT_SPLIT_af71dcda on CALENDAR_OBJECT_SPLITTER_WORK (
+ RESOURCE_ID
+);
+
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoresql_schemaoldpostgresdialectv29sqlfromrev12142CalendarServerbranchesusersgayasharedgroupfixestxdavcommondatastoresql_schemaoldpostgresdialectv29sql"></a>
<div class="copfile"><h4>Copied: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql (from rev 12142, CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql) (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql         (rev 0)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,708 @@
</span><ins>+-- -*- test-case-name: txdav.caldav.datastore.test.test_sql,txdav.carddav.datastore.test.test_sql -*-
+
+----
+-- Copyright (c) 2010-2013 Apple Inc. All rights reserved.
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+----
+
+
+-----------------
+-- Resource ID --
+-----------------
+
+create sequence RESOURCE_ID_SEQ;
+
+
+-------------------------
+-- Cluster Bookkeeping --
+-------------------------
+
+-- Information about a process connected to this database.
+
+-- Note that this must match the node info schema in twext.enterprise.queue.
+create table NODE_INFO (
+ HOSTNAME varchar(255) not null,
+ PID integer not null,
+ PORT integer not null,
+ TIME timestamp not null default timezone('UTC', CURRENT_TIMESTAMP),
+
+ primary key (HOSTNAME, PORT)
+);
+
+-- Unique named locks. This table should always be empty, but rows are
+-- temporarily created in order to prevent undesirable concurrency.
+create table NAMED_LOCK (
+ LOCK_NAME varchar(255) primary key
+);
+
+
+-------------------
+-- Calendar Home --
+-------------------
+
+create table CALENDAR_HOME (
+ RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
+ OWNER_UID varchar(255) not null unique, -- implicit index
+ DATAVERSION integer default 0 not null
+);
+
+--------------
+-- Calendar --
+--------------
+
+create table CALENDAR (
+ RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ') -- implicit index
+);
+
+----------------------------
+-- Calendar Home Metadata --
+----------------------------
+
+create table CALENDAR_HOME_METADATA (
+ RESOURCE_ID integer primary key references CALENDAR_HOME on delete cascade, -- implicit index
+ QUOTA_USED_BYTES integer default 0 not null,
+ DEFAULT_EVENTS integer default null references CALENDAR on delete set null,
+ DEFAULT_TASKS integer default null references CALENDAR on delete set null,
+ DEFAULT_POLLS integer default null references CALENDAR on delete set null,
+ ALARM_VEVENT_TIMED text default null,
+ ALARM_VEVENT_ALLDAY text default null,
+ ALARM_VTODO_TIMED text default null,
+ ALARM_VTODO_ALLDAY text default null,
+ AVAILABILITY text default null,
+ CREATED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ MODIFIED timestamp default timezone('UTC', CURRENT_TIMESTAMP)
+);
+
+create index CALENDAR_HOME_METADATA_DEFAULT_EVENTS on
+        CALENDAR_HOME_METADATA(DEFAULT_EVENTS);
+create index CALENDAR_HOME_METADATA_DEFAULT_TASKS on
+        CALENDAR_HOME_METADATA(DEFAULT_TASKS);
+create index CALENDAR_HOME_METADATA_DEFAULT_POLLS on
+        CALENDAR_HOME_METADATA(DEFAULT_POLLS);
+
+-----------------------
+-- Calendar Metadata --
+-----------------------
+
+create table CALENDAR_METADATA (
+ RESOURCE_ID integer primary key references CALENDAR on delete cascade, -- implicit index
+ SUPPORTED_COMPONENTS varchar(255) default null,
+ CREATED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ MODIFIED timestamp default timezone('UTC', CURRENT_TIMESTAMP)
+);
+
+
+---------------------------
+-- Sharing Notifications --
+---------------------------
+
+create table NOTIFICATION_HOME (
+ RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
+ OWNER_UID varchar(255) not null unique, -- implicit index
+ DATAVERSION integer default 0 not null
+);
+
+create table NOTIFICATION (
+ RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
+ NOTIFICATION_HOME_RESOURCE_ID integer not null references NOTIFICATION_HOME,
+ NOTIFICATION_UID varchar(255) not null,
+ NOTIFICATION_TYPE varchar(255) not null,
+ NOTIFICATION_DATA text not null,
+ MD5 char(32) not null,
+ CREATED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ MODIFIED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+
+ unique(NOTIFICATION_UID, NOTIFICATION_HOME_RESOURCE_ID) -- implicit index
+);
+
+create index NOTIFICATION_NOTIFICATION_HOME_RESOURCE_ID on
+        NOTIFICATION(NOTIFICATION_HOME_RESOURCE_ID);
+
+
+-------------------
+-- Calendar Bind --
+-------------------
+
+-- Joins CALENDAR_HOME and CALENDAR
+
+create table CALENDAR_BIND (
+ CALENDAR_HOME_RESOURCE_ID integer not null references CALENDAR_HOME,
+ CALENDAR_RESOURCE_ID integer not null references CALENDAR on delete cascade,
+ CALENDAR_RESOURCE_NAME varchar(255) not null,
+ BIND_MODE integer not null, -- enum CALENDAR_BIND_MODE
+ BIND_STATUS integer not null, -- enum CALENDAR_BIND_STATUS
+ BIND_REVISION                                integer default 0 not null,
+ MESSAGE text,
+ TRANSP integer default 0 not null, -- enum CALENDAR_TRANSP
+ ALARM_VEVENT_TIMED text default null,
+ ALARM_VEVENT_ALLDAY text default null,
+ ALARM_VTODO_TIMED text default null,
+ ALARM_VTODO_ALLDAY text default null,
+ TIMEZONE text default null,
+
+ primary key(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_ID), -- implicit index
+ unique(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_NAME) -- implicit index
+);
+
+create index CALENDAR_BIND_RESOURCE_ID on
+        CALENDAR_BIND(CALENDAR_RESOURCE_ID);
+
+-- Enumeration of calendar bind modes
+
+create table CALENDAR_BIND_MODE (
+ ID integer primary key,
+ DESCRIPTION varchar(16) not null unique
+);
+
+insert into CALENDAR_BIND_MODE values (0, 'own' );
+insert into CALENDAR_BIND_MODE values (1, 'read' );
+insert into CALENDAR_BIND_MODE values (2, 'write');
+insert into CALENDAR_BIND_MODE values (3, 'direct');
+insert into CALENDAR_BIND_MODE values (4, 'indirect');
+
+-- Enumeration of statuses
+
+create table CALENDAR_BIND_STATUS (
+ ID integer primary key,
+ DESCRIPTION varchar(16) not null unique
+);
+
+insert into CALENDAR_BIND_STATUS values (0, 'invited' );
+insert into CALENDAR_BIND_STATUS values (1, 'accepted');
+insert into CALENDAR_BIND_STATUS values (2, 'declined');
+insert into CALENDAR_BIND_STATUS values (3, 'invalid');
+insert into CALENDAR_BIND_STATUS values (4, 'deleted');
+
+
+-- Enumeration of transparency
+
+create table CALENDAR_TRANSP (
+ ID integer primary key,
+ DESCRIPTION varchar(16) not null unique
+);
+
+insert into CALENDAR_TRANSP values (0, 'opaque' );
+insert into CALENDAR_TRANSP values (1, 'transparent');
+
+
+---------------------
+-- Calendar Object --
+---------------------
+
+create table CALENDAR_OBJECT (
+ RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
+ CALENDAR_RESOURCE_ID integer not null references CALENDAR on delete cascade,
+ RESOURCE_NAME varchar(255) not null,
+ ICALENDAR_TEXT text not null,
+ ICALENDAR_UID varchar(255) not null,
+ ICALENDAR_TYPE varchar(255) not null,
+ ATTACHMENTS_MODE integer default 0 not null, -- enum CALENDAR_OBJECT_ATTACHMENTS_MODE
+ DROPBOX_ID varchar(255),
+ ORGANIZER varchar(255),
+ RECURRANCE_MIN date, -- minimum date that recurrences have been expanded to.
+ RECURRANCE_MAX date, -- maximum date that recurrences have been expanded to.
+ ACCESS integer default 0 not null,
+ SCHEDULE_OBJECT boolean default false,
+ SCHEDULE_TAG varchar(36) default null,
+ SCHEDULE_ETAGS text default null,
+ PRIVATE_COMMENTS boolean default false not null,
+ MD5 char(32) not null,
+ CREATED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ MODIFIED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+
+ unique (CALENDAR_RESOURCE_ID, RESOURCE_NAME) -- implicit index
+
+ -- since the 'inbox' is a 'calendar resource' for the purpose of storing
+ -- calendar objects, this constraint has to be selectively enforced by the
+ -- application layer.
+
+ -- unique(CALENDAR_RESOURCE_ID, ICALENDAR_UID)
+);
+
+create index CALENDAR_OBJECT_CALENDAR_RESOURCE_ID_AND_ICALENDAR_UID on
+ CALENDAR_OBJECT(CALENDAR_RESOURCE_ID, ICALENDAR_UID);
+
+create index CALENDAR_OBJECT_CALENDAR_RESOURCE_ID_RECURRANCE_MAX on
+ CALENDAR_OBJECT(CALENDAR_RESOURCE_ID, RECURRANCE_MAX);
+
+create index CALENDAR_OBJECT_ICALENDAR_UID on
+ CALENDAR_OBJECT(ICALENDAR_UID);
+
+create index CALENDAR_OBJECT_DROPBOX_ID on
+ CALENDAR_OBJECT(DROPBOX_ID);
+
+-- Enumeration of attachment modes
+
+create table CALENDAR_OBJECT_ATTACHMENTS_MODE (
+ ID integer primary key,
+ DESCRIPTION varchar(16) not null unique
+);
+
+insert into CALENDAR_OBJECT_ATTACHMENTS_MODE values (0, 'none' );
+insert into CALENDAR_OBJECT_ATTACHMENTS_MODE values (1, 'read' );
+insert into CALENDAR_OBJECT_ATTACHMENTS_MODE values (2, 'write');
+
+
+-- Enumeration of calendar access types
+
+create table CALENDAR_ACCESS_TYPE (
+ ID integer primary key,
+ DESCRIPTION varchar(32) not null unique
+);
+
+insert into CALENDAR_ACCESS_TYPE values (0, '' );
+insert into CALENDAR_ACCESS_TYPE values (1, 'public' );
+insert into CALENDAR_ACCESS_TYPE values (2, 'private' );
+insert into CALENDAR_ACCESS_TYPE values (3, 'confidential' );
+insert into CALENDAR_ACCESS_TYPE values (4, 'restricted' );
+
+
+-----------------
+-- Instance ID --
+-----------------
+
+create sequence INSTANCE_ID_SEQ;
+
+
+----------------
+-- Time Range --
+----------------
+
+create table TIME_RANGE (
+ INSTANCE_ID integer primary key default nextval('INSTANCE_ID_SEQ'), -- implicit index
+ CALENDAR_RESOURCE_ID integer not null references CALENDAR on delete cascade,
+ CALENDAR_OBJECT_RESOURCE_ID integer not null references CALENDAR_OBJECT on delete cascade,
+ FLOATING boolean not null,
+ START_DATE timestamp not null,
+ END_DATE timestamp not null,
+ FBTYPE integer not null,
+ TRANSPARENT boolean not null
+);
+
+create index TIME_RANGE_CALENDAR_RESOURCE_ID on
+ TIME_RANGE(CALENDAR_RESOURCE_ID);
+create index TIME_RANGE_CALENDAR_OBJECT_RESOURCE_ID on
+ TIME_RANGE(CALENDAR_OBJECT_RESOURCE_ID);
+
+
+-- Enumeration of free/busy types
+
+create table FREE_BUSY_TYPE (
+ ID integer primary key,
+ DESCRIPTION varchar(16) not null unique
+);
+
+insert into FREE_BUSY_TYPE values (0, 'unknown' );
+insert into FREE_BUSY_TYPE values (1, 'free' );
+insert into FREE_BUSY_TYPE values (2, 'busy' );
+insert into FREE_BUSY_TYPE values (3, 'busy-unavailable');
+insert into FREE_BUSY_TYPE values (4, 'busy-tentative' );
+
+
+------------------
+-- Transparency --
+------------------
+
+create table TRANSPARENCY (
+ TIME_RANGE_INSTANCE_ID integer not null references TIME_RANGE on delete cascade,
+ USER_ID varchar(255) not null,
+ TRANSPARENT boolean not null
+);
+
+create index TRANSPARENCY_TIME_RANGE_INSTANCE_ID on
+ TRANSPARENCY(TIME_RANGE_INSTANCE_ID);
+
+
+----------------
+-- Attachment --
+----------------
+
+create sequence ATTACHMENT_ID_SEQ;
+
+create table ATTACHMENT (
+ ATTACHMENT_ID integer primary key default nextval('ATTACHMENT_ID_SEQ'), -- implicit index
+ CALENDAR_HOME_RESOURCE_ID integer not null references CALENDAR_HOME,
+ DROPBOX_ID varchar(255),
+ CONTENT_TYPE varchar(255) not null,
+ SIZE integer not null,
+ MD5 char(32) not null,
+ CREATED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ MODIFIED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ PATH varchar(1024) not null
+);
+
+create index ATTACHMENT_CALENDAR_HOME_RESOURCE_ID on
+ ATTACHMENT(CALENDAR_HOME_RESOURCE_ID);
+
+-- Many-to-many relationship between attachments and calendar objects
+create table ATTACHMENT_CALENDAR_OBJECT (
+ ATTACHMENT_ID integer not null references ATTACHMENT on delete cascade,
+ MANAGED_ID varchar(255) not null,
+ CALENDAR_OBJECT_RESOURCE_ID integer not null references CALENDAR_OBJECT on delete cascade,
+
+ primary key (ATTACHMENT_ID, CALENDAR_OBJECT_RESOURCE_ID), -- implicit index
+ unique (MANAGED_ID, CALENDAR_OBJECT_RESOURCE_ID) --implicit index
+);
+
+create index ATTACHMENT_CALENDAR_OBJECT_CALENDAR_OBJECT_RESOURCE_ID on
+        ATTACHMENT_CALENDAR_OBJECT(CALENDAR_OBJECT_RESOURCE_ID);
+
+-----------------------
+-- Resource Property --
+-----------------------
+
+create table RESOURCE_PROPERTY (
+ RESOURCE_ID integer not null, -- foreign key: *.RESOURCE_ID
+ NAME varchar(255) not null,
+ VALUE text not null, -- FIXME: xml?
+ VIEWER_UID varchar(255),
+
+ primary key (RESOURCE_ID, NAME, VIEWER_UID) -- implicit index
+);
+
+
+----------------------
+-- AddressBook Home --
+----------------------
+
+create table ADDRESSBOOK_HOME (
+ RESOURCE_ID                                 integer                        primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
+ ADDRESSBOOK_PROPERTY_STORE_ID        integer         default nextval('RESOURCE_ID_SEQ') not null,         -- implicit index
+ OWNER_UID                                 varchar(255)         not null unique, -- implicit index
+ DATAVERSION                                 integer         default 0 not null
+);
+
+
+-------------------------------
+-- AddressBook Home Metadata --
+-------------------------------
+
+create table ADDRESSBOOK_HOME_METADATA (
+ RESOURCE_ID integer primary key references ADDRESSBOOK_HOME on delete cascade, -- implicit index
+ QUOTA_USED_BYTES integer default 0 not null,
+ CREATED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ MODIFIED timestamp default timezone('UTC', CURRENT_TIMESTAMP)
+);
+
+
+-----------------------------
+-- Shared AddressBook Bind --
+-----------------------------
+
+-- Joins sharee ADDRESSBOOK_HOME and owner ADDRESSBOOK_HOME
+
+create table SHARED_ADDRESSBOOK_BIND (
+ ADDRESSBOOK_HOME_RESOURCE_ID                        integer                        not null references ADDRESSBOOK_HOME,
+ OWNER_HOME_RESOURCE_ID                         integer         not null references ADDRESSBOOK_HOME on delete cascade,
+ ADDRESSBOOK_RESOURCE_NAME                         varchar(255)         not null,
+ BIND_MODE                         integer         not null,        -- enum CALENDAR_BIND_MODE
+ BIND_STATUS                         integer         not null,        -- enum CALENDAR_BIND_STATUS
+ BIND_REVISION                                                         integer         default 0 not null,
+ MESSAGE                         text,                 -- FIXME: xml?
+
+ primary key (ADDRESSBOOK_HOME_RESOURCE_ID, OWNER_HOME_RESOURCE_ID), -- implicit index
+ unique (ADDRESSBOOK_HOME_RESOURCE_ID, ADDRESSBOOK_RESOURCE_NAME) -- implicit index
+);
+
+create index SHARED_ADDRESSBOOK_BIND_RESOURCE_ID on
+ SHARED_ADDRESSBOOK_BIND(OWNER_HOME_RESOURCE_ID);
+
+
+------------------------
+-- AddressBook Object --
+------------------------
+
+create table ADDRESSBOOK_OBJECT (
+ RESOURCE_ID                 integer                 primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
+ ADDRESSBOOK_HOME_RESOURCE_ID         integer         not null references ADDRESSBOOK_HOME on delete cascade,
+ RESOURCE_NAME                 varchar(255)         not null,
+ VCARD_TEXT                 text         not null,
+ VCARD_UID                 varchar(255)         not null,
+ KIND                                                           integer         not null, -- enum ADDRESSBOOK_OBJECT_KIND
+ MD5                 char(32)         not null,
+ CREATED                 timestamp         default timezone('UTC', CURRENT_TIMESTAMP),
+ MODIFIED                 timestamp         default timezone('UTC', CURRENT_TIMESTAMP),
+
+ unique (ADDRESSBOOK_HOME_RESOURCE_ID, RESOURCE_NAME), -- implicit index
+ unique (ADDRESSBOOK_HOME_RESOURCE_ID, VCARD_UID) -- implicit index
+);
+
+
+-----------------------------
+-- AddressBook Object kind --
+-----------------------------
+
+create table ADDRESSBOOK_OBJECT_KIND (
+ ID integer primary key,
+ DESCRIPTION varchar(16) not null unique
+);
+
+insert into ADDRESSBOOK_OBJECT_KIND values (0, 'person');
+insert into ADDRESSBOOK_OBJECT_KIND values (1, 'group' );
+insert into ADDRESSBOOK_OBJECT_KIND values (2, 'resource');
+insert into ADDRESSBOOK_OBJECT_KIND values (3, 'location');
+
+
+---------------------------------
+-- Address Book Object Members --
+---------------------------------
+
+create table ABO_MEMBERS (
+ GROUP_ID integer not null references ADDRESSBOOK_OBJECT on delete cascade,        -- AddressBook Object's (kind=='group') RESOURCE_ID
+         ADDRESSBOOK_ID                 integer not null references ADDRESSBOOK_HOME on delete cascade,
+ MEMBER_ID integer not null references ADDRESSBOOK_OBJECT,                                                -- member AddressBook Object's RESOURCE_ID
+
+ primary key (GROUP_ID, MEMBER_ID) -- implicit index
+);
+
+create index ABO_MEMBERS_ADDRESSBOOK_ID on
+        ABO_MEMBERS(ADDRESSBOOK_ID);
+create index ABO_MEMBERS_MEMBER_ID on
+        ABO_MEMBERS(MEMBER_ID);
+
+------------------------------------------
+-- Address Book Object Foreign Members --
+------------------------------------------
+
+create table ABO_FOREIGN_MEMBERS (
+ GROUP_ID integer not null references ADDRESSBOOK_OBJECT on delete cascade,        -- AddressBook Object's (kind=='group') RESOURCE_ID
+         ADDRESSBOOK_ID                 integer not null references ADDRESSBOOK_HOME on delete cascade,
+ MEMBER_ADDRESS          varchar(255) not null,                                                                                                         -- member AddressBook Object's 'calendar' address
+
+ primary key (GROUP_ID, MEMBER_ADDRESS) -- implicit index
+);
+
+create index ABO_FOREIGN_MEMBERS_ADDRESSBOOK_ID on
+        ABO_FOREIGN_MEMBERS(ADDRESSBOOK_ID);
+
+-----------------------
+-- Shared Group Bind --
+-----------------------
+
+-- Joins ADDRESSBOOK_HOME and ADDRESSBOOK_OBJECT (kind == group)
+
+create table SHARED_GROUP_BIND (        
+ ADDRESSBOOK_HOME_RESOURCE_ID                 integer not null references ADDRESSBOOK_HOME,
+ GROUP_RESOURCE_ID                         integer not null references ADDRESSBOOK_OBJECT on delete cascade,
+ GROUP_ADDRESSBOOK_NAME                        varchar(255) not null,
+ BIND_MODE                 integer not null, -- enum CALENDAR_BIND_MODE
+ BIND_STATUS                 integer not null, -- enum CALENDAR_BIND_STATUS
+ BIND_REVISION                                                 integer default 0 not null,
+ MESSAGE                 text, -- FIXME: xml?
+
+ primary key (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_RESOURCE_ID), -- implicit index
+ unique (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_ADDRESSBOOK_NAME) -- implicit index
+);
+
+create index SHARED_GROUP_BIND_RESOURCE_ID on
+ SHARED_GROUP_BIND(GROUP_RESOURCE_ID);
+
+
+---------------
+-- Revisions --
+---------------
+
+create sequence REVISION_SEQ;
+
+
+-------------------------------
+-- Calendar Object Revisions --
+-------------------------------
+
+create table CALENDAR_OBJECT_REVISIONS (
+ CALENDAR_HOME_RESOURCE_ID integer not null references CALENDAR_HOME,
+ CALENDAR_RESOURCE_ID integer references CALENDAR,
+ CALENDAR_NAME varchar(255) default null,
+ RESOURCE_NAME varchar(255),
+ REVISION integer default nextval('REVISION_SEQ') not null,
+ DELETED boolean not null
+);
+
+create index CALENDAR_OBJECT_REVISIONS_HOME_RESOURCE_ID_CALENDAR_RESOURCE_ID
+ on CALENDAR_OBJECT_REVISIONS(CALENDAR_HOME_RESOURCE_ID, CALENDAR_RESOURCE_ID);
+
+create index CALENDAR_OBJECT_REVISIONS_RESOURCE_ID_RESOURCE_NAME_DELETED_REVISION
+ on CALENDAR_OBJECT_REVISIONS(CALENDAR_RESOURCE_ID, RESOURCE_NAME, DELETED, REVISION);
+
+create index CALENDAR_OBJECT_REVISIONS_RESOURCE_ID_REVISION
+ on CALENDAR_OBJECT_REVISIONS(CALENDAR_RESOURCE_ID, REVISION);
+
+
+----------------------------------
+-- AddressBook Object Revisions --
+----------------------------------
+
+create table ADDRESSBOOK_OBJECT_REVISIONS (
+ ADDRESSBOOK_HOME_RESOURCE_ID                         integer                        not null references ADDRESSBOOK_HOME,
+ OWNER_HOME_RESOURCE_ID                         integer         references ADDRESSBOOK_HOME,
+ ADDRESSBOOK_NAME                         varchar(255)         default null,
+ RESOURCE_NAME                         varchar(255),
+ REVISION                         integer         default nextval('REVISION_SEQ') not null,
+ DELETED                         boolean         not null
+);
+
+create index ADDRESSBOOK_OBJECT_REVISIONS_HOME_RESOURCE_ID_OWNER_HOME_RESOURCE_ID
+ on ADDRESSBOOK_OBJECT_REVISIONS(ADDRESSBOOK_HOME_RESOURCE_ID, OWNER_HOME_RESOURCE_ID);
+
+create index ADDRESSBOOK_OBJECT_REVISIONS_OWNER_HOME_RESOURCE_ID_RESOURCE_NAME_DELETED_REVISION
+ on ADDRESSBOOK_OBJECT_REVISIONS(OWNER_HOME_RESOURCE_ID, RESOURCE_NAME, DELETED, REVISION);
+
+create index ADDRESSBOOK_OBJECT_REVISIONS_OWNER_HOME_RESOURCE_ID_REVISION
+ on ADDRESSBOOK_OBJECT_REVISIONS(OWNER_HOME_RESOURCE_ID, REVISION);
+
+
+-----------------------------------
+-- Notification Object Revisions --
+-----------------------------------
+
+create table NOTIFICATION_OBJECT_REVISIONS (
+ NOTIFICATION_HOME_RESOURCE_ID integer not null references NOTIFICATION_HOME on delete cascade,
+ RESOURCE_NAME varchar(255),
+ REVISION integer default nextval('REVISION_SEQ') not null,
+ DELETED boolean not null,
+
+ unique(NOTIFICATION_HOME_RESOURCE_ID, RESOURCE_NAME) -- implicit index
+);
+
+create index NOTIFICATION_OBJECT_REVISIONS_RESOURCE_ID_REVISION
+ on NOTIFICATION_OBJECT_REVISIONS(NOTIFICATION_HOME_RESOURCE_ID, REVISION);
+
+
+-------------------------------------------
+-- Apple Push Notification Subscriptions --
+-------------------------------------------
+
+create table APN_SUBSCRIPTIONS (
+ TOKEN varchar(255) not null,
+ RESOURCE_KEY varchar(255) not null,
+ MODIFIED integer not null,
+ SUBSCRIBER_GUID varchar(255) not null,
+ USER_AGENT varchar(255) default null,
+ IP_ADDR varchar(255) default null,
+
+ primary key (TOKEN, RESOURCE_KEY) -- implicit index
+);
+
+create index APN_SUBSCRIPTIONS_RESOURCE_KEY
+ on APN_SUBSCRIPTIONS(RESOURCE_KEY);
+
+
+-----------------
+-- IMIP Tokens --
+-----------------
+
+create table IMIP_TOKENS (
+ TOKEN varchar(255) not null,
+ ORGANIZER varchar(255) not null,
+ ATTENDEE varchar(255) not null,
+ ICALUID varchar(255) not null,
+ ACCESSED timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+
+ primary key (ORGANIZER, ATTENDEE, ICALUID) -- implicit index
+);
+
+create index IMIP_TOKENS_TOKEN
+ on IMIP_TOKENS(TOKEN);
+
+
+----------------
+-- Work Items --
+----------------
+
+create sequence WORKITEM_SEQ;
+
+
+---------------------------
+-- IMIP Inivitation Work --
+---------------------------
+
+create table IMIP_INVITATION_WORK (
+ WORK_ID integer primary key default nextval('WORKITEM_SEQ') not null, -- implicit index
+ NOT_BEFORE timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ FROM_ADDR varchar(255) not null,
+ TO_ADDR varchar(255) not null,
+ ICALENDAR_TEXT text not null
+);
+
+
+-----------------------
+-- IMIP Polling Work --
+-----------------------
+
+create table IMIP_POLLING_WORK (
+ WORK_ID integer primary key default nextval('WORKITEM_SEQ') not null, -- implicit index
+ NOT_BEFORE timestamp default timezone('UTC', CURRENT_TIMESTAMP)
+);
+
+
+---------------------
+-- IMIP Reply Work --
+---------------------
+
+create table IMIP_REPLY_WORK (
+ WORK_ID integer primary key default nextval('WORKITEM_SEQ') not null, -- implicit index
+ NOT_BEFORE timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ ORGANIZER varchar(255) not null,
+ ATTENDEE varchar(255) not null,
+ ICALENDAR_TEXT text not null
+);
+
+
+------------------------
+-- Push Notifications --
+------------------------
+
+create table PUSH_NOTIFICATION_WORK (
+ WORK_ID integer primary key default nextval('WORKITEM_SEQ') not null, -- implicit index
+ NOT_BEFORE timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ PUSH_ID varchar(255) not null,
+ PRIORITY integer not null -- 1:low 5:medium 10:high
+);
+
+-----------------
+-- GroupCacher --
+-----------------
+
+create table GROUP_CACHER_POLLING_WORK (
+ WORK_ID integer primary key default nextval('WORKITEM_SEQ') not null, -- implicit index
+ NOT_BEFORE timestamp default timezone('UTC', CURRENT_TIMESTAMP)
+);
+
+
+--------------------------
+-- Object Splitter Work --
+--------------------------
+
+create table CALENDAR_OBJECT_SPLITTER_WORK (
+ WORK_ID integer primary key default nextval('WORKITEM_SEQ') not null, -- implicit index
+ NOT_BEFORE timestamp default timezone('UTC', CURRENT_TIMESTAMP),
+ RESOURCE_ID integer not null references CALENDAR_OBJECT on delete cascade
+);
+
+create index CALENDAR_OBJECT_SPLITTER_WORK_RESOURCE_ID on
+        CALENDAR_OBJECT_SPLITTER_WORK(RESOURCE_ID);
+
+--------------------
+-- Schema Version --
+--------------------
+
+create table CALENDARSERVER (
+ NAME varchar(255) primary key, -- implicit index
+ VALUE varchar(255)
+);
+
+insert into CALENDARSERVER values ('VERSION', '29');
+insert into CALENDARSERVER values ('CALENDAR-DATAVERSION', '5');
+insert into CALENDARSERVER values ('ADDRESSBOOK-DATAVERSION', '2');
+insert into CALENDARSERVER values ('NOTIFICATION-DATAVERSION', '1');
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoresql_schemaupgradesoracledialectupgrade_from_29_to_30sqlfromrev12142CalendarServerbranchesusersgayasharedgroupfixestxdavcommondatastoresql_schemaupgradesoracledialectupgrade_from_29_to_30sql"></a>
<div class="copfile"><h4>Copied: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql (from rev 12142, CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql) (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql         (rev 0)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+----
+-- Copyright (c) 2012-2013 Apple Inc. All rights reserved.
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+----
+
+---------------------------------------------------
+-- Upgrade database schema from VERSION 29 to 30 --
+---------------------------------------------------
+
+----------------------------------------
+-- Change Address Book Object Members --
+----------------------------------------
+
+alter table ABO_MEMBERS
+        drop ("abo_members_member_id_fkey");
+alter table ABO_MEMBERS
+        drop ("abo_members_group_id_fkey");
+alter table ABO_MEMBERS
+        add ("REVISION" integer default nextval('REVISION_SEQ') not null);
+alter table ABO_MEMBERS
+        add ("REMOVED" boolean default false not null);
+alter table ABO_MEMBERS
+         drop ("abo_members_pkey");
+alter table ABO_MEMBERS
+         add ("abo_members_pkey" primary key ("GROUP_ID", "MEMBER_ID", "REVISION"));
+
+------------------------------------------
+-- Change Address Book Object Revisions --
+------------------------------------------
+        
+alter table ADDRESSBOOK_OBJECT_REVISIONS
+        add ("OBJECT_RESOURCE_ID" integer default 0);
+
+--------------------
+-- Update version --
+--------------------
+
+update CALENDARSERVER set VALUE = '30' where NAME = 'VERSION';
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoresql_schemaupgradespostgresdialectupgrade_from_29_to_30sqlfromrev12142CalendarServerbranchesusersgayasharedgroupfixestxdavcommondatastoresql_schemaupgradespostgresdialectupgrade_from_29_to_30sql"></a>
<div class="copfile"><h4>Copied: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql (from rev 12142, CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql) (0 => 12143)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql         (rev 0)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql        2013-12-19 06:18:02 UTC (rev 12143)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+----
+-- Copyright (c) 2012-2013 Apple Inc. All rights reserved.
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+----
+
+---------------------------------------------------
+-- Upgrade database schema from VERSION 29 to 30 --
+---------------------------------------------------
+
+----------------------------------------
+-- Change Address Book Object Members --
+----------------------------------------
+
+alter table ABO_MEMBERS
+        drop constraint        abo_members_member_id_fkey,
+        drop constraint        abo_members_group_id_fkey,
+        add column        REVISION                integer default nextval('REVISION_SEQ') not null,
+        add column        REMOVED boolean default false not null,
+        drop constraint abo_members_pkey,
+        add constraint abo_members_pkey primary key(GROUP_ID, MEMBER_ID, REVISION);
+
+------------------------------------------
+-- Change Address Book Object Revisions --
+------------------------------------------
+        
+alter table ADDRESSBOOK_OBJECT_REVISIONS
+        add column OBJECT_RESOURCE_ID integer default 0;
+        
+--------------------
+-- Update version --
+--------------------
+
+update CALENDARSERVER set VALUE = '30' where NAME = 'VERSION';
</ins></span></pre>
</div>
</div>
</body>
</html>