diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2025-03-26 14:54:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-26 14:54:36 +0100 |
commit | cf130f43d710f10ae2118a8fffe8a086e7ef1e75 (patch) | |
tree | afaef023aa133989f2448859b009a2eadea12801 /lib | |
parent | f05befdf543f48bce49ddb95bcb2084d904ef6ce (diff) | |
parent | e55a375ae35d8271ba6d1bd81f13583df36b4e0a (diff) | |
download | nextcloud-server-cf130f43d710f10ae2118a8fffe8a086e7ef1e75.tar.gz nextcloud-server-cf130f43d710f10ae2118a8fffe8a086e7ef1e75.zip |
Merge pull request #51538 from nextcloud/backport/51380/stable30
[stable30] fix(cardav): only show users from enabled addressBooks in contacts menu
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/private/ContactsManager.php | 4 | ||||
-rw-r--r-- | lib/public/IAddressBookEnabled.php | 26 |
4 files changed, 32 insertions, 0 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index b0de799a58f..cd49c8b605c 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -513,6 +513,7 @@ return array( 'OCP\\Http\\WellKnown\\IResponse' => $baseDir . '/lib/public/Http/WellKnown/IResponse.php', 'OCP\\Http\\WellKnown\\JrdResponse' => $baseDir . '/lib/public/Http/WellKnown/JrdResponse.php', 'OCP\\IAddressBook' => $baseDir . '/lib/public/IAddressBook.php', + 'OCP\\IAddressBookEnabled' => $baseDir . '/lib/public/IAddressBookEnabled.php', 'OCP\\IAppConfig' => $baseDir . '/lib/public/IAppConfig.php', 'OCP\\IAvatar' => $baseDir . '/lib/public/IAvatar.php', 'OCP\\IAvatarManager' => $baseDir . '/lib/public/IAvatarManager.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 6d8e189efa3..17470114fb3 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -546,6 +546,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OCP\\Http\\WellKnown\\IResponse' => __DIR__ . '/../../..' . '/lib/public/Http/WellKnown/IResponse.php', 'OCP\\Http\\WellKnown\\JrdResponse' => __DIR__ . '/../../..' . '/lib/public/Http/WellKnown/JrdResponse.php', 'OCP\\IAddressBook' => __DIR__ . '/../../..' . '/lib/public/IAddressBook.php', + 'OCP\\IAddressBookEnabled' => __DIR__ . '/../../..' . '/lib/public/IAddressBookEnabled.php', 'OCP\\IAppConfig' => __DIR__ . '/../../..' . '/lib/public/IAppConfig.php', 'OCP\\IAvatar' => __DIR__ . '/../../..' . '/lib/public/IAvatar.php', 'OCP\\IAvatarManager' => __DIR__ . '/../../..' . '/lib/public/IAvatarManager.php', diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php index f67cb196eef..f9550144e5d 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -10,6 +10,7 @@ namespace OC; use OCP\Constants; use OCP\Contacts\IManager; use OCP\IAddressBook; +use OCP\IAddressBookEnabled; class ContactsManager implements IManager { /** @@ -34,6 +35,9 @@ class ContactsManager implements IManager { $this->loadAddressBooks(); $result = []; foreach ($this->addressBooks as $addressBook) { + if ($addressBook instanceof IAddressBookEnabled && !$addressBook->isEnabled()) { + continue; + } $searchOptions = $options; $strictSearch = array_key_exists('strict_search', $options) && $options['strict_search'] === true; diff --git a/lib/public/IAddressBookEnabled.php b/lib/public/IAddressBookEnabled.php new file mode 100644 index 00000000000..ad93aa3f59a --- /dev/null +++ b/lib/public/IAddressBookEnabled.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors" + * SPDX-License-Identifier: AGPL-3.0-only + */ +// use OCP namespace for all classes that are considered public. +// This means that they should be used by apps instead of the internal Nextcloud classes + +namespace OCP; + +/** + * IAddressBook Interface extension for checking if the address book is enabled + * + * @since 32.0.0 + */ +interface IAddressBookEnabled extends IAddressBook { + /** + * Check if the address book is enabled + * @return bool + * @since 32.0.0 + */ + public function isEnabled(): bool; +} |