summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorHamza <40746210+hamza221@users.noreply.github.com>2024-03-21 14:33:43 +0100
committerGitHub <noreply@github.com>2024-03-21 14:33:43 +0100
commit007b54afed254367742ede071bfa8d1096dd1da7 (patch)
tree9c95724fba3bd8ee385690648089da30ca3e2cec /apps
parent8c3f9a1bb31faa8acc547f954e3d54174bc59cae (diff)
parentb6e1685683f51ddb8da7b4a5767985ac287fa3ee (diff)
downloadnextcloud-server-007b54afed254367742ede071bfa8d1096dd1da7.tar.gz
nextcloud-server-007b54afed254367742ede071bfa8d1096dd1da7.zip
Merge pull request #44376 from nextcloud/fix/dav/acls-shared-addressbook
fix(dav): ACLs for shared addressbooks
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CardDAV/AddressBook.php7
-rw-r--r--apps/dav/lib/DAV/Sharing/Backend.php2
-rw-r--r--apps/dav/tests/unit/CardDAV/AddressBookTest.php2
3 files changed, 8 insertions, 3 deletions
diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php
index 468961b958e..4f589031f06 100644
--- a/apps/dav/lib/CardDAV/AddressBook.php
+++ b/apps/dav/lib/CardDAV/AddressBook.php
@@ -118,7 +118,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov
],
[
'privilege' => '{DAV:}write-properties',
- 'principal' => '{DAV:}authenticated',
+ 'principal' => $this->getOwner(),
'protected' => true,
],
];
@@ -129,6 +129,11 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov
'principal' => '{DAV:}authenticated',
'protected' => true,
];
+ $acl[] = [
+ 'privilege' => '{DAV:}write-properties',
+ 'principal' => '{DAV:}authenticated',
+ 'protected' => true,
+ ];
}
if (!$this->isShared()) {
diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php
index f77be9211bf..b467479bc1e 100644
--- a/apps/dav/lib/DAV/Sharing/Backend.php
+++ b/apps/dav/lib/DAV/Sharing/Backend.php
@@ -214,7 +214,7 @@ abstract class Backend {
'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
'protected' => true,
];
- } elseif ($this->service->getResourceType() === 'calendar') {
+ } elseif (in_array($this->service->getResourceType(), ['calendar','addressbook'])) {
// Allow changing the properties of read only calendars,
// so users can change the visibility.
$acl[] = [
diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php
index f9cba4e6a83..fa312f98797 100644
--- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php
+++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php
@@ -169,7 +169,7 @@ class AddressBookTest extends TestCase {
'protected' => true
], [
'privilege' => '{DAV:}write-properties',
- 'principal' => '{DAV:}authenticated',
+ 'principal' => $hasOwnerSet ? 'user1' : 'user2',
'protected' => true
]];
if ($hasOwnerSet) {