LDAP - When AD user is renamed it disappears from Moodle and creates blank user

LDAP - When AD user is renamed it disappears from Moodle and creates blank user

by I Ivanov -
Number of replies: 3

Hi All,

We currently use M 3.11 and we have LDAP set up with AD. 

For some reason, when you rename an AD user (Account > User Logon name in AD), instead of renaming it in Moodle, it just deletes the user entirely and creates a blank renamed user.

For now, as a workaround, we've changed LDAP settings so that it at least doesn't remove internal users;



However, once you rename any AD user, it just creates a blank one. 

We used to have an older 3.8 moodle server that didn't have this problem... We cross-checked the LDAP settings on both servers, every setting is identical. 

I found a similarish problem in the forums here, checked the sAMAccountName for the AD users and they all correspond to their usernames. So, if I rename an AD user from X to Y, should I leave sAMAccountName as X for it to work?

https://moodle.org/mod/forum/discuss.php?d=314672


FYI, I'm quite a novice what comes to Moodle here, so please take it easy :D

Thank you!


Average of ratings: -
In reply to I Ivanov

Re: LDAP - When AD user is renamed it disappears from Moodle and creates blank user

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Yes, this is frustrating but expected behavior.  When you use samaccountname as the username, any change to the samaccountname will create a new account in Moodle.  About the only way to avoid this is to 1) don't change the samaccountname but the users don't like this (especially if you are using their name and they get married or there is a typo!!).  2) map another field to moodle as the username but then they will have some random login.

What I do is suspend users instead of deleting them and then I use the Merge User plugin (invaluable plugin!!) to merge the two accounts and manually delete the old user once that is done.

Average of ratings: Useful (2)
In reply to Emma Richardson

Re: LDAP - When AD user is renamed it disappears from Moodle and creates blank user

by I Ivanov -
Thanks Emma,

We installed Merge User plugin. God only knows why it worked on the older version tho..

Thanks!
In reply to I Ivanov

Re: LDAP - When AD user is renamed it disappears from Moodle and creates blank user

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
It is weird because it has always been that way and I have been using ldap since 2. something...