[CalendarServer-changes] [5536] CalendarServer/trunk/twistedcaldav/dropbox.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Apr 27 12:54:26 PDT 2010
Revision: 5536
http://trac.macosforge.org/projects/calendarserver/changeset/5536
Author: cdaboo at apple.com
Date: 2010-04-27 12:54:25 -0700 (Tue, 27 Apr 2010)
Log Message:
-----------
Make sure write proxy can add dropbox attachments.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/dropbox.py
Modified: CalendarServer/trunk/twistedcaldav/dropbox.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dropbox.py 2010-04-27 19:52:04 UTC (rev 5535)
+++ CalendarServer/trunk/twistedcaldav/dropbox.py 2010-04-27 19:54:25 UTC (rev 5536)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2010 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.
@@ -23,17 +23,18 @@
"DropBoxCollectionResource",
]
-from twext.web2.dav.http import ErrorResponse
+from twext.python.log import Logger
from twext.web2 import responsecode
from twext.web2.dav import davxml
+from twext.web2.dav.http import ErrorResponse
from twext.web2.dav.resource import DAVResource, TwistedACLInheritable
+from twext.web2.dav.util import joinURL
-from twext.python.log import Logger
+from twisted.internet.defer import succeed, inlineCallbacks, returnValue
+from twistedcaldav.config import config
from twistedcaldav.customxml import calendarserver_namespace
-from twisted.internet.defer import succeed
-
log = Logger()
class DropBoxHomeResource (DAVResource):
@@ -49,6 +50,35 @@
def http_PUT(self, request):
return responsecode.FORBIDDEN
+ @inlineCallbacks
+ def accessControlList(self, request, *args, **kwargs):
+ """
+ Override this to give write proxies DAV:write-acl privilege so they can add attachments too.
+ """
+
+ acl = (yield super(DropBoxHomeResource, self).accessControlList(request, *args, **kwargs))
+
+ if config.EnableProxyPrincipals:
+ owner = (yield self.ownerPrincipal(request))
+
+ newaces = tuple(acl.children)
+ newaces += (
+ # DAV:write-acl access for this principal's calendar-proxy-write users.
+ davxml.ACE(
+ davxml.Principal(davxml.HRef(joinURL(owner.principalURL(), "calendar-proxy-write/"))),
+ davxml.Grant(
+ davxml.Privilege(davxml.WriteACL()),
+ ),
+ davxml.Protected(),
+ TwistedACLInheritable(),
+ ),
+ )
+
+ returnValue(davxml.ACL(*newaces))
+
+ else:
+ returnValue(acl)
+
class DropBoxCollectionResource (DAVResource):
"""
Drop box resource.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100427/bd688b98/attachment-0001.html>
More information about the calendarserver-changes
mailing list