- Notifications
You must be signed in to change notification settings - Fork 320
Fix logging to file and LDAP authentication #884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes critical authentication and logging issues in the LibreBooking system, specifically addressing LDAP/ActiveDirectory authentication failures and logging configuration problems.
- Fixes case-sensitivity bug in logging level comparisons that prevented file logging from working
- Corrects LDAP/ActiveDirectory configuration structure to match the new nested config format
- Replaces hardcoded config string with proper constant reference in LDAP options
- Changes inappropriate error-level log message to debug level
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/Common/Logging/Log.php | Adds strtolower() to normalize logging level comparisons, fixing file logging |
| plugins/Authentication/Ldap/LdapOptions.php | Replaces hardcoded string with LdapConfigKeys::DEBUG_ENABLED constant |
| plugins/Authentication/Ldap/LdapConfigKeys.php | Adds 'ldap.' prefix to all configuration keys for proper namespacing |
| plugins/Authentication/Ldap/Ldap.config.dist.php | Restructures config to use nested 'ldap' section with unprefixed keys |
| plugins/Authentication/ActiveDirectory/ActiveDirectoryConfigKeys.php | Adds 'activedirectory.' prefix to all configuration keys for proper namespacing |
| plugins/Authentication/ActiveDirectory/ActiveDirectory.config.dist.php | Restructures config to use nested 'activedirectory' section with unprefixed keys |
| plugins/Authentication/Ldap/Ldap2Wrapper.php | Changes uid attribute log message from Error to Debug level |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…UG instead of ERROR)
f157f1c to 8d404c0 Compare | fix: commit messages changed to fix linting errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christiankreidl great PR thank you for fixing this.
I would suggest a slightly different solution for the log.php (see below).
for the issue with the Plugin Configuration requiringing he plugin name in the key, I will look into a more generalized solution, so I would suggest to remove commit 58a0ba9 for now from the PR
| I created lucs7@7851a07 to fix the broken PluginConfig structure, which then will correctly apply the section a @christiankreidl Can you please test if this works with the plugins I created two docker test env to run the ActiveDiretory and Ldap plugins for login, oth passing after some testing :) |
…UG instead of ERROR)
Previous changes caused an error in the plugin config loading This commit fixes the structure and places each plugin config into its respective nested section which was existing for some but not all plugin configs
…ration loading and validation
…ation and improve error logging for invalid config values
Admin Username in Active Directory configuration LDAP Host in LDAP configuration
@lucs7 The above pull request was tested with LDAP and works. Thanks! |
| Can you merge the PR into your repo, this should update this PR too as far as I understand git ^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'default' => '', | ||
| 'label' => 'Search Filter', | ||
| 'description' => 'LDAP search filter (use %s for username)', | ||
| 'description' => 'Optional LDAP search filter for additional constraints (leave empty for default)', |
Copilot AI Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The description change is misleading. The FILTER is indeed optional (empty by default), but the comment "leave empty for default" is confusing because there is no "default" filter - it's just not used. The actual user identification filter is constructed automatically using the user.id.attribute (see Ldap2Wrapper.php line 96 where it creates a filter from the uidAttribute).
Consider clarifying the description to:
'description' => 'Optional additional LDAP search filter to combine with the uid filter (leave empty if not needed)', | 'description' => 'Optional LDAP search filter for additional constraints (leave empty for default)', | |
| 'description' => 'Optional additional LDAP search filter to combine with the uid filter (leave empty if not needed)', |
| 'type' => 'string', | ||
| 'default' => 'sub', | ||
| 'label' => 'Search Scope', | ||
| 'description' => 'LDAP search scope (base, one, or sub)', |
Copilot AI Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The removal of the 'choices' array for the SCOPE configuration is a regression. The choices provided useful UI hints and validation for the three valid LDAP search scope values ('base', 'one', 'sub'). Removing this makes the configuration less user-friendly and removes validation that could catch configuration errors.
Consider restoring the choices:
'choices' => [ 'base' => 'Base', 'one' => 'One Level', 'sub' => 'Subtree' ]| 'description' => 'LDAP search scope (base, one, or sub)', | |
| 'description' => 'LDAP search scope (base, one, or sub)', | |
| 'choices' => [ | |
| 'base' => 'Base', | |
| 'one' => 'One Level', | |
| 'sub' => 'Subtree' | |
| ], |
| if ($section) { | ||
| if ("{$section}.{$configKey}" === $key) { | ||
| return $config; | ||
| } |
Copilot AI Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The findByKey method is incomplete. When a config doesn't have a section, the method should still check if the key matches (without section prefix) and return the config. Currently, if $section is null or empty, the method will never return anything, causing all non-sectioned keys to not be found.
Add an else clause to handle configs without sections:
} else { // Config without section - match key directly if ($configKey === $key) { return $config; } }| } | |
| } | |
| } else { | |
| // Config without section - match key directly | |
| if ($configKey === $key) { | |
| return $config; | |
| } |
| | ||
| public function setUp(): void | ||
| { | ||
| parent::setup(); |
Copilot AI Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Method name case mismatch: The call to parent::setup() should be parent::setUp() to match the PHPUnit convention and the method signature defined on line 13. PHP method names are case-insensitive, but this inconsistency could cause confusion.
| parent::setup(); | |
| parent::setUp(); |
| Looks good to me 🥳 |
| can be closed as #899 is taking it over |
Hi!
This pull request fixes: