diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-11-14 20:50:46 +0100 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-11-14 21:49:00 +0100 |
commit | c23a66cda46d9a1f0ce8dc60a6c160809c87d9f6 (patch) | |
tree | 9a12015b1e7e728b005a730ab2b7470a446a828d /apps/dav/lib | |
parent | 1783fa71765132ac11a4dc21b299ebfa52756bca (diff) | |
download | nextcloud-server-c23a66cda46d9a1f0ce8dc60a6c160809c87d9f6.tar.gz nextcloud-server-c23a66cda46d9a1f0ce8dc60a6c160809c87d9f6.zip |
fixes dav share issue with owner
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/CalDAV/Calendar.php | 11 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBook.php | 21 |
2 files changed, 18 insertions, 14 deletions
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index a07bbe93218..e80bffdb9d0 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -139,6 +139,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { ]; } + if (!$this->isShared()) { + return $acl; + } + if ($this->getOwner() !== parent::getOwner()) { $acl[] = [ 'privilege' => '{DAV:}read', @@ -168,14 +172,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } $acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl); - - if (!$this->isShared()) { - return $acl; - } - $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/public']; return array_filter($acl, function($rule) use ($allowedPrincipals) { - return in_array($rule['principal'], $allowedPrincipals); + return \in_array($rule['principal'], $allowedPrincipals, true); }); } 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() { |