Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge from trunk

  • Loading branch information
m0rgen committed Mar 8, 2014
2 parents 5cd093e + 4dc6c2f commit f7075d5f230c29d4ec71894dc8923d424c587f4d
Showing with 3,185 additions and 1,494 deletions.
  1. +8 −3 calendarserver/accesslog.py
  2. +2 −2 calendarserver/provision/root.py
  3. +17 −15 calendarserver/push/applepush.py
  4. +38 −19 calendarserver/tap/caldav.py
  5. +2 −1 calendarserver/tap/test/test_util.py
  6. +73 −14 calendarserver/tap/util.py
  7. +1 −1 calendarserver/tools/calverify.py
  8. +423 −396 calendarserver/tools/principals.py
  9. +11 −5 calendarserver/tools/shell/directory.py
  10. +9 −8 calendarserver/tools/test/test_principals.py
  11. +73 −12 calendarserver/tools/util.py
  12. +10 −8 calendarserver/webcal/resource.py
  13. +2 −0 twistedcaldav/customxml.py
  14. +9 −7 twistedcaldav/directory/addressbook.py
  15. +9 −8 twistedcaldav/directory/augment.py
  16. +18 −12 twistedcaldav/directory/calendar.py
  17. +97 −67 twistedcaldav/directory/calendaruserproxy.py
  18. +7 −6 twistedcaldav/directory/common.py
  19. +0 −3 twistedcaldav/directory/directory-principal-resource.html
  20. +4 −3 twistedcaldav/directory/directory.py
  21. +199 −161 twistedcaldav/directory/principal.py
  22. +13 −11 twistedcaldav/directorybackedaddressbook.py
  23. +7 −6 twistedcaldav/extensions.py
  24. +2 −2 twistedcaldav/freebusyurl.py
  25. +12 −7 twistedcaldav/ical.py
  26. +34 −24 twistedcaldav/resource.py
  27. +20 −15 twistedcaldav/scheduling_store/caldav/resource.py
  28. +2 −1 twistedcaldav/sharing.py
  29. +4 −3 twistedcaldav/storebridge.py
  30. +129 −108 twistedcaldav/test/test_icalendar.py
  31. +3 −2 twistedcaldav/test/test_upgrade.py
  32. +3 −2 twistedcaldav/test/util.py
  33. +10 −8 twistedcaldav/timezoneservice.py
  34. +10 −8 twistedcaldav/timezonestdservice.py
  35. +23 −16 twistedcaldav/upgrade.py
  36. +6 −4 twistedcaldav/util.py
  37. +8 −6 txdav/caldav/datastore/scheduling/caldav/scheduler.py
  38. +4 −4 txdav/caldav/datastore/scheduling/freebusy.py
  39. +6 −3 txdav/caldav/datastore/scheduling/imip/inbound.py
  40. +16 −15 txdav/caldav/datastore/scheduling/implicit.py
  41. +10 −7 txdav/caldav/datastore/scheduling/ischedule/delivery.py
  42. +9 −7 txdav/caldav/datastore/scheduling/ischedule/resource.py
  43. +5 −5 txdav/caldav/datastore/scheduling/ischedule/scheduler.py
  44. +29 −11 txdav/caldav/datastore/scheduling/processing.py
  45. +2 −2 txdav/caldav/datastore/scheduling/scheduler.py
  46. +4 −3 txdav/caldav/datastore/scheduling/work.py
  47. +14 −12 txdav/caldav/datastore/sql.py
  48. +1 −1 txdav/caldav/datastore/test/test_attachments.py
  49. +3 −3 txdav/caldav/datastore/test/util.py
  50. +9 −6 txdav/caldav/datastore/util.py
  51. +2 −2 txdav/caldav/icalendardirectoryservice.py
  52. +17 −15 txdav/common/datastore/podding/conduit.py
  53. +9 −7 txdav/common/datastore/podding/resource.py
  54. +18 −6 txdav/common/datastore/podding/test/test_conduit.py
  55. +288 −123 txdav/common/datastore/sql.py
  56. +4 −4 txdav/common/datastore/test/util.py
  57. +164 −14 txdav/dps/client.py
  58. +40 −0 txdav/dps/commands.py
  59. +209 −37 txdav/dps/server.py
  60. +1 −0 txdav/dps/test/test.xml
  61. +12 −0 txdav/dps/test/test_client.py
  62. +258 −0 txdav/who/augment.py
  63. +211 −29 txdav/who/delegates.py
  64. +241 −0 txdav/who/directory.py
  65. +102 −87 txdav/who/groups.py
  66. +1 −0 txdav/who/test/accounts/accounts.xml
  67. +123 −38 txdav/who/test/test_delegates.py
  68. +55 −66 txdav/who/test/test_groups.py
  69. +7 −3 txdav/who/xml.py
  70. +13 −10 txweb2/dav/resource.py
@@ -103,9 +103,14 @@ def convertUIDtoShortName(uid):
else:
return uid

uidn = convertUIDtoShortName(uidn)
if uidz:
uidz = convertUIDtoShortName(uidz)
# MOVE2WHO
# Better to stick the records directly on the request at
# an earlier point, since we can't do anything deferred
# in here.

# uidn = convertUIDtoShortName(uidn)
# if uidz:
# uidz = convertUIDtoShortName(uidz)

if uidn and uidz:
uid = '"%s as %s"' % (uidn, uidz,)
@@ -27,7 +27,7 @@
from txweb2.http import HTTPError, StatusResponse, RedirectResponse

from twisted.cred.error import LoginFailed, UnauthorizedLogin
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.defer import inlineCallbacks, returnValue, succeed
from twisted.python.reflect import namedClass
from twisted.web.xmlrpc import Proxy
from twisted.web.error import Error as WebError
@@ -110,7 +110,7 @@ def deadProperties(self):


def defaultAccessControlList(self):
return config.RootResourceACL
return succeed(config.RootResourceACL)


@inlineCallbacks
@@ -820,23 +820,25 @@ def checkPreconditions(self, request):


def defaultAccessControlList(self):
return davxml.ACL(
# DAV:Read for authenticated principals
davxml.ACE(
davxml.Principal(davxml.Authenticated()),
davxml.Grant(
davxml.Privilege(davxml.Read()),
return succeed(
davxml.ACL(
# DAV:Read for authenticated principals
davxml.ACE(
davxml.Principal(davxml.Authenticated()),
davxml.Grant(
davxml.Privilege(davxml.Read()),
),
davxml.Protected(),
),
davxml.Protected(),
),
# DAV:Write for authenticated principals
davxml.ACE(
davxml.Principal(davxml.Authenticated()),
davxml.Grant(
davxml.Privilege(davxml.Write()),
# DAV:Write for authenticated principals
davxml.ACE(
davxml.Principal(davxml.Authenticated()),
davxml.Grant(
davxml.Privilege(davxml.Write()),
),
davxml.Protected(),
),
davxml.Protected(),
),
)
)


@@ -86,7 +86,7 @@
from txdav.common.datastore.work.revision_cleanup import (
scheduleFirstFindMinRevision
)
from txdav.dps.server import DirectoryProxyServiceMaker
from txdav.dps.server import directoryFromConfig
from txdav.dps.client import DirectoryService as DirectoryProxyClientService
from txdav.who.groups import GroupCacher as NewGroupCacher

@@ -551,8 +551,8 @@ def startService(self):
self.monitor.addProcessObject(process, PARENT_ENVIRONMENT)

if (
config.DirectoryProxy.Enabled and
config.DirectoryProxy.SocketPath != ""
config.DirectoryProxy.Enabled and
config.DirectoryProxy.SocketPath != ""
):
log.info("Adding directory proxy service")

@@ -929,10 +929,10 @@ def makeService_Slave(self, options):
CalDAV and CardDAV requests.
"""
pool, txnFactory = getDBPool(config)
store = storeFromConfig(config, txnFactory)
directory = DirectoryProxyClientService("FIXME")
store = storeFromConfig(config, txnFactory, directory)
logObserver = AMPCommonAccessLoggingObserver()
result = self.requestProcessingService(options, store, logObserver)
directory = store.directoryService()

if pool is not None:
pool.setServiceParent(result)
@@ -1013,14 +1013,17 @@ def queueMasterAvailable(connectionFromMaster):
namespace=config.GroupCaching.MemcachedPool,
useExternalProxies=config.GroupCaching.UseExternalProxies,
)
newGroupCacher = NewGroupCacher(directory)
else:
groupCacher = None
newGroupCacher = None

def decorateTransaction(txn):
txn._pushDistributor = pushDistributor
txn._rootResource = result.rootResource
txn._mailRetriever = mailRetriever
txn._groupCacher = groupCacher
txn._newGroupCacher = newGroupCacher

store.callWithNewTransactions(decorateTransaction)

@@ -1311,6 +1314,13 @@ def slaveSvcCreator(pool, store, logObserver, storageService):
if store is None:
raise StoreNotAvailable()

# Create a Directory Proxy "Server" service and hand it to the
# store.
# FIXME: right now the store passed *to* the directory is the
# calendar/contacts data store, but for a multi-server deployment
# it will need its own separate store.
store.setDirectoryService(directoryFromConfig(config, store=store))

result = self.requestProcessingService(options, store, logObserver)

# Optionally set up push notifications
@@ -1356,9 +1366,7 @@ def slaveSvcCreator(pool, store, logObserver, storageService):
namespace=config.GroupCaching.MemcachedPool,
useExternalProxies=config.GroupCaching.UseExternalProxies
)
newGroupCacher = NewGroupCacher(
DirectoryProxyClientService(None)
)
newGroupCacher = NewGroupCacher(directory)
else:
groupCacher = None
newGroupCacher = None
@@ -1392,11 +1400,6 @@ def slaveSvcCreator(pool, store, logObserver, storageService):
"manhole_tap could not be imported"
)

# Optionally enable Directory Proxy
if config.DirectoryProxy.Enabled:
dps = DirectoryProxyServiceMaker().makeService(None)
dps.setServiceParent(result)

def decorateTransaction(txn):
txn._pushDistributor = pushDistributor
txn._rootResource = result.rootResource
@@ -1442,7 +1445,7 @@ def decorateTransaction(txn):
Popen(memcachedArgv)

return self.storageService(
slaveSvcCreator, logObserver, uid=uid, gid=gid
slaveSvcCreator, logObserver, uid=uid, gid=gid, directory=None
)


@@ -1455,10 +1458,17 @@ def makeService_Utility(self, options):
"""

def toolServiceCreator(pool, store, ignored, storageService):
# Create a Directory Proxy "Server" service and hand it to the
# store
# FIXME: right now the store passed *to* the directory is the
# calendar/contacts data store, but for a multi-server deployment
# it will need its own separate store.
store.setDirectoryService(directoryFromConfig(config, store=store))
return config.UtilityServiceClass(store)

uid, gid = getSystemIDs(config.UserName, config.GroupName)
return self.storageService(toolServiceCreator, None, uid=uid, gid=gid)
return self.storageService(toolServiceCreator, None, uid=uid, gid=gid,
directory=None)


def makeService_Agent(self, options):
@@ -1506,7 +1516,7 @@ def agentServiceCreator(pool, store, ignored, storageService):


def storageService(
self, createMainService, logObserver, uid=None, gid=None
self, createMainService, logObserver, uid=None, gid=None, directory=None
):
"""
If necessary, create a service to be started used for storage; for
@@ -1532,6 +1542,9 @@ def storageService(
running as root (also the gid to chown Attachments to).
@type gid: C{int}
@param directory: The directory service to use.
@type directory: L{IStoreDirectoryService} or None
@return: the appropriate a service to start.
@rtype: L{IService}
"""
@@ -1546,7 +1559,7 @@ def subServiceFactory(connectionFactory, storageService):
maxConnections=config.MaxDBConnectionsPerPool
)
cp.setServiceParent(ms)
store = storeFromConfig(config, cp.connection)
store = storeFromConfig(config, cp.connection, directory)

pps = PreProcessingService(
createMainService, cp, store, logObserver, storageService
@@ -1671,7 +1684,7 @@ def subServiceFactory(connectionFactory, storageService):
"Unknown database type {}".format(config.DBType)
)
else:
store = storeFromConfig(config, None)
store = storeFromConfig(config, None, directory)
return createMainService(None, store, logObserver, None)


@@ -1938,20 +1951,26 @@ def spawnerSvcCreator(pool, store, ignored, storageService):
namespace=config.GroupCaching.MemcachedPool,
useExternalProxies=config.GroupCaching.UseExternalProxies
)
newGroupCacher = NewGroupCacher(directory)
else:
groupCacher = None
newGroupCacher = None

def decorateTransaction(txn):
txn._pushDistributor = None
txn._rootResource = rootResource
txn._mailRetriever = mailRetriever
txn._groupCacher = groupCacher
txn._newGroupCacher = newGroupCacher

store.callWithNewTransactions(decorateTransaction)

return multi

ssvc = self.storageService(spawnerSvcCreator, None, uid, gid)
ssvc = self.storageService(
spawnerSvcCreator, None, uid, gid,
directory=DirectoryProxyClientService("FIXME")
)
ssvc.setServiceParent(s)
return s

@@ -14,13 +14,14 @@
# limitations under the License.
##

from calendarserver.tap.util import directoryFromConfig, MemoryLimitService, Stepper
from calendarserver.tap.util import MemoryLimitService, Stepper
from twistedcaldav.util import computeProcessCount
from twistedcaldav.test.util import TestCase
from twistedcaldav.config import config
from twistedcaldav.directory.augment import AugmentXMLDB
from twisted.internet.task import Clock
from twisted.internet.defer import succeed, inlineCallbacks
from txdav.dps.server import directoryFromConfig

class ProcessCountTestCase(TestCase):

0 comments on commit f7075d5

Please sign in to comment.
You can’t perform that action at this time.