Skip to content

Commit

Permalink
fix(CardDAV): set owner-principal, displayname properties for SAB
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Larch <[email protected]>
  • Loading branch information
miaulalala committed Jul 21, 2023
1 parent 7c80d66 commit 1498447
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,12 @@ public function getAddressBooksByUri(string $principal, string $addressBookUri):
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',

];

// system address books are always read only
if ($principal === 'principals/system/system') {
$addressBook['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'] = $row['principaluri'];
$addressBook['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'] = true;
}

Expand Down
5 changes: 5 additions & 0 deletions apps/dav/lib/Connector/Sabre/Principal.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ public function getPrincipalByPath($path) {
'{DAV:}displayname' => $group->getDisplayName(),
];
}
} elseif ($prefix === 'principals/system') {
return [
'uri' => 'principals/system/' . $name,
'{DAV:}displayname' => $name,
];
}
return null;
}
Expand Down

0 comments on commit 1498447

Please sign in to comment.