<!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>[12993] CalendarServer/branches/users/sagen/move2who-4</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/12993">12993</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2014-03-25 09:55:29 -0700 (Tue, 25 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>It passes. test_principal.py. It passes.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolsgatewaypy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectoryprincipalpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorytesttest_principalpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_principal.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavresourcepy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/resource.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavtestutilpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoreschedulingprocessingpy">CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/processing.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoretestutilpy">CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavwhodirectorypy">CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolsgatewaypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -383,92 +383,12 @@
</span><span class="cx"> command_getAddressAttributes = command_getLocationAttributes
</span><span class="cx">
</span><span class="cx">
</span><del>-
-
-
- # @inlineCallbacks
- # def _setAttributes(self, )
- # # Set autoSchedule prior to the updateRecord so that the right
- # # value ends up in memcached
- # principal = principalForPrincipalID(command['GeneratedUID'],
- # directory=self.dir)
- # (yield principal.setAutoSchedule(command.get('AutoSchedule', False)))
- # (yield principal.setAutoAcceptGroup(command.get('AutoAcceptGroup', "")))
-
- # kwargs = {}
- # for key, info in attrMap.iteritems():
- # if key in command:
- # kwargs[info['attr']] = command[key]
- # try:
- # record = (yield updateRecord(False, self.dir, "locations", **kwargs))
- # except DirectoryError, e:
- # self.respondWithError(str(e))
- # return
-
- # readProxies = command.get("ReadProxies", None)
- # writeProxies = command.get("WriteProxies", None)
- # principal = principalForPrincipalID(record.guid, directory=self.dir)
- # (yield setProxies(self.store, principal, readProxies, writeProxies, directory=self.dir))
-
- # yield self.command_getLocationAttributes(command)
-
-
-
</del><span class="cx"> # Resources
</span><span class="cx">
</span><span class="cx"> def command_getResourceList(self, command):
</span><span class="cx"> self.respondWithRecordsOfTypes(self.dir, command, ["resources"])
</span><span class="cx">
</span><span class="cx">
</span><del>- # @inlineCallbacks
- # def command_createResource(self, command):
- # kwargs = {}
- # for key, info in attrMap.iteritems():
- # if key in command:
- # kwargs[info['attr']] = command[key]
-
- # try:
- # record = (yield updateRecord(True, self.dir, "resources", **kwargs))
- # except DirectoryError, e:
- # self.respondWithError(str(e))
- # return
-
- # readProxies = command.get("ReadProxies", None)
- # writeProxies = command.get("WriteProxies", None)
- # principal = principalForPrincipalID(record.guid, directory=self.dir)
- # (yield setProxies(self.store, principal, readProxies, writeProxies, directory=self.dir))
-
- # self.respondWithRecordsOfTypes(self.dir, command, ["resources"])
-
-
- # @inlineCallbacks
- # def command_setResourceAttributes(self, command):
-
- # # Set autoSchedule prior to the updateRecord so that the right
- # # value ends up in memcached
- # principal = principalForPrincipalID(command['GeneratedUID'],
- # directory=self.dir)
- # (yield principal.setAutoSchedule(command.get('AutoSchedule', False)))
- # (yield principal.setAutoAcceptGroup(command.get('AutoAcceptGroup', "")))
-
- # kwargs = {}
- # for key, info in attrMap.iteritems():
- # if key in command:
- # kwargs[info['attr']] = command[key]
- # try:
- # record = (yield updateRecord(False, self.dir, "resources", **kwargs))
- # except DirectoryError, e:
- # self.respondWithError(str(e))
- # return
-
- # readProxies = command.get("ReadProxies", None)
- # writeProxies = command.get("WriteProxies", None)
- # principal = principalForPrincipalID(record.guid, directory=self.dir)
- # (yield setProxies(self.store, principal, readProxies, writeProxies, directory=self.dir))
-
- # yield self.command_getResourceAttributes(command)
-
-
</del><span class="cx"> # deferred
</span><span class="cx"> def command_getLocationAndResourceList(self, command):
</span><span class="cx"> return self.respondWithRecordsOfTypes(self.dir, command, ["locations", "resources"])
</span><span class="lines">@@ -480,40 +400,6 @@
</span><span class="cx"> return self.respondWithRecordsOfTypes(self.dir, command, ["addresses"])
</span><span class="cx">
</span><span class="cx">
</span><del>- # @inlineCallbacks
- # def command_createAddress(self, command):
- # kwargs = {}
- # for key, info in attrMap.iteritems():
- # if key in command:
- # kwargs[info['attr']] = command[key]
-
- # try:
- # yield updateRecord(True, self.dir, "addresses", **kwargs)
- # except DirectoryError, e:
- # self.respondWithError(str(e))
- # return
-
- # self.respondWithRecordsOfTypes(self.dir, command, ["addresses"])
-
-
-
-
- # @inlineCallbacks
- # def command_setAddressAttributes(self, command):
- # kwargs = {}
- # for key, info in attrMap.iteritems():
- # if key in command:
- # kwargs[info['attr']] = command[key]
- # try:
- # yield updateRecord(False, self.dir, "addresses", **kwargs)
- # except DirectoryError, e:
- # self.respondWithError(str(e))
- # return
-
- # yield self.command_getAddressAttributes(command)
-
-
-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def _delete(self, typeName, command):
</span><span class="cx"> uid = command['GeneratedUID']
</span><span class="lines">@@ -649,76 +535,6 @@
</span><span class="cx"> yield self.respondWithProxies(command, record, proxyType)
</span><span class="cx">
</span><span class="cx">
</span><del>-
- # @inlineCallbacks
- # def command_removeWriteProxy(self, command):
- # principal = principalForPrincipalID(command['Principal'], directory=self.dir)
- # if principal is None:
- # self.respondWithError("Principal not found: %s" % (command['Principal'],))
- # return
- # proxy = principalForPrincipalID(command['Proxy'], directory=self.dir)
- # if proxy is None:
- # self.respondWithError("Proxy not found: %s" % (command['Proxy'],))
- # return
- # try:
- # (yield removeProxy(self.root, self.dir, self.store, principal, proxy, proxyTypes=("write",)))
- # except ProxyError, e:
- # self.respondWithError(str(e))
- # return
- # except ProxyWarning, e:
- # pass
- # (yield self.respondWithProxies(self.dir, command, principal, "write"))
-
-
- # @inlineCallbacks
- # def command_listReadProxies(self, command):
- # principal = principalForPrincipalID(command['Principal'], directory=self.dir)
- # if principal is None:
- # self.respondWithError("Principal not found: %s" % (command['Principal'],))
- # return
- # (yield self.respondWithProxies(self.dir, command, principal, "read"))
-
-
- # @inlineCallbacks
- # def command_addReadProxy(self, command):
- # principal = principalForPrincipalID(command['Principal'], directory=self.dir)
- # if principal is None:
- # self.respondWithError("Principal not found: %s" % (command['Principal'],))
- # return
- # proxy = principalForPrincipalID(command['Proxy'], directory=self.dir)
- # if proxy is None:
- # self.respondWithError("Proxy not found: %s" % (command['Proxy'],))
- # return
- # try:
- # (yield addProxy(self.root, self.dir, self.store, principal, "read", proxy))
- # except ProxyError, e:
- # self.respondWithError(str(e))
- # return
- # except ProxyWarning, e:
- # pass
- # (yield self.respondWithProxies(self.dir, command, principal, "read"))
-
-
- # @inlineCallbacks
- # def command_removeReadProxy(self, command):
- # principal = principalForPrincipalID(command['Principal'], directory=self.dir)
- # if principal is None:
- # self.respondWithError("Principal not found: %s" % (command['Principal'],))
- # return
- # proxy = principalForPrincipalID(command['Proxy'], directory=self.dir)
- # if proxy is None:
- # self.respondWithError("Proxy not found: %s" % (command['Proxy'],))
- # return
- # try:
- # (yield removeProxy(self.root, self.dir, self.store, principal, proxy, proxyTypes=("read",)))
- # except ProxyError, e:
- # self.respondWithError(str(e))
- # return
- # except ProxyWarning, e:
- # pass
- # (yield self.respondWithProxies(self.dir, command, principal, "read"))
-
-
</del><span class="cx"> @inlineCallbacks
</span><span class="cx"> def command_purgeOldEvents(self, command):
</span><span class="cx"> """
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectoryprincipalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/principal.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -1161,6 +1161,7 @@
</span><span class="cx">
</span><span class="cx"> @param organizer: the CUA of the organizer trying to schedule this principal
</span><span class="cx"> @type organizer: C{str}
</span><ins>+ @return: C{Deferred} firing a C{bool}
</ins><span class="cx"> """
</span><span class="cx"> return self.record.canAutoSchedule(organizer)
</span><span class="cx">
</span><span class="lines">@@ -1184,9 +1185,8 @@
</span><span class="cx">
</span><span class="cx"> @param organizer: the CUA of the organizer scheduling this principal
</span><span class="cx"> @type organizer: C{str}
</span><del>- @return: auto schedule mode; one of: none, accept-always, decline-always,
- accept-if-free, decline-if-busy, automatic (see stdconfig.py)
- @rtype: C{str}
</del><ins>+ @return: auto schedule mode
+ @rtype: C{Deferred} firing L{AutoScheduleMode}
</ins><span class="cx"> """
</span><span class="cx"> return self.record.getAutoScheduleMode(organizer)
</span><span class="cx">
</span><span class="lines">@@ -1222,7 +1222,7 @@
</span><span class="cx"> @type organizer: C{str}
</span><span class="cx"> @return: True if the autoAcceptGroup is assigned, and the organizer is a member
</span><span class="cx"> of that group. False otherwise.
</span><del>- @rtype: C{bool}
</del><ins>+ @rtype: C{Deferred} firing C{bool}
</ins><span class="cx"> """
</span><span class="cx"> return self.record.autoAcceptFromOrganizer()
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorytesttest_principalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_principal.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_principal.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_principal.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -15,18 +15,15 @@
</span><span class="cx"> ##
</span><span class="cx"> from __future__ import print_function
</span><span class="cx">
</span><del>-import os
</del><span class="cx"> from urllib import quote
</span><span class="cx">
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><span class="cx"> from twisted.cred.credentials import UsernamePassword
</span><span class="cx">
</span><del>-from txweb2.dav.fileop import rmdir
</del><span class="cx"> from txweb2.dav.resource import AccessDeniedError
</span><span class="cx"> from txweb2.http import HTTPError
</span><span class="cx"> from txweb2.test.test_server import SimpleRequest
</span><span class="cx">
</span><del>-from txdav.common.datastore.file import CommonDataStore
</del><span class="cx"> from txdav.xml import element as davxml
</span><span class="cx">
</span><span class="cx"> from twistedcaldav import carddavxml
</span><span class="lines">@@ -34,21 +31,16 @@
</span><span class="cx"> from twistedcaldav.caldavxml import caldav_namespace
</span><span class="cx"> from twistedcaldav.config import config
</span><span class="cx"> from twistedcaldav.customxml import calendarserver_namespace
</span><del>-from twistedcaldav.directory.addressbook import (
- DirectoryAddressBookHomeProvisioningResource
-)
-from twistedcaldav.directory.calendar import (
- DirectoryCalendarHomeProvisioningResource
-)
</del><span class="cx"> from twistedcaldav.directory.principal import (
</span><span class="cx"> DirectoryCalendarPrincipalResource,
</span><span class="cx"> DirectoryPrincipalResource,
</span><span class="cx"> DirectoryPrincipalTypeProvisioningResource,
</span><span class="cx"> )
</span><span class="cx"> from twistedcaldav.test.util import StoreTestCase
</span><ins>+from txdav.who.idirectory import AutoScheduleMode, RecordType as CalRecordType
+from twext.who.idirectory import RecordType
</ins><span class="cx">
</span><span class="cx">
</span><del>-
</del><span class="cx"> class ProvisionedPrincipals(StoreTestCase):
</span><span class="cx"> """
</span><span class="cx"> Directory service provisioned principals.
</span><span class="lines">@@ -80,7 +72,7 @@
</span><span class="cx"> #print("\n -> %s" % (directory.__class__.__name__,))
</span><span class="cx"> provisioningResource = self.principalRootResource
</span><span class="cx">
</span><del>- provisioningURL = "/" + self.directory.__class__.__name__ + "/"
</del><ins>+ provisioningURL = "/principals/"
</ins><span class="cx"> self.assertEquals(
</span><span class="cx"> provisioningURL,
</span><span class="cx"> provisioningResource.principalCollectionURL()
</span><span class="lines">@@ -93,11 +85,18 @@
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> recordTypes = set((yield provisioningResource.listChildren()))
</span><del>- self.assertEquals(recordTypes, set(self.directory.recordTypes()))
</del><ins>+ self.assertEquals(
+ recordTypes,
+ set(
+ [
+ self.directory.recordTypeToOldName(rt) for rt in
+ self.directory.recordTypes()
+ ]
+ )
+ )
</ins><span class="cx">
</span><span class="cx"> for recordType in recordTypes:
</span><del>- #print(" -> %s" % (recordType,))
- typeResource = provisioningResource.getChild(recordType)
</del><ins>+ typeResource = yield provisioningResource.getChild(recordType)
</ins><span class="cx"> self.failUnless(
</span><span class="cx"> isinstance(
</span><span class="cx"> typeResource,
</span><span class="lines">@@ -123,7 +122,9 @@
</span><span class="cx"> # Handle records with mulitple shortNames
</span><span class="cx"> expected = []
</span><span class="cx"> for r in (
</span><del>- yield self.directory.recordsWithRecordType(recordType)
</del><ins>+ yield self.directory.recordsWithRecordType(
+ self.directory.oldNameToRecordType(recordType)
+ )
</ins><span class="cx"> ):
</span><span class="cx"> if r.uid != "disabled":
</span><span class="cx"> expected.extend(r.shortNames)
</span><span class="lines">@@ -137,7 +138,7 @@
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> # shortName may be non-ascii
</span><del>- recordURL = typeURL + quote(shortName) + "/"
</del><ins>+ recordURL = typeURL + quote(shortName.encode("utf-8")) + "/"
</ins><span class="cx"> self.assertIn(
</span><span class="cx"> recordURL,
</span><span class="cx"> (
</span><span class="lines">@@ -298,7 +299,7 @@
</span><span class="cx"> self.failIf(principal is not None)
</span><span class="cx">
</span><span class="cx"> # Explicitly check the disabled record
</span><del>- provisioningResource = self.principalRootResource
</del><ins>+ provisioningResource = yield self.actualRoot.getChild("principals")
</ins><span class="cx">
</span><span class="cx"> self.failUnlessIdentical(
</span><span class="cx"> (
</span><span class="lines">@@ -413,9 +414,9 @@
</span><span class="cx"> yield hasProperty(
</span><span class="cx"> (calendarserver_namespace, "calendar-proxy-write-for")
</span><span class="cx"> )
</span><del>- yield hasProperty(
- (calendarserver_namespace, "auto-schedule")
- )
</del><ins>+ # yield hasProperty(
+ # (calendarserver_namespace, "auto-schedule")
+ # )
</ins><span class="cx"> else:
</span><span class="cx"> yield doesNotHaveProperty(
</span><span class="cx"> (caldav_namespace, "calendar-home-set")
</span><span class="lines">@@ -438,9 +439,9 @@
</span><span class="cx"> yield doesNotHaveProperty(
</span><span class="cx"> (calendarserver_namespace, "calendar-proxy-write-for")
</span><span class="cx"> )
</span><del>- yield doesNotHaveProperty(
- (calendarserver_namespace, "auto-schedule")
- )
</del><ins>+ # yield doesNotHaveProperty(
+ # (calendarserver_namespace, "auto-schedule")
+ # )
</ins><span class="cx">
</span><span class="cx"> if record.hasContacts:
</span><span class="cx"> yield hasProperty(carddavxml.AddressBookHomeSet.qname())
</span><span class="lines">@@ -578,8 +579,7 @@
</span><span class="cx"> for (
</span><span class="cx"> provisioningResource, recordType, recordResource, record
</span><span class="cx"> ) in (yield self._allRecords()):
</span><del>- if True: # user.enabled:
- self.assertEquals(record.guid, recordResource.principalUID())
</del><ins>+ self.assertEquals(record.uid, recordResource.principalUID())
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -610,10 +610,21 @@
</span><span class="cx"> provisioningResource, recordType, recordResource, record
</span><span class="cx"> ) in (yield self._allRecords()):
</span><span class="cx"> if record.hasCalendars:
</span><del>- self.failUnless(
- recordResource.canonicalCalendarUserAddress()
- .startswith("urn:uuid:")
- )
</del><ins>+ if self.directory.fieldName.guid in record.fields:
+ self.failUnless(
+ recordResource.canonicalCalendarUserAddress()
+ .startswith("urn:uuid:")
+ )
+ elif self.directory.fieldName.emailAddresses in record.fields:
+ self.failUnless(
+ recordResource.canonicalCalendarUserAddress()
+ .startswith("mailto:")
+ )
+ else:
+ self.failUnless(
+ recordResource.canonicalCalendarUserAddress()
+ .startswith("/principals/__uids__/")
+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -621,27 +632,7 @@
</span><span class="cx"> """
</span><span class="cx"> DirectoryPrincipalResource.addressBookHomeURLs(),
</span><span class="cx"> """
</span><del>- # No addressbook home provisioner should result in no addressbook
- # homes.
- for (
- provisioningResource, recordType, recordResource, record
- ) in (yield self._allRecords()):
- if record.hasContacts:
- self.failIf(tuple(recordResource.addressBookHomeURLs()))
</del><span class="cx">
</span><del>- path = os.path.join(self.docroot, self.directory.__class__.__name__)
-
- if os.path.exists(path):
- rmdir(path)
- os.mkdir(path)
-
- addressBookRootResource = DirectoryAddressBookHomeProvisioningResource(
- self.directory,
- "/addressbooks/",
- self.storeUnderTest()
- )
-
- # AddressBook home provisioners should result in addressBook homes.
</del><span class="cx"> for (
</span><span class="cx"> provisioningResource, recordType, recordResource, record
</span><span class="cx"> ) in (yield self._allRecords()):
</span><span class="lines">@@ -655,6 +646,7 @@
</span><span class="cx"> self.failIf(tuple(recordResource.addressBookHomeURLs()))
</span><span class="cx"> record.hasContacts = True
</span><span class="cx">
</span><ins>+ addressBookRootResource = yield self.actualRoot.getChild("addressbooks")
</ins><span class="cx"> addressBookRootURL = addressBookRootResource.url()
</span><span class="cx">
</span><span class="cx"> for homeURL in homeURLs:
</span><span class="lines">@@ -668,36 +660,36 @@
</span><span class="cx"> DirectoryPrincipalResource.scheduleInboxURL(),
</span><span class="cx"> DirectoryPrincipalResource.scheduleOutboxURL()
</span><span class="cx"> """
</span><del>- # No calendar home provisioner should result in no calendar homes.
- for (
- provisioningResource, recordType, recordResource, record
- ) in (yield self._allRecords()):
- if record.hasCalendars:
- self.failIf(tuple(recordResource.calendarHomeURLs()))
- self.failIf(recordResource.scheduleInboxURL())
- self.failIf(recordResource.scheduleOutboxURL())
</del><ins>+ # # No calendar home provisioner should result in no calendar homes.
+ # for (
+ # provisioningResource, recordType, recordResource, record
+ # ) in (yield self._allRecords()):
+ # if record.hasCalendars:
+ # self.failIf(tuple(recordResource.calendarHomeURLs()))
+ # self.failIf(recordResource.scheduleInboxURL())
+ # self.failIf(recordResource.scheduleOutboxURL())
</ins><span class="cx">
</span><del>- # Need to create a calendar home provisioner for each service.
- calendarRootResources = {}
</del><ins>+ # # Need to create a calendar home provisioner for each service.
+ # calendarRootResources = {}
</ins><span class="cx">
</span><del>- path = os.path.join(self.docroot, self.directory.__class__.__name__)
</del><ins>+ # path = os.path.join(self.docroot, self.directory.__class__.__name__)
</ins><span class="cx">
</span><del>- if os.path.exists(path):
- rmdir(path)
- os.mkdir(path)
</del><ins>+ # if os.path.exists(path):
+ # rmdir(path)
+ # os.mkdir(path)
</ins><span class="cx">
</span><del>- # Need a data store
- _newStore = CommonDataStore(path, None, None, True, False)
</del><ins>+ # # Need a data store
+ # _newStore = CommonDataStore(path, None, None, True, False)
</ins><span class="cx">
</span><del>- provisioningResource = DirectoryCalendarHomeProvisioningResource(
- self.directory,
- "/calendars/",
- _newStore
- )
</del><ins>+ # provisioningResource = DirectoryCalendarHomeProvisioningResource(
+ # self.directory,
+ # "/calendars/",
+ # _newStore
+ # )
</ins><span class="cx">
</span><del>- calendarRootResources[self.directory.__class__.__name__] = (
- provisioningResource
- )
</del><ins>+ # calendarRootResources[self.directory.__class__.__name__] = (
+ # provisioningResource
+ # )
</ins><span class="cx">
</span><span class="cx"> # Calendar home provisioners should result in calendar homes.
</span><span class="cx"> for (
</span><span class="lines">@@ -713,11 +705,8 @@
</span><span class="cx"> self.failIf(tuple(recordResource.calendarHomeURLs()))
</span><span class="cx"> record.hasCalendars = True
</span><span class="cx">
</span><del>- calendarRootURL = (
- calendarRootResources[
- record.service.__class__.__name__
- ].url()
- )
</del><ins>+ calendarRootResource = yield self.rootResource.getChild("calendars")
+ calendarRootURL = calendarRootResource.url()
</ins><span class="cx">
</span><span class="cx"> inboxURL = recordResource.scheduleInboxURL()
</span><span class="cx"> outboxURL = recordResource.scheduleOutboxURL()
</span><span class="lines">@@ -748,26 +737,31 @@
</span><span class="cx"> DirectoryPrincipalResource.canAutoSchedule()
</span><span class="cx"> """
</span><span class="cx">
</span><del>- # Set all resources and locations to auto-schedule, plus one user
- for (
- provisioningResource, recordType, recordResource, record
- ) in (yield self._allRecords()):
- if record.hasCalendars:
- if (
- recordType in ("locations", "resources") or
- record.uid == "cdaboo"
- ):
- recordResource.record.autoSchedule = True
</del><ins>+ # This test used to set the autoschedule mode in a separate loop, but
+ # the records aren't cached, so I've moved this into the later loop
</ins><span class="cx">
</span><ins>+ # # Set all resources and locations to auto-schedule, plus one user
+ # for (
+ # provisioningResource, recordType, recordResource, record
+ # ) in (yield self._allRecords()):
+ # if record.hasCalendars:
+ # print("before", record, record.recordType, record.uid)
+ # if (
+ # recordType in (CalRecordType.location, CalRecordType.resource) or
+ # record.uid == "5A985493-EE2C-4665-94CF-4DFEA3A89500"
+ # ):
+ # record.fields[record.service.fieldName.lookupByName("autoScheduleMode")] = AutoScheduleMode.acceptIfFreeDeclineIfBusy
+ # print("modifying", record, record.fields)
+
</ins><span class="cx"> # Default state - resources and locations, enabled, others not
</span><span class="cx"> for (
</span><span class="cx"> provisioningResource, recordType, recordResource, record
</span><span class="cx"> ) in (yield self._allRecords()):
</span><span class="cx"> if record.hasCalendars:
</span><del>- if recordType in ("locations", "resources"):
- self.assertTrue(recordResource.canAutoSchedule())
</del><ins>+ if recordType in (CalRecordType.location, CalRecordType.resource):
+ self.assertTrue((yield recordResource.canAutoSchedule()))
</ins><span class="cx"> else:
</span><del>- self.assertFalse(recordResource.canAutoSchedule())
</del><ins>+ self.assertFalse((yield recordResource.canAutoSchedule()))
</ins><span class="cx">
</span><span class="cx"> # Set config to allow users
</span><span class="cx"> self.patch(config.Scheduling.Options.AutoSchedule, "AllowUsers", True)
</span><span class="lines">@@ -776,12 +770,14 @@
</span><span class="cx"> ) in (yield self._allRecords()):
</span><span class="cx"> if record.hasCalendars:
</span><span class="cx"> if (
</span><del>- recordType in ("locations", "resources") or
- record.uid == "cdaboo"
</del><ins>+ recordType in (CalRecordType.location, CalRecordType.resource) or
+ record.uid == "5A985493-EE2C-4665-94CF-4DFEA3A89500"
</ins><span class="cx"> ):
</span><del>- self.assertTrue(recordResource.canAutoSchedule())
</del><ins>+ record.fields[record.service.fieldName.lookupByName("autoScheduleMode")] = AutoScheduleMode.acceptIfFreeDeclineIfBusy
+
+ self.assertTrue((yield recordResource.canAutoSchedule()))
</ins><span class="cx"> else:
</span><del>- self.assertFalse(recordResource.canAutoSchedule())
</del><ins>+ self.assertFalse((yield recordResource.canAutoSchedule()))
</ins><span class="cx">
</span><span class="cx"> # Set config to disallow all
</span><span class="cx"> self.patch(config.Scheduling.Options.AutoSchedule, "Enabled", False)
</span><span class="lines">@@ -789,7 +785,7 @@
</span><span class="cx"> provisioningResource, recordType, recordResource, record
</span><span class="cx"> ) in (yield self._allRecords()):
</span><span class="cx"> if record.hasCalendars:
</span><del>- self.assertFalse(recordResource.canAutoSchedule())
</del><ins>+ self.assertFalse((yield recordResource.canAutoSchedule()))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -808,18 +804,22 @@
</span><span class="cx"> if record.uid == "apollo":
</span><span class="cx">
</span><span class="cx"> # No organizer
</span><del>- self.assertFalse(recordResource.canAutoSchedule())
</del><ins>+ self.assertFalse((yield recordResource.canAutoSchedule()))
</ins><span class="cx">
</span><span class="cx"> # Organizer in auto-accept group
</span><span class="cx"> self.assertTrue(
</span><del>- recordResource.canAutoSchedule(
- organizer="mailto:wsanchez@example.com"
</del><ins>+ (
+ yield recordResource.canAutoSchedule(
+ organizer="mailto:wsanchez@example.com"
+ )
</ins><span class="cx"> )
</span><span class="cx"> )
</span><span class="cx"> # Organizer not in auto-accept group
</span><span class="cx"> self.assertFalse(
</span><del>- recordResource.canAutoSchedule(
- organizer="mailto:a@example.com"
</del><ins>+ (
+ yield recordResource.canAutoSchedule(
+ organizer="mailto:a@example.com"
+ )
</ins><span class="cx"> )
</span><span class="cx"> )
</span><span class="cx">
</span><span class="lines">@@ -883,34 +883,34 @@
</span><span class="cx"> expected = (
</span><span class="cx"> (
</span><span class="cx"> "DAV:", "displayname",
</span><del>- "morgen", "fullName", "morgen"
</del><ins>+ "morgen", "fullNames", "morgen"
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "urn:ietf:params:xml:ns:caldav", "calendar-user-type",
</span><del>- "INDIVIDUAL", "recordType", "users"
</del><ins>+ "INDIVIDUAL", "recordType", RecordType.user
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "urn:ietf:params:xml:ns:caldav", "calendar-user-type",
</span><del>- "GROUP", "recordType", "groups"
</del><ins>+ "GROUP", "recordType", RecordType.group
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "urn:ietf:params:xml:ns:caldav", "calendar-user-type",
</span><del>- "RESOURCE", "recordType", "resources"
</del><ins>+ "RESOURCE", "recordType", CalRecordType.resource
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "urn:ietf:params:xml:ns:caldav", "calendar-user-type",
</span><del>- "ROOM", "recordType", "locations"
</del><ins>+ "ROOM", "recordType", CalRecordType.location
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "urn:ietf:params:xml:ns:caldav", "calendar-user-address-set",
</span><span class="cx"> "/principals/__uids__/AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA/",
</span><del>- "guid", "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"
</del><ins>+ "uid", "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "urn:ietf:params:xml:ns:caldav", "calendar-user-address-set",
</span><span class="cx"> "http://example.com:8008/principals/__uids__/"
</span><span class="cx"> "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA/",
</span><del>- "guid", "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"
</del><ins>+ "uid", "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "urn:ietf:params:xml:ns:caldav", "calendar-user-address-set",
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavresourcepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/resource.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/resource.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/resource.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -1872,12 +1872,12 @@
</span><span class="cx"> *[element.HRef(principal.principalURL()) for principal in results]
</span><span class="cx"> ))
</span><span class="cx">
</span><del>- elif name == "auto-schedule" and self.calendarsEnabled():
- autoSchedule = self.getAutoSchedule()
- returnValue(customxml.AutoSchedule("true" if autoSchedule else "false"))
</del><ins>+ # elif name == "auto-schedule" and self.calendarsEnabled():
+ # autoSchedule = self.getAutoSchedule()
+ # returnValue(customxml.AutoSchedule("true" if autoSchedule else "false"))
</ins><span class="cx">
</span><span class="cx"> elif name == "auto-schedule-mode" and self.calendarsEnabled():
</span><del>- autoScheduleMode = self.getAutoScheduleMode()
</del><ins>+ autoScheduleMode = yield self.getAutoScheduleMode()
</ins><span class="cx"> returnValue(customxml.AutoScheduleMode(autoScheduleMode.description if autoScheduleMode else "default"))
</span><span class="cx">
</span><span class="cx"> elif namespace == carddav_namespace and self.addressBooksEnabled():
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavtestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/test/util.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -183,6 +183,8 @@
</span><span class="cx"> resources = FilePath(config.DataRoot).child("resources.xml")
</span><span class="cx"> resources.setContent(resourcesFile.getContent())
</span><span class="cx">
</span><ins>+ augments = FilePath(config.DataRoot).child("augments.xml")
+ augments.setContent(augmentsFile.getContent())
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> class TestCase(txweb2.dav.test.util.TestCase):
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoreschedulingprocessingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/processing.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/processing.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/scheduling/processing.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -434,9 +434,9 @@
</span><span class="cx">
</span><span class="cx"> # Handle auto-reply behavior
</span><span class="cx"> organizer = normalizeCUAddr(self.message.getOrganizer())
</span><del>- if self.recipient.principal.canAutoSchedule(organizer=organizer):
</del><ins>+ if (yield self.recipient.principal.canAutoSchedule(organizer=organizer)):
</ins><span class="cx"> # auto schedule mode can depend on who the organizer is
</span><del>- mode = self.recipient.principal.getAutoScheduleMode(organizer=organizer)
</del><ins>+ mode = yield self.recipient.principal.getAutoScheduleMode(organizer=organizer)
</ins><span class="cx"> send_reply, store_inbox, partstat = (yield self.checkAttendeeAutoReply(new_calendar, mode))
</span><span class="cx">
</span><span class="cx"> # Only store inbox item when reply is not sent or always for users
</span><span class="lines">@@ -467,9 +467,9 @@
</span><span class="cx">
</span><span class="cx"> # Handle auto-reply behavior
</span><span class="cx"> organizer = normalizeCUAddr(self.message.getOrganizer())
</span><del>- if self.recipient.principal.canAutoSchedule(organizer=organizer) and not hasattr(self.txn, "doing_attendee_refresh"):
</del><ins>+ if (yield self.recipient.principal.canAutoSchedule(organizer=organizer)) and not hasattr(self.txn, "doing_attendee_refresh"):
</ins><span class="cx"> # auto schedule mode can depend on who the organizer is
</span><del>- mode = self.recipient.principal.getAutoScheduleMode(organizer=organizer)
</del><ins>+ mode = yield self.recipient.principal.getAutoScheduleMode(organizer=organizer)
</ins><span class="cx"> send_reply, store_inbox, partstat = (yield self.checkAttendeeAutoReply(new_calendar, mode))
</span><span class="cx">
</span><span class="cx"> # Only store inbox item when reply is not sent or always for users
</span><span class="lines">@@ -548,7 +548,7 @@
</span><span class="cx"> # inbox item on them even if auto-schedule is true so that they get a notification
</span><span class="cx"> # of the cancel.
</span><span class="cx"> organizer = normalizeCUAddr(self.message.getOrganizer())
</span><del>- autoprocessed = self.recipient.principal.canAutoSchedule(organizer=organizer)
</del><ins>+ autoprocessed = yield self.recipient.principal.canAutoSchedule(organizer=organizer)
</ins><span class="cx"> store_inbox = not autoprocessed or self.recipient.principal.getCUType() == "INDIVIDUAL"
</span><span class="cx">
</span><span class="cx"> # Check to see if this is a cancel of the entire event
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavcaldavdatastoretestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/caldav/datastore/test/util.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -109,11 +109,11 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def canAutoSchedule(self, organizer):
</span><del>- return False
</del><ins>+ return succeed(False)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def getAutoScheduleMode(self, organizer):
</span><del>- return "automatic"
</del><ins>+ return succeed("automatic")
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def isProxyFor(self, other):
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavwhodirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py (12992 => 12993)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py        2014-03-24 19:36:48 UTC (rev 12992)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py        2014-03-25 16:55:29 UTC (rev 12993)
</span><span class="lines">@@ -27,7 +27,9 @@
</span><span class="cx"> from twext.who.idirectory import RecordType as BaseRecordType
</span><span class="cx"> from twisted.cred.credentials import UsernamePassword
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><del>-from txdav.who.idirectory import RecordType as DAVRecordType
</del><ins>+from txdav.who.idirectory import (
+ RecordType as DAVRecordType, AutoScheduleMode
+)
</ins><span class="cx"> from txweb2.auth.digest import DigestedCredentials
</span><span class="cx">
</span><span class="cx"> log = Logger()
</span><span class="lines">@@ -249,9 +251,9 @@
</span><span class="cx"> except AttributeError:
</span><span class="cx"> # No guid
</span><span class="cx"> pass
</span><del>- cuas.add("/principals/__uids__/{uid}/".format(uid=self.uid))
</del><ins>+ cuas.add(u"/principals/__uids__/{uid}/".format(uid=self.uid))
</ins><span class="cx"> for shortName in self.shortNames:
</span><del>- cuas.add("/principals/{rt}/{sn}/".format(
</del><ins>+ cuas.add(u"/principals/{rt}/{sn}/".format(
</ins><span class="cx"> rt=self.service.recordTypeToOldName(self.recordType),
</span><span class="cx"> sn=shortName)
</span><span class="cx"> )
</span><span class="lines">@@ -341,15 +343,17 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def enabledAsOrganizer(self):
</span><del>- # MOVE2WHO FIXME TO LOOK AT CONFIG
</del><ins>+ # FIXME:
+ from twistedcaldav.config import config
+
</ins><span class="cx"> if self.recordType == self.service.recordType.user:
</span><span class="cx"> return True
</span><span class="cx"> elif self.recordType == self.service.recordType.group:
</span><del>- return False # config.Scheduling.Options.AllowGroupAsOrganizer
</del><ins>+ return config.Scheduling.Options.AllowGroupAsOrganizer
</ins><span class="cx"> elif self.recordType == self.service.recordType.location:
</span><del>- return False # config.Scheduling.Options.AllowLocationAsOrganizer
</del><ins>+ return config.Scheduling.Options.AllowLocationAsOrganizer
</ins><span class="cx"> elif self.recordType == self.service.recordType.resource:
</span><del>- return False # config.Scheduling.Options.AllowResourceAsOrganizer
</del><ins>+ return config.Scheduling.Options.AllowResourceAsOrganizer
</ins><span class="cx"> else:
</span><span class="cx"> return False
</span><span class="cx">
</span><span class="lines">@@ -363,18 +367,50 @@
</span><span class="cx"> return self.loginAllowed
</span><span class="cx">
</span><span class="cx">
</span><del>- #MOVE2WHO
</del><span class="cx"> def calendarsEnabled(self):
</span><del>- # In the old world, this *also* looked at config:
- # return config.EnableCalDAV and self.enabledForCalendaring
- return self.hasCalendars
</del><ins>+ # FIXME:
+ from twistedcaldav.config import config
</ins><span class="cx">
</span><ins>+ return config.EnableCalDAV and self.hasCalendars
</ins><span class="cx">
</span><ins>+
+
+ @inlineCallbacks
+ def canAutoSchedule(self, organizer=None):
+ # FIXME:
+ from twistedcaldav.config import config
+
+ if config.Scheduling.Options.AutoSchedule.Enabled:
+ if (
+ config.Scheduling.Options.AutoSchedule.Always or
+ self.autoScheduleMode not in (AutoScheduleMode.none, None) or # right???
+ (
+ yield self.autoAcceptFromOrganizer(organizer)
+ )
+ ):
+ if (
+ self.getCUType() != "INDIVIDUAL" or
+ config.Scheduling.Options.AutoSchedule.AllowUsers
+ ):
+ returnValue(True)
+ returnValue(False)
+
+
+ @inlineCallbacks
</ins><span class="cx"> def getAutoScheduleMode(self, organizer):
</span><del>- # MOVE2WHO Fix this to take organizer into account:
- return self.autoScheduleMode
</del><ins>+ autoScheduleMode = self.autoScheduleMode
+ if (yield self.autoAcceptFromOrganizer(organizer)):
+ autoScheduleMode = AutoScheduleMode.acceptIfFreeDeclineIfBusy
+ returnValue(autoScheduleMode)
</ins><span class="cx">
</span><span class="cx">
</span><del>- def canAutoSchedule(self, organizer=None):
- # MOVE2WHO Fix this:
- return True
</del><ins>+ @inlineCallbacks
+ def autoAcceptFromOrganizer(self, organizer):
+ if organizer is not None and self.autoAcceptGroup is not None:
+ service = self.service
+ organizerRecord = yield service.recordWithCalendarUserAddress(organizer)
+ if organizerRecord is not None:
+ autoAcceptGroup = yield service.recordWithUID(self.autoAcceptGroup)
+ if organizerRecord.uid in (yield autoAcceptGroup.members()):
+ returnValue(True)
+ returnValue(False)
</ins></span></pre>
</div>
</div>
</body>
</html>