Browse Source

When sharing calendars and addressbooks the principal has to be verified to be valid

d3fb8fcdd3

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
tags/v14.0.0beta1
Roeland Jago Douma 6 years ago
parent
commit
240006bdf5
No account linked to committer's email address

+ 1
- 1
apps/dav/lib/CalDAV/Calendar.php View File

@@ -203,7 +203,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
}

$this->caldavBackend->updateShares($this, [], [
'href' => $principal
$principal
]);
return;
}

+ 1
- 1
apps/dav/lib/CardDAV/AddressBook.php View File

@@ -181,7 +181,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
}

$this->carddavBackend->updateShares($this, [], [
'href' => $principal
$principal
]);
return;
}

+ 7
- 0
apps/dav/lib/Connector/Sabre/Principal.php View File

@@ -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;
}

+ 9
- 3
apps/dav/lib/DAV/Sharing/Backend.php View File

@@ -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);
}
}
}


Loading…
Cancel
Save