diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-04-23 13:48:39 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-27 20:51:36 +0200 |
commit | 240006bdf517df0a72d52efb285fdf9cf8b58d35 (patch) | |
tree | aeaf0b40415f5ca2428d54a070378c52a426750a | |
parent | c5d5c7dc1249f75922f85b99fe1f1d3f799b2793 (diff) | |
download | nextcloud-server-240006bdf517df0a72d52efb285fdf9cf8b58d35.tar.gz nextcloud-server-240006bdf517df0a72d52efb285fdf9cf8b58d35.zip |
When sharing calendars and addressbooks the principal has to be verified to be valid
https://github.com/owncloud/core/pull/30149/commits/d3fb8fcdd3a6b00bde0c3c9eb4039876e7fc1967
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r-- | apps/dav/lib/CalDAV/Calendar.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBook.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Principal.php | 7 | ||||
-rw-r--r-- | apps/dav/lib/DAV/Sharing/Backend.php | 12 |
4 files changed, 18 insertions, 5 deletions
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 02808ab5662..a07bbe93218 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -203,7 +203,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } $this->caldavBackend->updateShares($this, [], [ - 'href' => $principal + $principal ]); return; } diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index a034f8b9426..71202319874 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -181,7 +181,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { } $this->carddavBackend->updateShares($this, [], [ - 'href' => $principal + $principal ]); return; } diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index b2f57cf715c..b94b093ab50 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -324,6 +324,13 @@ class Principal implements BackendInterface { return $this->principalPrefix . '/' . $user->getUID(); } } + if (substr($uri, 0, 10) === 'principal:') { + $principal = substr($uri, 10); + $principal = $this->getPrincipalByPath($principal); + if ($principal !== null) { + return $principal['uri']; + } + } return null; } diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 87c094c6d62..433d9db9c08 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -67,12 +67,18 @@ class Backend { * @param string[] $add * @param string[] $remove */ - public function updateShares($shareable, $add, $remove) { + public function updateShares(IShareable $shareable, array $add, array $remove) { foreach($add as $element) { - $this->shareWith($shareable, $element); + $principal = $this->principalBackend->findByUri($element['href'], ''); + if ($principal !== '') { + $this->shareWith($shareable, $element); + } } foreach($remove as $element) { - $this->unshare($shareable, $element); + $principal = $this->principalBackend->findByUri($element, ''); + if ($principal !== '') { + $this->unshare($shareable, $element); + } } } |