[Pkg-owncloud-commits] [php-sabredav] 17/42: IScheduleObject is now also a ICalendar object.

David Prévot taffit at moszumanska.debian.org
Fri Nov 28 22:47:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit 6b0555a2240862c80e65b385468fc153fb51453c
Author: Evert Pot <me at evertpot.com>
Date:   Fri Nov 14 16:49:36 2014 -0500

    IScheduleObject is now also a ICalendar object.
    
    Fixes #554
---
 ChangeLog.md                              |   2 +-
 lib/CalDAV/Plugin.php                     |   9 +++
 lib/CalDAV/Schedule/ISchedulingObject.php |   2 +-
 lib/CalDAV/Schedule/SchedulingObject.php  | 116 +-----------------------------
 4 files changed, 12 insertions(+), 117 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 56a65ac..e7318b9 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -6,7 +6,7 @@ ChangeLog
 
 * #541: CalDAV PDO backend didn't respect overridden PDO table names.
 * #550: Scheduling invites are no longer delivered into shared calendars.
-
+* #554: `calendar-multiget` `REPORT` did not work on inbox items.
 
 2.1.0-alpha2 (2014-10-23)
 -------------------------
diff --git a/lib/CalDAV/Plugin.php b/lib/CalDAV/Plugin.php
index 8c9f14b..c9141b7 100644
--- a/lib/CalDAV/Plugin.php
+++ b/lib/CalDAV/Plugin.php
@@ -708,6 +708,15 @@ class Plugin extends DAV\ServerPlugin {
         if (!$node instanceof ICalendarObject)
             return;
 
+        // We're onyl interested in ICalendarObject nodes that are inside of a
+        // real calendar. This is to avoid triggering validation and scheduling
+        // for non-calendars (such as an inbox).
+        list($parent) = URLUtil::splitPath($path);
+        $parentNode = $this->server->tree->getNodeForPath($parent);
+
+        if (!$parentNode instanceof ICalendar)
+            return;
+
         $this->validateICalendar(
             $data,
             $path,
diff --git a/lib/CalDAV/Schedule/ISchedulingObject.php b/lib/CalDAV/Schedule/ISchedulingObject.php
index 3c6e26a..f8b8f21 100644
--- a/lib/CalDAV/Schedule/ISchedulingObject.php
+++ b/lib/CalDAV/Schedule/ISchedulingObject.php
@@ -8,6 +8,6 @@ namespace Sabre\CalDAV\Schedule;
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved.
  */
-interface ISchedulingObject extends \Sabre\DAV\IFile {
+interface ISchedulingObject extends \Sabre\CalDAV\ICalendarObject {
 
 }
diff --git a/lib/CalDAV/Schedule/SchedulingObject.php b/lib/CalDAV/Schedule/SchedulingObject.php
index 77cb4b2..8f3d3ce 100644
--- a/lib/CalDAV/Schedule/SchedulingObject.php
+++ b/lib/CalDAV/Schedule/SchedulingObject.php
@@ -12,7 +12,7 @@ use Sabre\DAV\Exception\MethodNotAllowed;
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved.
  */
-class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sabre\DAVACL\IACL {
+class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements ISchedulingObject {
 
     /**
      /* The CalDAV backend
@@ -58,17 +58,6 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
     }
 
     /**
-     * Returns the uri for this object
-     *
-     * @return string
-     */
-    function getName() {
-
-        return $this->objectData['uri'];
-
-    }
-
-    /**
      * Returns the ICalendar-formatted object
      *
      * @return string
@@ -108,64 +97,6 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
     }
 
     /**
-     * Returns the mime content-type
-     *
-     * @return string
-     */
-    function getContentType() {
-
-        $mime = 'text/calendar; charset=utf-8';
-        if (isset($this->objectData['component']) && $this->objectData['component']) {
-            $mime.='; component=' . $this->objectData['component'];
-        }
-        return $mime;
-
-    }
-
-    /**
-     * Returns an ETag for this object.
-     *
-     * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
-     *
-     * @return string
-     */
-    function getETag() {
-
-        if (isset($this->objectData['etag'])) {
-            return $this->objectData['etag'];
-        } else {
-            return '"' . md5($this->get()). '"';
-        }
-
-    }
-
-    /**
-     * Returns the last modification date as a unix timestamp
-     *
-     * @return int
-     */
-    function getLastModified() {
-
-        return $this->objectData['lastmodified'];
-
-    }
-
-    /**
-     * Returns the size of this object in bytes
-     *
-     * @return int
-     */
-    function getSize() {
-
-        if (array_key_exists('size',$this->objectData)) {
-            return $this->objectData['size'];
-        } else {
-            return strlen($this->get());
-        }
-
-    }
-
-    /**
      * Returns the owner principal
      *
      * This must be a url to a principal, or null if there's no owner
@@ -178,18 +109,6 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
 
     }
 
-    /**
-     * Returns a group principal
-     *
-     * This must be a url to a principal, or null if there's no owner
-     *
-     * @return string|null
-     */
-    function getGroup() {
-
-        return null;
-
-    }
 
     /**
      * Returns a list of ACE's for this node.
@@ -243,37 +162,4 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
 
     }
 
-    /**
-     * Updates the ACL
-     *
-     * This method will receive a list of new ACE's.
-     *
-     * @param array $acl
-     * @return void
-     */
-    function setACL(array $acl) {
-
-        throw new \Sabre\DAV\Exception\MethodNotAllowed('Changing ACL is not yet supported');
-
-    }
-
-    /**
-     * Returns the list of supported privileges for this node.
-     *
-     * The returned data structure is a list of nested privileges.
-     * See \Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple
-     * standard structure.
-     *
-     * If null is returned from this method, the default privilege set is used,
-     * which is fine for most common usecases.
-     *
-     * @return array|null
-     */
-    function getSupportedPrivilegeSet() {
-
-        return null;
-
-    }
-
 }
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list