Skip to content

Commit

Permalink
Merge pull request #44378 from nextcloud/backport/44376/stable27
Browse files Browse the repository at this point in the history
[stable27] fix(dav): ACLs for shared addressbooks
  • Loading branch information
AndyScherzinger authored Mar 21, 2024
2 parents 0bd0b5c + 08a7937 commit 5d84d65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion apps/dav/lib/CardDAV/AddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getACL() {
],
[
'privilege' => '{DAV:}write-properties',
'principal' => '{DAV:}authenticated',
'principal' => $this->getOwner(),
'protected' => true,
],
];
Expand All @@ -129,6 +129,11 @@ public function getACL() {
'principal' => '{DAV:}authenticated',
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}write-properties',
'principal' => '{DAV:}authenticated',
'protected' => true,
];
}

if (!$this->isShared()) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/DAV/Sharing/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function applyShareAcl(int $resourceId, array $acl): array {
'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'],
'protected' => true,
];
} elseif ($this->resourceType === 'calendar') {
} elseif (in_array($this->resourceType, ['calendar','addressbook'])) {
// Allow changing the properties of read only calendars,
// so users can change the visibility.
$acl[] = [
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/tests/unit/CardDAV/AddressBookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet): void {
'protected' => true
], [
'privilege' => '{DAV:}write-properties',
'principal' => '{DAV:}authenticated',
'principal' => $hasOwnerSet ? 'user1' : 'user2',
'protected' => true
]];
if ($hasOwnerSet) {
Expand Down

0 comments on commit 5d84d65

Please sign in to comment.