Skip to content

Commit 46e301f

Browse files
committed
Merge develop into master: PHP 8.4 LDAP auth fix (ldaprecord v3 upgrade)
2 parents a4541ef + ce34bea commit 46e301f

5 files changed

Lines changed: 2040 additions & 264 deletions

File tree

App/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Module implements ModuleDefinitionInterface
3434
*
3535
* @param \Phalcon\Di\DiInterface $container
3636
*/
37-
public function registerAutoloaders(DiInterface $container = null){
37+
public function registerAutoloaders(?DiInterface $container = null){
3838

3939
}
4040

Lib/AnswerStructure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class AnswerStructure
5656
*
5757
* @param PBXApiResult|null $res The PBXApiResult object to initialize from (optional).
5858
*/
59-
public function __construct(PBXApiResult $res = null)
59+
public function __construct(?PBXApiResult $res = null)
6060
{
6161
// Initialize default values
6262
$this->success = false;

Lib/UsersUILdapAuth.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function checkAuthViaLdap(string $username, string $password, string &$me
252252
$this->connection->connect();
253253
Container::addConnection($this->connection);
254254

255-
$dispatcher = Container::getEventDispatcher();
255+
$dispatcher = Container::getDispatcher();
256256

257257
// Listen for failed authentication event
258258
$dispatcher->listen(Failed::class, function (Failed $event) use (&$message) {
@@ -297,7 +297,12 @@ public function checkAuthViaLdap(string $username, string $password, string &$me
297297
}
298298

299299
if (!$success) {
300-
$this->di->get(LoggerAuthProvider::SERVICE_NAME)->warning("LDAP authentication {$username} failed: {$message}");
300+
// WorkerApiCommands DI doesn't register loggerAuth; fall back to syslog there.
301+
if ($this->di->has(LoggerAuthProvider::SERVICE_NAME)) {
302+
$this->di->get(LoggerAuthProvider::SERVICE_NAME)->warning("LDAP authentication {$username} failed: {$message}");
303+
} else {
304+
\MikoPBX\Core\System\SystemMessages::sysLogMsg('web_auth', "LDAP authentication {$username} failed: {$message}", LOG_WARNING);
305+
}
301306
}
302307

303308
return $success;
@@ -390,7 +395,7 @@ public function getUsersList(): AnswerStructure
390395
$this->connection->connect();
391396
Container::addConnection($this->connection);
392397

393-
$dispatcher = Container::getEventDispatcher();
398+
$dispatcher = Container::getDispatcher();
394399
$dispatcher->listen(Failed::class, function (Failed $event) use (&$message) {
395400
$ldap = $event->getConnection();
396401
$message = $ldap->getDiagnosticMessage();

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "mikopbx/moduleusersui",
33
"description": "ModuleUsersUI",
44
"require": {
5-
"php": "^7.4",
6-
"directorytree/ldaprecord": "^v2.20.5"
5+
"php": "^8.1",
6+
"directorytree/ldaprecord": "^v3.0"
77
},
88
"autoload": {
99
"psr-4": {
@@ -63,7 +63,7 @@
6363
"config": {
6464
"sort-packages": true,
6565
"platform": {
66-
"php": "7.4.0"
66+
"php": "8.1.0"
6767
}
6868
}
6969
}

0 commit comments

Comments
 (0)