diff options
author | Anna Larch <anna@nextcloud.com> | 2023-07-21 12:33:00 +0200 |
---|---|---|
committer | Anna <anna@nextcloud.com> | 2023-08-24 15:07:24 +0200 |
commit | 504f396d33bf454493f39989ff4d89176876250f (patch) | |
tree | d4cb16a2b1ecad4747d904ace8285392afe76ddf /apps/dav | |
parent | 480d2c2fd08d3cf52f46f3132a0596580820f4c3 (diff) | |
download | nextcloud-server-504f396d33bf454493f39989ff4d89176876250f.tar.gz nextcloud-server-504f396d33bf454493f39989ff4d89176876250f.zip |
fix(CardDAV): set owner-principal, displayname properties for SAB
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBook.php | 5 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/CardDavBackend.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Principal.php | 5 | ||||
-rw-r--r-- | apps/dav/tests/unit/CardDAV/AddressBookTest.php | 1 |
4 files changed, 8 insertions, 5 deletions
diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index b0fb8c8ee5c..468961b958e 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -223,10 +223,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov } 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); } } diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 045ad4d1385..d7bad8d74ca 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -311,10 +311,12 @@ class CardDavBackend implements BackendInterface, SyncSupport { '{' . 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; } diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 0a882288314..b1f1da6f63d 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -208,6 +208,11 @@ class Principal implements BackendInterface { '{DAV:}displayname' => $group->getDisplayName(), ]; } + } elseif ($prefix === 'principals/system') { + return [ + 'uri' => 'principals/system/' . $name, + '{DAV:}displayname' => $this->languageFactory->get('dav')->t("Accounts"), + ]; } return null; } diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index 9aa7eb14fff..06d81662a42 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -124,7 +124,6 @@ class AddressBookTest extends TestCase { $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, |