Skip to content
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

Do not empty email, realname when updating with LDAP #1832

Merged

Conversation

dregad
Copy link
Member

@dregad dregad commented Jul 9, 2022

Fixes #24720

@dregad dregad self-assigned this Jul 9, 2022
@dregad dregad changed the base branch from master to master-2.25 July 9, 2022 17:23
@atrol
Copy link
Member

atrol commented Jul 10, 2022

Looks good, didn't test.
Most of the Travis checks failed (all where PHP version >= 7.2).
I guess this is not caused by the code changes, but I didn't have a deeper look.

@dregad
Copy link
Member Author

dregad commented Jul 10, 2022

Most of the Travis checks failed (all where PHP version >= 7.2).

Yes I noticed that too, but for sure it can't be caused by the change I committed. The logs show a lot of errors like this:

PHP Deprecated: Return type of PHPUnit_Framework_TestCase::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/travis/build/mantisbt/mantisbt/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 307

So maybe it's because I changed the PR's target branch from master to master-2.25 after submitting it.

Returns true if given PHP extension is loaded, dies if not.

Use the new function to replace an if statement checking for 'mbstring'.

This will avoid code duplication, as we need to introduce the same
check for 'ldap' extension to fix issue #30771.
The check is now performed globally in core.php, so it is no longer
necessary here.

Also remove the now-unused ERROR_LDAP_EXTENSION_NOT_LOADED constant and
corresponding error message from language strings.

Fixes #30771
A single function call replaces several individual variable assignments.
When using LDAP with $g_use_ldap_email = ON or $g_use_ldap_realname = ON
and updating a user's record from manage_user_edit_page.php, the email
or realname fields were set to blank if the LDAP connection failed or
the user was not found in the directory.

This fixes the problem by keeping the old field value when the
ldap_email() or ldap_realname_from_username() functions return false.

Fixes #24720
@dregad dregad force-pushed the i24720-ldap-user-update-empty-mail branch from 8317a5d to 010f60c Compare July 10, 2022 18:42
@dregad
Copy link
Member Author

dregad commented Jul 10, 2022

Well I force-pushed the branch and now it's all succeeded. Go figure.

@dregad dregad merged commit 010f60c into mantisbt:master-2.25 Jul 10, 2022
@dregad dregad deleted the i24720-ldap-user-update-empty-mail branch July 10, 2022 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants