diff options
author | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2025-03-10 20:35:27 +0100 |
---|---|---|
committer | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2025-03-21 15:14:46 +0100 |
commit | e55a375ae35d8271ba6d1bd81f13583df36b4e0a (patch) | |
tree | 527aad78acef9ee9db357a02e7182982d701dde6 /lib | |
parent | 401c051ba7a2c502ea99c731ab071e90f9beb0dc (diff) | |
download | nextcloud-server-e55a375ae35d8271ba6d1bd81f13583df36b4e0a.tar.gz nextcloud-server-e55a375ae35d8271ba6d1bd81f13583df36b4e0a.zip |
fix(cardav): only show useres from enabled addressBooks in contacts menubackport/51380/stable30
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
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; +} |