summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-04-23 13:48:39 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-30 13:27:51 +0200
commit3a133b151fe790c3e4a227f17a75a37b44b8e50a (patch)
treef3b1eecdeddb3cce96e8450be01a4dcd066e73bd /apps
parented0069b8e6d9bcf75b3b35e72b3c0b2b542b0268 (diff)
downloadnextcloud-server-3a133b151fe790c3e4a227f17a75a37b44b8e50a.tar.gz
nextcloud-server-3a133b151fe790c3e4a227f17a75a37b44b8e50a.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>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CalDAV/Calendar.php2
-rw-r--r--apps/dav/lib/CardDAV/AddressBook.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php7
-rw-r--r--apps/dav/lib/DAV/Sharing/Backend.php12
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 06fb10f7e2c..250d67aafd1 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -325,6 +325,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 141c54899ad..8412ccc6010 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);
+ }
}
}