diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-04-29 13:58:21 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-04-30 09:23:59 +0200 |
commit | 7f3fcbc49f76028d19a835a93735b2190b4e3f09 (patch) | |
tree | 32c912890cfae7336341c8437bbe33cbd537ff08 | |
parent | c99ebaa8662da8b1c71e10e14fe36dd8ff54167e (diff) | |
download | nextcloud-server-7f3fcbc49f76028d19a835a93735b2190b4e3f09.tar.gz nextcloud-server-7f3fcbc49f76028d19a835a93735b2190b4e3f09.zip |
fix(user_ldap): Improve typing and fix a var name
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | apps/user_ldap/ajax/wizard.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Connection.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/Jobs/Sync.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Wizard.php | 16 |
4 files changed, 15 insertions, 9 deletions
diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index 63241667825..676cf77e990 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -48,7 +48,7 @@ $configuration = new \OCA\User_LDAP\Configuration($prefix); $con = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix, null); $con->setConfiguration($configuration->getConfiguration()); -$con->ldapConfigurationActive = true; +$con->ldapConfigurationActive = (string)true; $con->setIgnoreValidation(true); $factory = \OC::$server->get(\OCA\User_LDAP\AccessFactory::class); diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index f6ff14927a1..8c21032cfe6 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -448,7 +448,7 @@ class Connection extends LDAPUtility { $backupPort = (int)$this->configuration->ldapBackupPort; if ($backupPort <= 0) { - $this->configuration->backupPort = $this->configuration->ldapPort; + $this->configuration->ldapBackupPort = $this->configuration->ldapPort; } //make sure empty search attributes are saved as simple, empty array @@ -463,7 +463,7 @@ class Connection extends LDAPUtility { if ((stripos((string)$this->configuration->ldapHost, 'ldaps://') === 0) && $this->configuration->ldapTLS) { - $this->configuration->ldapTLS = false; + $this->configuration->ldapTLS = (string)false; $this->logger->info( 'LDAPS (already using secure connection) and TLS do not work together. Switched off TLS.', ['app' => 'user_ldap'] diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php index b92aa2fcfaa..16371df1562 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -169,7 +169,7 @@ class Sync extends TimedJob { $results = $access->fetchListOfUsers( $filter, $access->userManager->getAttributes(), - $connection->ldapPagingSize, + (int)$connection->ldapPagingSize, $cycleData['offset'], true ); diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 1b4c9162b71..1e55d67543f 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -414,7 +414,7 @@ class Wizard extends LDAPUtility { $this->fetchGroups($dbKey, $confKey); if ($testMemberOf) { - $this->configuration->hasMemberOfFilterSupport = $this->testMemberOf(); + $this->configuration->hasMemberOfFilterSupport = (string)$this->testMemberOf(); $this->result->markChange(); if (!$this->configuration->hasMemberOfFilterSupport) { throw new \Exception('memberOf is not supported by the server'); @@ -700,8 +700,8 @@ class Wizard extends LDAPUtility { if ($settingsFound === true) { $config = [ - 'ldapPort' => $p, - 'ldapTLS' => (int)$t + 'ldapPort' => (string)$p, + 'ldapTLS' => (string)$t, ]; $this->configuration->setConfiguration($config); $this->logger->debug( @@ -1322,7 +1322,7 @@ class Wizard extends LDAPUtility { $this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3); $this->ldap->setOption($cr, LDAP_OPT_REFERRALS, 0); $this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT); - if ($this->configuration->ldapTLS === 1) { + if ($this->configuration->ldapTLS) { $this->ldap->startTls($cr); } @@ -1337,6 +1337,9 @@ class Wizard extends LDAPUtility { return false; } + /** + * @return array<array{port:int,tls:bool}> + */ private function getDefaultLdapPortSettings(): array { static $settings = [ ['port' => 7636, 'tls' => false], @@ -1349,6 +1352,9 @@ class Wizard extends LDAPUtility { return $settings; } + /** + * @return array<array{port:int,tls:bool}> + */ private function getPortSettingsToTry(): array { //389 ← LDAP / Unencrypted or StartTLS //636 ← LDAPS / SSL @@ -1367,7 +1373,7 @@ class Wizard extends LDAPUtility { } $portSettings[] = ['port' => $port, 'tls' => false]; } elseif ($this->configuration->usesLdapi()) { - $portSettings[] = ['port' => '', 'tls' => false]; + $portSettings[] = ['port' => 0, 'tls' => false]; } //default ports |