From 0890012e72c594805406b95b39707db1acdf0d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 28 Sep 2023 11:36:35 +0200 Subject: [PATCH] Fix SetupChecks/LdapInvalidUuids.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .../lib/SetupChecks/LdapInvalidUuids.php | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php b/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php index f8c8a5f1fc5..473fedc5c1d 100644 --- a/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php +++ b/apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php @@ -6,6 +6,7 @@ declare(strict_types=1); * @copyright Copyright (c) 2022 Arthur Schiwon * * @author Arthur Schiwon + * @author Côme Chilliet * * @license GNU AGPL version 3 or any later version * @@ -28,14 +29,12 @@ namespace OCA\User_LDAP\SetupChecks; use OCA\User_LDAP\Mapping\GroupMapping; use OCA\User_LDAP\Mapping\UserMapping; -use OCP\App\IAppManager; use OCP\IL10N; -use OCP\IServerContainer; use OCP\SetupCheck\ISetupCheck; +use OCP\SetupCheck\SetupResult; class LdapInvalidUuids implements ISetupCheck { private IL10N $l10n; - private IServerContainer $server; private UserMapping $userMapping; private GroupMapping $groupMapping; @@ -49,16 +48,16 @@ class LdapInvalidUuids implements ISetupCheck { return 'ldap'; } - public function description(): string { - return $this->l10n->t('Invalid UUIDs of LDAP users or groups have been found. Please review your "Override UUID detection" settings in the Expert part of the LDAP configuration and use "occ ldap:update-uuid" to update them.'); + public function getName(): string { + return $this->l10n->t('Checking for invalid LDAP UUIDs'); } - public function severity(): string { - return 'warning'; - } - - public function run(): bool { - return count($this->userMapping->getList(0, 1, true)) === 0 - && count($this->groupMapping->getList(0, 1, true)) === 0; + public function run(): SetupResult { + if (count($this->userMapping->getList(0, 1, true)) === 0 + && count($this->groupMapping->getList(0, 1, true)) === 0) { + return new SetupResult(SetupResult::SUCCESS); + } else { + return new SetupResult(SetupResult::WARNING, $this->l10n->t('Invalid UUIDs of LDAP users or groups have been found. Please review your "Override UUID detection" settings in the Expert part of the LDAP configuration and use "occ ldap:update-uuid" to update them.')); + } } }