[Pkg-owncloud-commits] [php-sabredav] 92/275: Authenticated users can deliver new invites again.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:55:55 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 310cc651563324fe827ae21100fb78890fe62797
Author: Evert Pot <me at evertpot.com>
Date:   Wed Jul 16 01:35:25 2014 -0400

    Authenticated users can deliver new invites again.
---
 lib/CalDAV/Schedule/Inbox.php  |  5 +++++
 lib/CalDAV/Schedule/Plugin.php | 30 ++++++++++++++++++++++++++----
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/lib/CalDAV/Schedule/Inbox.php b/lib/CalDAV/Schedule/Inbox.php
index aae383e..4e5e998 100644
--- a/lib/CalDAV/Schedule/Inbox.php
+++ b/lib/CalDAV/Schedule/Inbox.php
@@ -160,6 +160,11 @@ class Inbox extends DAV\Collection implements IInbox {
                 'principal' => $this->getOwner() . '/calendar-proxy-write',
                 'protected' => true,
             ],
+            [
+                'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-deliver-invite',
+                'principal' => '{DAV:}authenticated',
+                'protected' => true,
+            ],
         ];
 
     }
diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index d0b458e..7b17a61 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -533,30 +533,52 @@ class Plugin extends ServerPlugin {
             $iTipMessage->scheduleStatus = '5.2; Could not find local inbox';
             return;
         }
+        if (!isset($result[0][200][$caldavNS . 'calendar-home-set'])) {
+            $iTipMessage->scheduleStatus = '5.2; Could not locate a calendar-home-set';
+            return;
+        }
         if (!isset($result[0][200][$caldavNS . 'schedule-default-calendar-URL'])) {
             $iTipMessage->scheduleStatus = '5.2; Could not find a schedule-default-calendar-URL property';
             return;
         }
 
         $calendarPath = $result[0][200][$caldavNS . 'schedule-default-calendar-URL']->getHref();
+        $homePath = $result[0][200][$caldavNS . 'calendar-home-set']->getHref();
         $inboxPath = $result[0][200][$caldavNS . 'schedule-inbox-URL']->getHref();
 
         // Note that we are bypassing ACL on purpose by calling this directly.
         // We may need to look a bit deeper into this later. Supporting ACL
         // here would be nice.
-        if (!$acl->checkPrivileges($inboxPath, '{' . self::NS_CALDAV . '}schedule-deliver-invite', DAVACL\Plugin::R_PARENT, false)) {
+        if (!$aclPlugin->checkPrivileges($inboxPath, '{' . self::NS_CALDAV . '}schedule-deliver-invite', DAVACL\Plugin::R_PARENT, false)) {
             $iTipMessage->scheduleStatus = '3.8; organizer did not have the schedule-deliver-invite privilege on the attendees inbox';
             return;
         }
 
         // Next, we're going to find out if the item already exits in one of
         // the users' calendars.
+        $uid = $iTipMessage->message->VEVENT->UID;
 
+        $newFileName = 'sabredav-' . \Sabre\DAV\UUIDUtil::getUUID() . '.ics';
+
+        $home = $this->server->tree->getNodeForPath($homePath);
         $inbox = $this->server->tree->getNodeForPath($inboxPath);
-        $calendar = $this->server->tree->getNodeForPath($calendarPath);
 
-        $inbox->deliverInvite($itipMessage);
-        $iTipMessage->scheduleStatus = '1.2;Message delivered locally';
+        $result = $home->getCalendarObjectByUID($uid);
+
+        if (!$result) {
+            // This was a new item
+
+            $calendar = $this->server->tree->getNodeForPath($calendarPath);
+
+            $inbox->createFile($newFileName, $iTipMessage->message->serialize());
+            $iTipMessage->scheduleStatus = '1.2;Message delivered locally';
+
+        } else {
+
+            // We need to find the current version of the calendar object.
+            throw new \Exception('Not implemented');
+
+        }
 
     }
 

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