[CalendarServer-changes] [5702] CalendarServer/branches/users/cdaboo/ cached-subscription-calendars-5692/twistedcaldav/method

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 8 13:32:12 PDT 2010


Revision: 5702
          http://trac.macosforge.org/projects/calendarserver/changeset/5702
Author:   cdaboo at apple.com
Date:     2010-06-08 13:32:09 -0700 (Tue, 08 Jun 2010)
Log Message:
-----------
Disable ACL on calendar object resources as caching internet subscriptions do not
take per-user ACLs into account.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/__init__.py

Added Paths:
-----------
    CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/acl.py

Modified: CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/__init__.py
===================================================================
--- CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/__init__.py	2010-06-08 19:56:35 UTC (rev 5701)
+++ CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/__init__.py	2010-06-08 20:32:09 UTC (rev 5702)
@@ -22,6 +22,7 @@
 """
 
 __all__ = [
+    "acl",
     "copymove",
     "delete",
     "get",

Added: CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/acl.py
===================================================================
--- CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/acl.py	                        (rev 0)
+++ CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twistedcaldav/method/acl.py	2010-06-08 20:32:09 UTC (rev 5702)
@@ -0,0 +1,55 @@
+##
+# Copyright (c) 2006-2009 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.
+##
+
+"""
+CalDAV ACL method.
+"""
+
+__all__ = ["http_ACL"]
+
+
+from twext.python.log import Logger
+from twext.web2 import responsecode
+from twext.web2.dav.util import parentForURL
+from twext.web2.http import HTTPError
+
+from twisted.internet.defer import inlineCallbacks, returnValue
+
+from twistedcaldav.resource import isAddressBookCollectionResource,\
+    isPseudoCalendarCollectionResource
+from twistedcaldav.static import AddressBookHomeFile, CalendarHomeFile
+
+log = Logger()
+
+ at inlineCallbacks
+def http_ACL(self, request):
+    #
+    # Override base ACL request handling to ensure that the calendar/address book
+    # homes cannot have ACL's set, and calendar/address object resources too.
+    #
+
+    if self.fp.exists():
+        if isinstance(self, CalendarHomeFile) or isinstance(self, AddressBookHomeFile):
+            raise HTTPError(responsecode.NOT_ALLOWED)
+
+        parentURL = parentForURL(request.uri)
+        parent = (yield request.locateResource(parentURL))
+        if isPseudoCalendarCollectionResource(parent) or isAddressBookCollectionResource(parent):
+            raise HTTPError(responsecode.NOT_ALLOWED)
+
+    # Do normal ACL behavior
+    response = (yield super(CalDAVFile, self).http_ACL(request))
+    returnValue(response)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100608/0dbba8ff/attachment.html>


More information about the calendarserver-changes mailing list