Merge pull request #38247 from nextcloud/fix/read-only-system-addres-book-acls

fix(carddav): Mark system address book as read-only
This commit is contained in:
Christoph Wurst 2023-05-15 14:01:41 +02:00 committed by GitHub
commit b9026acf3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,6 +45,7 @@ use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\ICollection;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Reader;
use function array_filter;
use function array_unique;
class SystemAddressbook extends AddressBook {
@ -296,4 +297,13 @@ class SystemAddressbook extends AddressBook {
}
throw new Forbidden();
}
public function getACL() {
return array_filter(parent::getACL(), function($acl) {
if (in_array($acl['privilege'], ['{DAV:}write', '{DAV:}all'], true)) {
return false;
}
return true;
});
}
}