]> source.dussan.org Git - nextcloud-server.git/commitdiff
fixes dav share issue with owner
authorGeorg Ehrke <developer@georgehrke.com>
Wed, 14 Nov 2018 19:50:46 +0000 (20:50 +0100)
committerGeorg Ehrke <developer@georgehrke.com>
Wed, 14 Nov 2018 20:49:00 +0000 (21:49 +0100)
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
apps/dav/lib/CalDAV/Calendar.php
apps/dav/lib/CardDAV/AddressBook.php

index a07bbe93218caf6149bdc0b4f2fe374d8b3b0b95..e80bffdb9d08f8c9c3f90a787096f4d7847a9c00 100644 (file)
@@ -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);
                });
        }
 
index 71202319874552676c73c665465559e9b646d0fa..30ce0a3253ca897c67420f842a0810c845e435f9 100644 (file)
@@ -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() {