[CalendarServer-changes] [7455] CalendarServer/branches/users/glyph/new-export/txdav/caldav/ datastore/sql.py

source_changes at macosforge.org source_changes at macosforge.org
Mon May 16 07:42:04 PDT 2011


Revision: 7455
          http://trac.macosforge.org/projects/calendarserver/changeset/7455
Author:   glyph at apple.com
Date:     2011-05-16 07:42:04 -0700 (Mon, 16 May 2011)
Log Message:
-----------
first rough cut at filteredComponent

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/sql.py

Modified: CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/sql.py	2011-05-16 14:41:53 UTC (rev 7454)
+++ CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/sql.py	2011-05-16 14:42:04 UTC (rev 7455)
@@ -67,6 +67,8 @@
 from twext.enterprise.dal.syntax import Parameter
 from twext.enterprise.dal.syntax import utcNowSQL
 from twext.enterprise.dal.syntax import Len
+from twistedcaldav.datafilters.privateevents import PrivateEventFilter
+from twistedcaldav.datafilters.peruserdata import PerUserDataFilter
 from txdav.common.icommondatastore import IndexedSearchException
 
 from pycalendar.datetime import PyCalendarDateTime
@@ -612,6 +614,18 @@
         returnValue(VComponent.fromString((yield self.iCalendarText())))
 
 
+    @inlineCallbacks
+    def filteredComponent(self, accessUID):
+        component = yield self.component()
+        calendar = self.calendar()
+        isOwner = (calendar._owned and
+                   calendar.ownerCalendarHome().uid() == accessUID)
+        for filter in [PrivateEventFilter(self.accessMode, isOwner),
+                       PerUserDataFilter(accessUID)]:
+            component = filter.filter(component)
+        returnValue(component)
+
+
     iCalendarText = CommonObjectResource.text
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110516/4edc1da3/attachment.html>


More information about the calendarserver-changes mailing list