diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-11-15 15:41:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-15 15:41:08 +0300 |
commit | 4a71b80b74ba55cabfe9b69cb52500011ae93b13 (patch) | |
tree | 2dc2e13bd606f99f418cc43445e7cd369f0d26bc /apps/dav/lib/CardDAV/AddressBook.php | |
parent | c2000c295cc3a8a61b6c134cb6595dfbe533cf9a (diff) | |
parent | 2a31d842eaab87274f091f2d012abae0152c27d6 (diff) |
Merge pull request #12460 from nextcloud/bugfix-stable13/dav_shares_hickup
[stable13] fixes dav share issue with owner
Diffstat (limited to 'apps/dav/lib/CardDAV/AddressBook.php')
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBook.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 71202319874..30ce0a3253c 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -105,12 +105,17 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { 'privilege' => '{DAV:}read', 'principal' => $this->getOwner(), 'protected' => true, - ]]; - $acl[] = [ + ],[ 'privilege' => '{DAV:}write', 'principal' => $this->getOwner(), 'protected' => true, - ]; + ] + ]; + + if (!$this->isShared()) { + return $acl; + } + if ($this->getOwner() !== parent::getOwner()) { $acl[] = [ 'privilege' => '{DAV:}read', @@ -133,11 +138,11 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { ]; } - if ($this->isShared()) { - return $acl; - } - - return $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); + $acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); + $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system']; + return array_filter($acl, function($rule) use ($allowedPrincipals) { + return \in_array($rule['principal'], $allowedPrincipals, true); + }); } public function getChildACL() { |