diff options
author | Daniel <mail@danielkesselberg.de> | 2023-07-18 17:05:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 17:05:12 +0200 |
commit | aa5dcb095256d6352de758361798de86c3e2d0d0 (patch) | |
tree | 545f204f70def214ac07bb1124d07658576b7220 /apps/dav/lib/CardDAV | |
parent | 705ccd50c566fdd7f484b5084e377169e60f7b6a (diff) | |
parent | bb802956a2e3fd1f2d8d229cf4fad5b39f9226fb (diff) | |
download | nextcloud-server-aa5dcb095256d6352de758361798de86c3e2d0d0.tar.gz nextcloud-server-aa5dcb095256d6352de758361798de86c3e2d0d0.zip |
Merge pull request #38397 from nextcloud/enh/contacts/hide-adressbook-option
enh(contacts): show/hide addressbooks for all
Diffstat (limited to 'apps/dav/lib/CardDAV')
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBook.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index e9eec4161cb..b0fb8c8ee5c 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -46,7 +46,6 @@ use Sabre\DAV\PropPatch; * @property CardDavBackend $carddavBackend */ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMoveTarget { - /** * AddressBook constructor. * @@ -116,7 +115,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov 'privilege' => '{DAV:}write', 'principal' => $this->getOwner(), 'protected' => true, - ] + ], + [ + 'privilege' => '{DAV:}write-properties', + 'principal' => '{DAV:}authenticated', + 'protected' => true, + ], ]; if ($this->getOwner() === 'principals/system/system') { @@ -147,7 +151,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov } $acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); - $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system']; + $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system', '{DAV:}authenticated']; return array_filter($acl, function ($rule) use ($allowedPrincipals) { return \in_array($rule['principal'], $allowedPrincipals, true); }); @@ -166,8 +170,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return new Card($this->carddavBackend, $this->addressBookInfo, $obj); } - public function getChildren() - { + public function getChildren() { $objs = $this->carddavBackend->getCards($this->addressBookInfo['id']); $children = []; foreach ($objs as $obj) { @@ -178,8 +181,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov return $children; } - public function getMultipleChildren(array $paths) - { + public function getMultipleChildren(array $paths) { $objs = $this->carddavBackend->getMultipleCards($this->addressBookInfo['id'], $paths); $children = []; foreach ($objs as $obj) { @@ -221,10 +223,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov } public function propPatch(PropPatch $propPatch) { - if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { - throw new Forbidden(); + // shared address books will be handled by + // \OCA\DAV\DAV\CustomPropertiesBackend::propPatch + // to save values in db table instead of dav object + if (!$this->isShared()) { + parent::propPatch($propPatch); } - parent::propPatch($propPatch); } public function getContactsGroups() { |