[CalendarServer-changes] [242] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 14:06:32 PDT 2006


Revision: 242
          http://trac.macosforge.org/projects/calendarserver/changeset/242
Author:   cdaboo at apple.com
Date:     2006-10-04 14:06:31 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
Allow any CalDAV resource to be disabled - not just calendar homes.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/static.py

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2006-10-04 16:05:58 UTC (rev 241)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2006-10-04 21:06:31 UTC (rev 242)
@@ -198,6 +198,35 @@
         return super(CalDAVResource, self).writeProperty(property, request)
 
     ##
+    # ACL
+    ##
+
+    def disable(self, disabled=True):
+        """
+        Completely disables all access to this resource, regardless of ACL
+        settings.
+        @param disabled: If true, disabled all access. If false, enables access.
+        """
+        if disabled:
+            self.writeDeadProperty(AccessDisabled())
+        else:
+            self.removeDeadProperty(AccessDisabled())
+
+    def isDisabled(self):
+        """
+        @return: C{True} if access to this resource is disabled, C{False}
+            otherwise.
+        """
+        return self.hasDeadProperty(AccessDisabled)
+
+    # FIXME: Perhaps this is better done in authorize() instead.
+    def accessControlList(self, *args, **kwargs):
+        if self.isDisabled():
+            return succeed(None)
+
+        return super(CalDAVResource, self).accessControlList(*args, **kwargs)
+
+    ##
     # CalDAV
     ##
 
@@ -668,6 +697,13 @@
 # Utilities
 ##
 
+class AccessDisabled (davxml.WebDAVEmptyElement):
+    namespace = davxml.twisted_private_namespace
+    name = "caldav-access-disabled"
+
+davxml.registerElement(AccessDisabled)
+
+
 def isCalendarCollectionResource(resource):
     try:
         resource = ICalDAVResource(resource)

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2006-10-04 16:05:58 UTC (rev 241)
+++ CalendarServer/trunk/twistedcaldav/static.py	2006-10-04 21:06:31 UTC (rev 242)
@@ -599,31 +599,6 @@
             if not child_fp.exists(): child_fp.makedirs()
             self.putChild(name, clazz(child_fp.path))
 
-    def disable(self, disabled=True):
-        """
-        Completely disables all access to this resource, regardless of ACL
-        settings.
-        @param disabled: If true, disabled all access. If false, enables access.
-        """
-        if disabled:
-            self.writeDeadProperty(AccessDisabled())
-        else:
-            self.removeDeadProperty(AccessDisabled())
-
-    def isDisabled(self):
-        """
-        @return: C{True} if access to this resource is disabled, C{False}
-            otherwise.
-        """
-        return self.hasDeadProperty(AccessDisabled)
-
-    # FIXME: Perhaps this is better done in authorize() instead.
-    def accessControlList(self, *args, **kwargs):
-        if self.isDisabled():
-            return succeed(None)
-
-        return super(CalendarHomeFile, self).accessControlList(*args, **kwargs)
-
     def createSimilarFile(self, path):
         return CalDAVFile(path)
 
@@ -950,16 +925,6 @@
     def http_MKCALENDAR (self, request): return responsecode.FORBIDDEN
 
 ##
-# Utilities
-##
-
-class AccessDisabled (davxml.WebDAVEmptyElement):
-    namespace = davxml.twisted_private_namespace
-    name = "caldav-access-disabled"
-
-davxml.registerElement(AccessDisabled)
-
-##
 # Attach methods
 ##
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061004/6861d11a/attachment.html


More information about the calendarserver-changes mailing list