Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions apps/dav/lib/CardDAV/AddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ public function delete() {
}

public function propPatch(PropPatch $propPatch) {
// shared address books will be handled by
// \OCA\DAV\DAV\CustomPropertiesBackend::propPatch
// to save values in db table instead of dav object
if (!$this->isShared()) {
if (!isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) {
parent::propPatch($propPatch);
}
}
Expand Down
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' => $this->languageFactory->get('dav')->t("Accounts"),
];
}
return null;
}
Expand Down
1 change: 0 additions & 1 deletion apps/dav/tests/unit/CardDAV/AddressBookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public function testPropPatchNotShared(): void {
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->atLeast(1))->method('updateAddressBook');
$addressBookInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
'{DAV:}displayname' => 'Test address book',
'principaluri' => 'user1',
'id' => 666,
Expand Down