Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-01 13:37:37 +0300
committerGitHub <noreply@github.com>2018-06-01 13:37:37 +0300
commitda21b2a7ab0b2c307097f47b47da43cb14cd173f (patch)
tree3d3b613926942548c54d6258065c5d702af49c0f
parenta55241cfe667e44d02403b354a55296620fa6d16 (diff)
parentcf3590f085c5a4b04096bd73e8f264ca1a818c80 (diff)
Merge pull request #9611 from nextcloud/bugfix-stable12/3830/invitations_for_shared_calendars
[stable12] send invitations for shared calendars
-rw-r--r--apps/dav/lib/CalDAV/Schedule/Plugin.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php
index 34df666637c..faf495a4de6 100644
--- a/apps/dav/lib/CalDAV/Schedule/Plugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php
@@ -31,6 +31,10 @@ use Sabre\DAV\PropFind;
use Sabre\DAV\Server;
use Sabre\DAV\Xml\Property\LocalHref;
use Sabre\DAVACL\IPrincipal;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
+use Sabre\VObject\Component\VCalendar;
+use Sabre\VObject\Reader;
class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
@@ -98,4 +102,67 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
});
}
}
+
+ /**
+ * This method is triggered whenever there was a calendar object gets
+ * created or updated.
+ *
+ * Basically just a copy of parent::calendarObjectChange, with the change
+ * from:
+ * $addresses = $this->getAddressesForPrincipal($calendarNode->getOwner());
+ * to:
+ * $addresses = $this->getAddressesForPrincipal($calendarNode->getPrincipalURI());
+ *
+ * @param RequestInterface $request HTTP request
+ * @param ResponseInterface $response HTTP Response
+ * @param VCalendar $vCal Parsed iCalendar object
+ * @param mixed $calendarPath Path to calendar collection
+ * @param mixed $modified The iCalendar object has been touched.
+ * @param mixed $isNew Whether this was a new item or we're updating one
+ * @return void
+ */
+ function calendarObjectChange(RequestInterface $request, ResponseInterface $response, VCalendar $vCal, $calendarPath, &$modified, $isNew) {
+
+ if (!$this->scheduleReply($this->server->httpRequest)) {
+ return;
+ }
+
+ $calendarNode = $this->server->tree->getNodeForPath($calendarPath);
+
+ $addresses = $this->getAddressesForPrincipal(
+ $calendarNode->getPrincipalURI()
+ );
+
+ if (!$isNew) {
+ $node = $this->server->tree->getNodeForPath($request->getPath());
+ $oldObj = Reader::read($node->get());
+ } else {
+ $oldObj = null;
+ }
+
+ $this->processICalendarChange($oldObj, $vCal, $addresses, [], $modified);
+
+ if ($oldObj) {
+ // Destroy circular references so PHP will GC the object.
+ $oldObj->destroy();
+ }
+
+ }
+
+ /**
+ * This method checks the 'Schedule-Reply' header
+ * and returns false if it's 'F', otherwise true.
+ *
+ * Copied from Sabre/DAV's Schedule plugin, because it's
+ * private for whatever reason
+ *
+ * @param RequestInterface $request
+ * @return bool
+ */
+ private function scheduleReply(RequestInterface $request) {
+
+ $scheduleReply = $request->getHeader('Schedule-Reply');
+ return $scheduleReply !== 'F';
+
+ }
}