<!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>[14094] 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/14094">14094</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-10-21 09:51:27 -0700 (Tue, 21 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Push more of the proxy/delegate logic into the store from the app-layer.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktwistedcaldavdirectorycalendaruserproxypy">CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavdirectoryprincipalpy">CalendarServer/trunk/twistedcaldav/directory/principal.py</a></li>
<li><a href="#CalendarServertrunktwistedcaldavdirectorytesttest_principalpy">CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavicalendardirectoryservicepy">CalendarServer/trunk/txdav/caldav/icalendardirectoryservice.py</a></li>
<li><a href="#CalendarServertrunktxdavwhodelegatespy">CalendarServer/trunk/txdav/who/delegates.py</a></li>
<li><a href="#CalendarServertrunktxdavwhodirectorypy">CalendarServer/trunk/txdav/who/directory.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktwistedcaldavdirectorycalendaruserproxypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py (14093 => 14094)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py        2014-10-20 19:21:40 UTC (rev 14093)
+++ CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py        2014-10-21 16:51:27 UTC (rev 14094)
</span><span class="lines">@@ -424,26 +424,24 @@
</span><span class="cx">         return succeed([])
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    @inlineCallbacks
</del><span class="cx">     def containsPrincipal(self, principal):
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        Uses proxyFor information to turn the &quot;contains principal&quot; question around;
-        rather than expanding this principal's groups to see if the other principal
-        is a member, ask the other principal if they are a proxy for this principal's
-        parent resource, since this principal is a proxy principal.
</del><ins>+        Optimize this to ignore the owner principal when doing this test. This is a common occurrence as the owner
+        is the one most likely to be looking at their own resources, each of which will have the owner's two proxy
+        principals listed in the ACLs (and this method is called during each ACL L{checkPrivileges} call.
</ins><span class="cx"> 
</span><span class="cx">         @param principal: The principal to check
</span><span class="cx">         @type principal: L{DirectoryCalendarPrincipalResource}
</span><del>-        @return: True if principal is a proxy (of the correct type) of our parent
</del><ins>+        @return: L{True} if principal is a proxy (of the correct type) of our parent
</ins><span class="cx">         @rtype: C{boolean}
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        readWrite = self.isProxyType(True)  # is read-write
-        if principal and self.parent in (yield principal.proxyFor(readWrite)):
-            returnValue(True)
-        returnValue(False)
</del><span class="cx"> 
</span><ins>+        if principal == self.parent:
+            return succeed(False)
+        return super(CalendarUserProxyPrincipalResource, self).containsPrincipal(principal)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class ProxyDB(AbstractADBAPIDatabase):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     A database to maintain calendar user proxy group memberships.
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavdirectoryprincipalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py (14093 => 14094)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/directory/principal.py        2014-10-20 19:21:40 UTC (rev 14093)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py        2014-10-21 16:51:27 UTC (rev 14094)
</span><span class="lines">@@ -55,7 +55,6 @@
</span><span class="cx"> from twistedcaldav.extensions import DirectoryElement
</span><span class="cx"> from twistedcaldav.resource import CalendarPrincipalCollectionResource, CalendarPrincipalResource
</span><span class="cx"> from txdav.caldav.datastore.scheduling.utils import normalizeCUAddr
</span><del>-from txdav.who.delegates import RecordType as DelegateRecordType
</del><span class="cx"> from txdav.who.directory import CalendarDirectoryRecordMixin
</span><span class="cx"> from txdav.xml import element as davxml
</span><span class="cx"> from txweb2 import responsecode
</span><span class="lines">@@ -936,41 +935,27 @@
</span><span class="cx">         return self.principalURL()
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    @inlineCallbacks
</del><span class="cx">     def isProxyFor(self, principal):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Determine whether this principal is a read-only or read-write proxy for the
</span><span class="cx">         specified principal.
</span><ins>+
+        @param principal: principal resource for the possible user proxying to this principal
+        @type principal: L{DirectoryPrincipalResource}
</ins><span class="cx">         &quot;&quot;&quot;
</span><ins>+        return self.record.isProxyFor(principal.record)
</ins><span class="cx"> 
</span><del>-        read_uids = (yield self.proxyFor(False))
-        if principal in read_uids:
-            returnValue(True)
</del><span class="cx"> 
</span><del>-        write_uids = (yield self.proxyFor(True))
-        if principal in write_uids:
-            returnValue(True)
-
-        returnValue(False)
-
-
-    @inlineCallbacks
</del><span class="cx">     def proxyMode(self, principal):
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        Determine whether what proxy mode this principal has in relation to the one specified.
</del><ins>+        Determine whether proxy mode this principal has in relation to the one specified.
+
+        @param principal: principal resource for the possible user proxying to this principal
+        @type principal: L{DirectoryPrincipalResource}
</ins><span class="cx">         &quot;&quot;&quot;
</span><ins>+        return self.record.proxyMode(principal.record)
</ins><span class="cx"> 
</span><del>-        read_uids = (yield self.proxyFor(False))
-        if principal in read_uids:
-            returnValue(&quot;read&quot;)
</del><span class="cx"> 
</span><del>-        write_uids = (yield self.proxyFor(True))
-        if principal in write_uids:
-            returnValue(&quot;write&quot;)
-
-        returnValue(&quot;none&quot;)
-
-
</del><span class="cx">     @inlineCallbacks
</span><span class="cx">     def proxyFor(self, readWrite, ignoreDisabled=True):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -990,28 +975,13 @@
</span><span class="cx">         proxyFors = set()
</span><span class="cx"> 
</span><span class="cx">         if config.EnableProxyPrincipals:
</span><del>-            proxyRecordType = (
-                DelegateRecordType.writeDelegatorGroup if readWrite else
-                DelegateRecordType.readDelegatorGroup
-            )
-            proxyGroupRecord = yield self.record.service.recordWithShortName(
-                proxyRecordType, self.record.uid
-            )
-            if proxyGroupRecord is not None:
-                proxyForRecords = yield proxyGroupRecord.members()
</del><ins>+            proxyForRecords = yield self.record.proxyFor(readWrite, ignoreDisabled)
</ins><span class="cx"> 
</span><del>-                uids = set()
-                for record in tuple(proxyForRecords):
-                    if record.uid in uids:
-                        proxyForRecords.remove(record)
-                    else:
-                        uids.add(record.uid)
</del><ins>+            for record in proxyForRecords:
+                principal = yield self.parent.principalForRecord(record)
+                if principal is not None:
+                    proxyFors.add(principal)
</ins><span class="cx"> 
</span><del>-                for record in proxyForRecords:
-                    principal = yield self.parent.principalForRecord(record)
-                    if principal is not None and (not ignoreDisabled or principal.record.hasCalendars):
-                        proxyFors.add(principal)
-
</del><span class="cx">         returnValue(proxyFors)
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavdirectorytesttest_principalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py (14093 => 14094)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py        2014-10-20 19:21:40 UTC (rev 14093)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_principal.py        2014-10-21 16:51:27 UTC (rev 14094)
</span><span class="lines">@@ -1096,3 +1096,118 @@
</span><span class="cx"> 
</span><span class="cx">         self.assertTrue(len((yield principal01.proxyFor(False))) == 1)
</span><span class="cx">         self.assertTrue(len((yield principal01.proxyFor(True))) == 0)
</span><ins>+
+
+    @inlineCallbacks
+    def test_isProxyFor(self):
+        &quot;&quot;&quot;
+        Test that L{DirectoryPrincipalResource.proxyFor} returns the correct results.
+        &quot;&quot;&quot;
+        principal01 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user01&quot;)))
+        principal02 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user02&quot;)))
+        principal03 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user03&quot;)))
+
+        # Check proxy for
+        self.assertFalse((yield principal01.isProxyFor(principal01)))
+        self.assertFalse((yield principal01.isProxyFor(principal02)))
+        self.assertFalse((yield principal01.isProxyFor(principal03)))
+        self.assertFalse((yield principal02.isProxyFor(principal01)))
+        self.assertFalse((yield principal02.isProxyFor(principal02)))
+        self.assertFalse((yield principal02.isProxyFor(principal03)))
+        self.assertFalse((yield principal03.isProxyFor(principal01)))
+        self.assertFalse((yield principal03.isProxyFor(principal02)))
+        self.assertFalse((yield principal03.isProxyFor(principal03)))
+
+        # Make user02 a read-only proxy for user01, and user03 a read-write proxy for user01
+        yield addDelegate(self.transactionUnderTest(), principal01.record, principal02.record, False)
+        yield addDelegate(self.transactionUnderTest(), principal01.record, principal03.record, True)
+        yield self.commit()
+
+        # Check proxy for
+        self.assertFalse((yield principal01.isProxyFor(principal01)))
+        self.assertFalse((yield principal01.isProxyFor(principal02)))
+        self.assertFalse((yield principal01.isProxyFor(principal03)))
+        self.assertTrue((yield principal02.isProxyFor(principal01)))
+        self.assertFalse((yield principal02.isProxyFor(principal02)))
+        self.assertFalse((yield principal02.isProxyFor(principal03)))
+        self.assertTrue((yield principal03.isProxyFor(principal01)))
+        self.assertFalse((yield principal03.isProxyFor(principal02)))
+        self.assertFalse((yield principal03.isProxyFor(principal03)))
+
+
+    @inlineCallbacks
+    def test_proxyMode(self):
+        &quot;&quot;&quot;
+        Test that L{DirectoryPrincipalResource.proxyMode} returns the correct results.
+        &quot;&quot;&quot;
+        principal01 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user01&quot;)))
+        principal02 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user02&quot;)))
+        principal03 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user03&quot;)))
+
+        # Check proxy mode
+        mode = yield principal02.proxyMode(principal01)
+        self.assertEqual(mode, &quot;none&quot;)
+        mode = yield principal01.proxyMode(principal02)
+        self.assertEqual(mode, &quot;none&quot;)
+        mode = yield principal03.proxyMode(principal01)
+        self.assertEqual(mode, &quot;none&quot;)
+        mode = yield principal01.proxyMode(principal03)
+        self.assertEqual(mode, &quot;none&quot;)
+
+        # Make user02 a read-only proxy for user01, and user03 a read-write proxy for user01
+        yield addDelegate(self.transactionUnderTest(), principal01.record, principal02.record, False)
+        yield addDelegate(self.transactionUnderTest(), principal01.record, principal03.record, True)
+        yield self.commit()
+
+        # Check proxy mode
+        mode = yield principal02.proxyMode(principal01)
+        self.assertEqual(mode, &quot;read&quot;)
+        mode = yield principal01.proxyMode(principal02)
+        self.assertEqual(mode, &quot;none&quot;)
+        mode = yield principal03.proxyMode(principal01)
+        self.assertEqual(mode, &quot;write&quot;)
+        mode = yield principal01.proxyMode(principal03)
+        self.assertEqual(mode, &quot;none&quot;)
+
+
+    @inlineCallbacks
+    def test_proxyFor(self):
+        &quot;&quot;&quot;
+        Test that L{DirectoryPrincipalResource.proxyFor} returns the correct results.
+        &quot;&quot;&quot;
+        principal01 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user01&quot;)))
+        principal02 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user02&quot;)))
+        principal03 = yield self.principalRootResource.principalForUID((yield self.userUIDFromShortName(&quot;user03&quot;)))
+
+        # Check proxy for
+        proxies = yield principal01.proxyFor(False)
+        self.assertEqual(proxies, set())
+        proxies = yield principal01.proxyFor(True)
+        self.assertEqual(proxies, set())
+        proxies = yield principal02.proxyFor(False)
+        self.assertEqual(proxies, set())
+        proxies = yield principal02.proxyFor(True)
+        self.assertEqual(proxies, set())
+        proxies = yield principal03.proxyFor(False)
+        self.assertEqual(proxies, set())
+        proxies = yield principal03.proxyFor(True)
+        self.assertEqual(proxies, set())
+
+        # Make user02 a read-only proxy for user01, and user03 a read-write proxy for user01
+        yield addDelegate(self.transactionUnderTest(), principal01.record, principal02.record, False)
+        yield addDelegate(self.transactionUnderTest(), principal01.record, principal03.record, True)
+        yield self.commit()
+
+        # Check proxy for
+        proxies = yield principal01.proxyFor(False)
+        self.assertEqual(proxies, set())
+        proxies = yield principal01.proxyFor(True)
+        self.assertEqual(proxies, set())
+        proxies = yield principal02.proxyFor(False)
+        self.assertEqual(proxies, set((principal01,)))
+        proxies = yield principal02.proxyFor(True)
+        self.assertEqual(proxies, set())
+        proxies = yield principal03.proxyFor(False)
+        self.assertEqual(proxies, set())
+        proxies = yield principal03.proxyFor(True)
+        self.assertEqual(proxies, set((principal01,)))
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcaldavicalendardirectoryservicepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/icalendardirectoryservice.py (14093 => 14094)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/icalendardirectoryservice.py        2014-10-20 19:21:40 UTC (rev 14093)
+++ CalendarServer/trunk/txdav/caldav/icalendardirectoryservice.py        2014-10-21 16:51:27 UTC (rev 14094)
</span><span class="lines">@@ -116,3 +116,27 @@
</span><span class="cx">         @return: C{True} if it is a proxy.
</span><span class="cx">         @rtype: C{bool}
</span><span class="cx">         &quot;&quot;&quot;
</span><ins>+
+    def proxyMode(other): #@NoSelf
+        &quot;&quot;&quot;
+        Determine the proxy mode this record has in relation to the one specified.
+
+        @param other: record for the possible user proxying to this record
+        @type other: L{CalendarDirectoryRecordMixin}
+        &quot;&quot;&quot;
+
+    def proxyFor(readWrite, ignoreDisabled=True): #@NoSelf
+        &quot;&quot;&quot;
+        Returns the set of records currently delegating to this record
+        with the access indicated by the readWrite argument.  If readWrite is
+        True, then write-access delegators are returned, otherwise the read-
+        only-access delegators are returned.
+
+        @param readWrite: Whether to look up read-write delegators, or
+            read-only delegators
+        @type readWrite: L{bool}
+        @param ignoreDisabled: If L{True} disabled delegators are not returned
+        @type ignoreDisabled: L{bool}
+
+        @return: A Deferred firing with a set of records
+        &quot;&quot;&quot;
</ins></span></pre></div>
<a id="CalendarServertrunktxdavwhodelegatespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/delegates.py (14093 => 14094)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/delegates.py        2014-10-20 19:21:40 UTC (rev 14093)
+++ CalendarServer/trunk/txdav/who/delegates.py        2014-10-21 16:51:27 UTC (rev 14094)
</span><span class="lines">@@ -99,6 +99,10 @@
</span><span class="cx">         returnValue(records)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def expandedMembers(self):
+        return self.members(expanded=True)
+
+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def setMembers(self, memberRecords):
</span><span class="cx">         &quot;&quot;&quot;
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhodirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/directory.py (14093 => 14094)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/directory.py        2014-10-20 19:21:40 UTC (rev 14093)
+++ CalendarServer/trunk/txdav/who/directory.py        2014-10-21 16:51:27 UTC (rev 14094)
</span><span class="lines">@@ -630,18 +630,70 @@
</span><span class="cx">     # For scheduling/freebusy
</span><span class="cx">     @inlineCallbacks
</span><span class="cx">     def isProxyFor(self, other):
</span><del>-        for recordType in (
-            DelegateRecordType.readDelegatorGroup,
-            DelegateRecordType.writeDelegatorGroup,
</del><ins>+        proxymode = yield self.proxyMode(other)
+        returnValue(proxymode != &quot;none&quot;)
+
+
+    @inlineCallbacks
+    def proxyMode(self, other):
+        &quot;&quot;&quot;
+        Determine the proxy mode this record has in relation to the one specified. Note that L{proxyFor} is
+        expensive when there are multiple server pods, so we should expand the proxy record members instead
+        (and that is cheaper).
+
+        @param other: record for the possible user proxying to this record
+        @type other: L{CalendarDirectoryRecordMixin}
+        &quot;&quot;&quot;
+
+        for recordType, result in (
+            (DelegateRecordType.writeDelegateGroup, &quot;write&quot;,),
+            (DelegateRecordType.readDelegateGroup, &quot;read&quot;, ),
</ins><span class="cx">         ):
</span><del>-            delegatorGroup = yield self.service.recordWithShortName(
-                recordType, self.uid
</del><ins>+            delegateGroup = yield other.service.recordWithShortName(
+                recordType, other.uid
</ins><span class="cx">             )
</span><del>-            if delegatorGroup:
-                if other in (yield delegatorGroup.members()):
-                    returnValue(True)
</del><ins>+            if delegateGroup:
+                if self in (yield delegateGroup.expandedMembers()):
+                    returnValue(result)
</ins><span class="cx"> 
</span><ins>+        returnValue(&quot;none&quot;)
</ins><span class="cx"> 
</span><ins>+
+    @inlineCallbacks
+    def proxyFor(self, readWrite, ignoreDisabled=True):
+        &quot;&quot;&quot;
+        Returns the set of records currently delegating to this record
+        with the access indicated by the readWrite argument.  If readWrite is
+        True, then write-access delegators are returned, otherwise the read-
+        only-access delegators are returned.
+
+        @param readWrite: Whether to look up read-write delegators, or
+            read-only delegators
+        @type readWrite: L{bool}
+        @param ignoreDisabled: If L{True} disabled delegators are not returned
+        @type ignoreDisabled: L{bool}
+
+        @return: A Deferred firing with a set of records
+        &quot;&quot;&quot;
+        proxyFors = set()
+
+        proxyRecordType = (
+            DelegateRecordType.writeDelegatorGroup if readWrite else
+            DelegateRecordType.readDelegatorGroup
+        )
+        proxyGroupRecord = yield self.service.recordWithShortName(
+            proxyRecordType, self.uid
+        )
+        if proxyGroupRecord is not None:
+            proxyForRecords = yield proxyGroupRecord.members()
+
+            for record in proxyForRecords:
+                if not ignoreDisabled or record.hasCalendars:
+                    proxyFors.add(record)
+
+        returnValue(proxyFors)
+
+
</ins><span class="cx">     def attendeeProperty(self, params={}):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Returns a pycalendar ATTENDEE property for this record.
</span></span></pre>
</div>
</div>

</body>
</html>