MR approvals with password don't work when LDAP user changes its username in GitLab
Summary
In a GitLab setup with LDAP authentication, a user changing its username causes the MR approval with password to fail with wrong password
Steps to reproduce
- Setup a GitLab with LDAP authentication
- Setup a Project with required authentication when approving a merge request
- Login as a LDAP user (say, "fbar")
- Change its username under Settings > Account (say "foo.bar")
- Try to approve an MR in the project above
What is the current bug behavior?
Authentication error
What is the expected correct behavior?
Authentication succeeds
Possible fixes
We've narrowed it down to [this line of code[(https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/services/merge_requests/approval_service.rb#L34). Apparently it doesn't take the case when the LDAP username is different than GitLab's.
ZD https://gitlab.zendesk.com/agent/tickets/152008 (internal)