[Pkg-owncloud-commits] [php-sabredav] 95/275: Tying lots of loose ends.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:55:56 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 33aa022203dcf95cac4d4a458961bf531ce87fa4
Author: Evert Pot <me at evertpot.com>
Date:   Fri Jul 18 19:34:49 2014 -0400

    Tying lots of loose ends.
    
    An organizer's invite will now get correctly delivered to attendees.
---
 lib/CalDAV/Backend/AbstractBackend.php    |  1 +
 lib/CalDAV/Schedule/ISchedulingObject.php | 14 +++++++++++
 lib/CalDAV/Schedule/Inbox.php             |  5 ++--
 lib/CalDAV/Schedule/Plugin.php            | 23 +++++++++--------
 lib/CalDAV/Schedule/SchedulingObject.php  | 42 ++++++++++++++-----------------
 lib/DAVACL/Plugin.php                     | 10 +++++---
 6 files changed, 56 insertions(+), 39 deletions(-)

diff --git a/lib/CalDAV/Backend/AbstractBackend.php b/lib/CalDAV/Backend/AbstractBackend.php
index a5e3723..3d47803 100644
--- a/lib/CalDAV/Backend/AbstractBackend.php
+++ b/lib/CalDAV/Backend/AbstractBackend.php
@@ -197,6 +197,7 @@ abstract class AbstractBackend implements BackendInterface {
                                         'negate-condition' => false,
                                         'collation' => 'i;octet',
                                     ],
+                                    'param-filters' => [],
                                 ],
                             ]
                         ]
diff --git a/lib/CalDAV/Schedule/ISchedulingObject.php b/lib/CalDAV/Schedule/ISchedulingObject.php
new file mode 100644
index 0000000..90e6f23
--- /dev/null
+++ b/lib/CalDAV/Schedule/ISchedulingObject.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Sabre\CalDAV\Schedule;
+
+/**
+ * The SchedulingObject represents a scheduling object in the Inbox collection
+ *
+ * @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 {
+
+}
+
diff --git a/lib/CalDAV/Schedule/Inbox.php b/lib/CalDAV/Schedule/Inbox.php
index 4e5e998..49c74dd 100644
--- a/lib/CalDAV/Schedule/Inbox.php
+++ b/lib/CalDAV/Schedule/Inbox.php
@@ -67,8 +67,9 @@ class Inbox extends DAV\Collection implements IInbox {
         $objs = $this->caldavBackend->getSchedulingObjects($this->principalUri);
         $children = [];
         foreach($objs as $obj) {
-            $obj['acl'] = $this->getACL();
-            $children[] = new SchedulingObject($this->caldavBackend,$this->calendarInfo,$obj);
+            //$obj['acl'] = $this->getACL();
+            $obj['principaluri'] = $this->principalUri;
+            $children[] = new SchedulingObject($this->caldavBackend,$obj);
         }
         return $children;
 
diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index 8e4e52e..5e19b43 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -9,12 +9,15 @@ use
     Sabre\DAV\Property\HrefList,
     Sabre\DAV\PropFind,
     Sabre\DAV\INode,
+    Sabre\DAV\IFile,
     Sabre\HTTP\RequestInterface,
     Sabre\HTTP\ResponseInterface,
     Sabre\VObject,
+    Sabre\VObject\Reader,
     Sabre\VObject\ITip,
     Sabre\DAVACL,
     Sabre\CalDAV\ICalendar,
+    Sabre\CalDAV\ICalendarObject,
     Sabre\DAV\Exception\NotFound,
     Sabre\DAV\Exception\Forbidden,
     Sabre\DAV\Exception\BadRequest,
@@ -372,7 +375,7 @@ class Plugin extends ServerPlugin {
             $data = stream_get_contents($data);
         }
 
-        $vObj = VObject\Reader::read($data);
+        $vObj = Reader::read($data);
 
         // At the moment we only support VEVENT. VTODO may come later.
         if (!isset($vObj->VEVENT)) {
@@ -402,7 +405,7 @@ class Plugin extends ServerPlugin {
             return;
         }
 
-        $broker = new VObject\ITip\Broker();
+        $broker = new ITip\Broker();
         $messages = $broker->parseNewEvent($vObj);
 
         foreach($messages as $message) {
@@ -439,14 +442,14 @@ class Plugin extends ServerPlugin {
      * We use this event to process any changes to scheduling objects.
      *
      * @param string $path
-     * @param DAV\IFile $node
+     * @param IFile $node
      * @param resource|string $data
      * @param bool $modified
      * @return void
      */
-    public function beforeWriteContent($path, DAV\IFile $node, &$data, &$modified) {
+    public function beforeWriteContent($path, IFile $node, &$data, &$modified) {
 
-        if (!$parentNode instanceof ICalendar) {
+        if (!$node instanceof ICalendarObject) {
             return;
         }
 
@@ -459,7 +462,7 @@ class Plugin extends ServerPlugin {
             $data = stream_get_contents($data);
         }
 
-        $vObj = VObject\Reader::read($data);
+        $vObj = Reader::read($data);
 
         // At the moment we only support VEVENT. VTODO may come later.
         if (!isset($vObj->VEVENT)) {
@@ -483,7 +486,7 @@ class Plugin extends ServerPlugin {
         }
 
         $addresses = $this->getAddressesForPrincipal(
-            $parentNode->getOwner()
+            $node->getOwner()
         );
 
         // We're only handling creation of new objects by the ORGANIZER.
@@ -495,7 +498,7 @@ class Plugin extends ServerPlugin {
         // Fetching the current event body.
         $oldEvent = Reader::read($node->get());
 
-        $broker = new VObject\ITip\Broker();
+        $broker = new ITip\Broker();
         $messages = $broker->parseUpdatedEvent($vObj, $oldEvent);
 
         foreach($messages as $message) {
@@ -608,7 +611,7 @@ class Plugin extends ServerPlugin {
 
         // Next, we're going to find out if the item already exits in one of
         // the users' calendars.
-        $uid = $iTipMessage->message->VEVENT->UID;
+        $uid = $iTipMessage->uid;
 
         $newFileName = 'sabredav-' . \Sabre\DAV\UUIDUtil::getUUID() . '.ics';
 
@@ -629,7 +632,7 @@ class Plugin extends ServerPlugin {
             $isNewNode = true;
         }
 
-        $broker = new VObject\ITip\Broker();
+        $broker = new ITip\Broker();
         $newObject = $broker->processMessage($iTipMessage, $currentObject);
 
         $inbox->createFile($newFileName, $iTipMessage->message->serialize());
diff --git a/lib/CalDAV/Schedule/SchedulingObject.php b/lib/CalDAV/Schedule/SchedulingObject.php
index a26924c..d786139 100644
--- a/lib/CalDAV/Schedule/SchedulingObject.php
+++ b/lib/CalDAV/Schedule/SchedulingObject.php
@@ -1,9 +1,11 @@
 <?php
 
-namespace Sabre\CalDAV;
+namespace Sabre\CalDAV\Schedule;
+
+use Sabre\CalDAV\Backend;
 
 /**
- * The SchedulingObject represents a scheduling object in the Inbox collection 
+ * The SchedulingObject represents a scheduling object in the Inbox collection
  *
  * @author Brett (https://github.com/bretten)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
@@ -12,9 +14,9 @@ namespace Sabre\CalDAV;
 class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sabre\DAVACL\IACL {
 
     /**
-     * Sabre\CalDAV\Backend\BackendInterface
+     /* The CalDAV backend
      *
-     * @var Sabre\CalDAV\Backend\AbstractBackend
+     * @var Backend\SchedulingSupport
      */
     protected $caldavBackend;
 
@@ -26,18 +28,12 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
     protected $objectData;
 
     /**
-     * Array with information about the containing calendar
-     *
-     * @var array
-     */
-    protected $calendarInfo;
-
-    /**
      * Constructor
      *
      * The following properties may be passed within $objectData:
      *
      *   * uri - A unique uri. Only the 'basename' must be passed.
+     *   * principaluri - the principal that owns the object.
      *   * calendardata (optional) - The iCalendar data
      *   * etag - (optional) The etag for this object, MUST be encloded with
      *            double-quotes.
@@ -46,10 +42,9 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
      *   * acl - (optional) Use this to override the default ACL for the node.
      *
      * @param Backend\BackendInterface $caldavBackend
-     * @param array $calendarInfo
      * @param array $objectData
      */
-    public function __construct(Backend\BackendInterface $caldavBackend,array $calendarInfo,array $objectData) {
+    public function __construct(Backend\SchedulingSupport $caldavBackend,array $objectData) {
 
         $this->caldavBackend = $caldavBackend;
 
@@ -57,7 +52,6 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
             throw new \InvalidArgumentException('The objectData argument must contain an \'uri\' property');
         }
 
-        $this->calendarInfo = $calendarInfo;
         $this->objectData = $objectData;
 
     }
@@ -83,7 +77,7 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
         // Pre-populating the 'calendardata' is optional, if we don't have it
         // already we fetch it from the backend.
         if (!isset($this->objectData['calendardata'])) {
-            $this->objectData = $this->caldavBackend->getSchedulingObject($this->calendarInfo['principaluri'], $this->objectData['uri']);
+            $this->objectData = $this->caldavBackend->getSchedulingObject($this->objectData['principaluri'], $this->objectData['uri']);
         }
         return $this->objectData['calendardata'];
 
@@ -106,7 +100,7 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
      */
     public function delete() {
 
-        $this->caldavBackend->deleteSchedulingObject($this->calendarInfo['principaluri'],$this->objectData['uri']);
+        $this->caldavBackend->deleteSchedulingObject($this->objectData['principaluri'],$this->objectData['uri']);
 
     }
 
@@ -118,7 +112,7 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
     public function getContentType() {
 
         $mime = 'text/calendar; charset=utf-8';
-        if ($this->objectData['component']) {
+        if (isset($this->objectData['component']) && $this->objectData['component']) {
             $mime.='; component=' . $this->objectData['component'];
         }
         return $mime;
@@ -177,7 +171,7 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
      */
     public function getOwner() {
 
-        return $this->calendarInfo['principaluri'];
+        return $this->objectData['principaluri'];
 
     }
 
@@ -209,6 +203,8 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
     public function getACL() {
 
         // An alternative acl may be specified in the object data.
+        //
+
         if (isset($this->objectData['acl'])) {
             return $this->objectData['acl'];
         }
@@ -217,27 +213,27 @@ class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sa
         return array(
             array(
                 'privilege' => '{DAV:}read',
-                'principal' => $this->calendarInfo['principaluri'],
+                'principal' => $this->objectData['principaluri'],
                 'protected' => true,
             ),
             array(
                 'privilege' => '{DAV:}write',
-                'principal' => $this->calendarInfo['principaluri'],
+                'principal' => $this->objectData['principaluri'],
                 'protected' => true,
             ),
             array(
                 'privilege' => '{DAV:}read',
-                'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+                'principal' => $this->objectData['principaluri'] . '/calendar-proxy-write',
                 'protected' => true,
             ),
             array(
                 'privilege' => '{DAV:}write',
-                'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+                'principal' => $this->objectData['principaluri'] . '/calendar-proxy-write',
                 'protected' => true,
             ),
             array(
                 'privilege' => '{DAV:}read',
-                'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-read',
+                'principal' => $this->objectData['principaluri'] . '/calendar-proxy-read',
                 'protected' => true,
             ),
 
diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php
index aee5c60..64ebeac 100644
--- a/lib/DAVACL/Plugin.php
+++ b/lib/DAVACL/Plugin.php
@@ -4,6 +4,8 @@ namespace Sabre\DAVACL;
 
 use
     Sabre\DAV,
+    Sabre\DAV\IFile,
+    Sabre\DAV\INode,
     Sabre\HTTP\URLUtil,
     Sabre\HTTP\RequestInterface,
     Sabre\HTTP\ResponseInterface;
@@ -330,7 +332,7 @@ class Plugin extends DAV\ServerPlugin {
      * You can either get the list of privileges by a uri (path) or by
      * specifying a Node.
      *
-     * @param string|DAV\INode $node
+     * @param string|INode $node
      * @return array
      */
     public function getSupportedPrivilegeSet($node) {
@@ -420,14 +422,14 @@ class Plugin extends DAV\ServerPlugin {
      *   - abstract
      *   - concrete
      *
-     * @param string|DAV\INode $node
+     * @param string|INode $node
      * @return array
      */
     final public function getFlatPrivilegeSet($node) {
 
         $privs = $this->getSupportedPrivilegeSet($node);
 
-        $flat = array();
+        $flat = [];
         $this->getFPSTraverse($privs, null, $flat);
 
         return $flat;
@@ -474,7 +476,7 @@ class Plugin extends DAV\ServerPlugin {
     /**
      * Returns the full ACL list.
      *
-     * Either a uri or a DAV\INode may be passed.
+     * Either a uri or a INode may be passed.
      *
      * null will be returned if the node doesn't support ACLs.
      *

-- 
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