LDAP: fix random resets of filter 

deprecates #7469 (author inactive)

In the LDAP Wizard  a race condition can cause that the LDAP filters can be reset. Since it is a race condition it is hard to force it to  happen. This PR fixes the race condition.

What to test?
1. Enable LDAP app (if not already so) and go to Admin settings
2. Configure an LDAP server
3. Reload the admin settings, check that everything is how you left it
4. Play around with filter settings
5. Repeat steps 3 and 4.

Please test and review @ben-denham @Xenopathic @leo-b @DeepDiver1975 or others