]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(carddav): Mark system address book as read-only 38248/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Mon, 8 May 2023 17:41:06 +0000 (19:41 +0200)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Mon, 15 May 2023 08:32:49 +0000 (10:32 +0200)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
apps/dav/lib/CardDAV/SystemAddressbook.php

index 502e353acb313696a561c895c7fe9900d37a282f..1c78e03162e60c95c14a259922a7f6f6c1dca5b2 100644 (file)
@@ -30,6 +30,7 @@ namespace OCA\DAV\CardDAV;
 use OCP\IConfig;
 use OCP\IL10N;
 use Sabre\CardDAV\Backend\BackendInterface;
+use function array_filter;
 
 class SystemAddressbook extends AddressBook {
        /** @var IConfig */
@@ -50,4 +51,13 @@ class SystemAddressbook extends AddressBook {
 
                return parent::getChildren();
        }
+
+       public function getACL() {
+               return array_filter(parent::getACL(), function($acl) {
+                       if (in_array($acl['privilege'], ['{DAV:}write', '{DAV:}all'], true)) {
+                               return false;
+                       }
+                       return true;
+               });
+       }
 }