DirectoryTree / LdapRecord-Laravel

Multi-domain LDAP Authentication & Management for Laravel.
https://ldaprecord.com/docs/laravel/v3
MIT License
492 stars 51 forks source link

Returned value from ldap:test is error if connection is not successfull #570

Closed lhost closed 11 months ago

lhost commented 11 months ago

In case of connection problem command php artisan ldap:test should return error:

$ php artisan ldap:test ; echo $?
Testing LDAP connection [default]...
+------------+------------+----------------------------+-----------------------------------------------------------+---------------+
| Connection | Successful | Username                   | Message                                                   | Response Time |
+------------+------------+----------------------------+-----------------------------------------------------------+---------------+
| default    | ✘ No       | cn=admin,dc=example,dc=com | No such object. Error Code: [32] Diagnostic Message: null | 772.8ms       |
+------------+------------+----------------------------+-----------------------------------------------------------+---------------+
1

$ php artisan ldap:test ; echo $?
Testing LDAP connection [default]...
+------------+------------+----------------------------+-------------------------+---------------+
| Connection | Successful | Username                   | Message                 | Response Time |
+------------+------------+----------------------------+-------------------------+---------------+
| default    | ✔ Yes      | cn=admin,dc=example,dc=com | Successfully connected. | 1001.81ms     |
+------------+------------+----------------------------+-------------------------+---------------+
0
stevebauman commented 11 months ago

Thanks for the PR @lhost! I've pushed a fix for this in master (https://github.com/DirectoryTree/LdapRecord-Laravel/commit/7bd279f7af9821d4747310dc0440affd2f62b540).