Skip to content

Add sync_name check to Gitlab::Auth::Ldap::Access

What does this MR do and why?

Related to issue #11336 (closed)

After !112427 (merged) merged, I found that it still sync ldap user name even though we set sync_name to false.

And after testing I found it still update user's profile in the method update_user_attributes in ee/lib/ee/gitlab/auth/ldap/access.rb, so I added the condition there.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Change config Gitlab.ldap.enabled to true.
  2. Created a LDAP user which name is Tom.
  3. Login GitLab with use Tom via LDAP login.
  4. We can see a GitLab user was created, and it's name is Tom.
  5. View the GitLab user Tom's profile, and change the full name from Tom to Test.
  6. Logout and Login.
  7. We can see the GitLab user's full name is still Tom.
  8. Add config Gitlab.ldap.main.sync_name and make it false.
  9. Repeat steps 3 to 6.
  10. We can see the Gitlab user's full name has been changed to Test without synchronizing the name from the LDAP service.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Zehua Zhang

Merge request reports