diff options
author | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2025-03-10 20:35:27 +0100 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2025-03-19 23:46:57 +0100 |
commit | 7e6801a9af4520975e9280658caa22bffaf1b6e0 (patch) | |
tree | 14214dad53d40ec024f7d6d341ac9735a367d786 /lib | |
parent | 806a3d1e392240a43357f85734b1a5389754fa6e (diff) | |
download | nextcloud-server-backport/51380/stable31.tar.gz nextcloud-server-backport/51380/stable31.zip |
fix(cardav): only show useres from enabled addressBooks in contacts menubackport/51380/stable31
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 95ea83ec80b..af5bcf03607 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -551,6 +551,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 83b5f9098a8..bdc67e9b3dd 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -600,6 +600,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 7dd2bf33124..87b341ac36b 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; +} |