Skip to content

Conversation

@christiankreidl
Copy link
Contributor

Hi!

This pull request fixes:

  • logging to file app.log not working due to comparison of upper- and lower-case strings
  • LDAP authentication not working due to problems with new config file format
    • ConfigKeys and config file missing prefix
    • hard-coded string instead of ConfigKey used
  • ActiveDirectory authentication also fixed, but could not be tested ( ActiveDirectory.config.php incorrectly parsed #856 )
  • LDAP log message not an error thus changed to debug

Copy link

Copilot AI left a 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.

@christiankreidl
Copy link
Contributor Author

fix: commit messages changed to fix linting errors

Copy link
Contributor

@lucs7 lucs7 left a 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

@lucs7
Copy link
Contributor

lucs7 commented Nov 14, 2025

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 added the rest of the suggestions as a PR in your repo
christiankreidl#1

I created two docker test env to run the ActiveDiretory and Ldap plugins for login, oth passing after some testing :)

christiankreidl and others added 9 commits November 14, 2025 16:01
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
…ation and improve error logging for invalid config values
Admin Username in Active Directory configuration LDAP Host in LDAP configuration
@christiankreidl
Copy link
Contributor Author

@christiankreidl Can you please test if this works with the plugins I added the rest of the suggestions as a PR in your repo christiankreidl#1

@lucs7 The above pull request was tested with LDAP and works. Thanks!

@lucs7
Copy link
Contributor

lucs7 commented Nov 17, 2025

Can you merge the PR into your repo, this should update this PR too as far as I understand git ^^

Copy link

Copilot AI left a 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)',
Copy link

Copilot AI Nov 22, 2025

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)', 
Suggested change
'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)',
Copilot uses AI. Check for mistakes.
'type' => 'string',
'default' => 'sub',
'label' => 'Search Scope',
'description' => 'LDAP search scope (base, one, or sub)',
Copy link

Copilot AI Nov 22, 2025

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' ]
Suggested change
'description' => 'LDAP search scope (base, one, or sub)',
'description' => 'LDAP search scope (base, one, or sub)',
'choices' => [
'base' => 'Base',
'one' => 'One Level',
'sub' => 'Subtree'
],
Copilot uses AI. Check for mistakes.
if ($section) {
if ("{$section}.{$configKey}" === $key) {
return $config;
}
Copy link

Copilot AI Nov 22, 2025

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; } }
Suggested change
}
}
} else {
// Config without section - match key directly
if ($configKey === $key) {
return $config;
}
Copilot uses AI. Check for mistakes.

public function setUp(): void
{
parent::setup();
Copy link

Copilot AI Nov 22, 2025

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.

Suggested change
parent::setup();
parent::setUp();
Copilot uses AI. Check for mistakes.
@lucs7
Copy link
Contributor

lucs7 commented Nov 22, 2025

Looks good to me 🥳

@lucs7
Copy link
Contributor

lucs7 commented Dec 16, 2025

can be closed as #899 is taking it over

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants