Fixes BZ 1024456 verify_ldap after refactoring in 5793cd2b
1013837 - add missing associations

and add tests to ensure that all associations are there and configured
properly to avoid FK issues
Merge pull request #3294 from pitr-ch/bug/1013837

Add missing associations causing FK issues
Merge pull request #3288 from ares/bug/1024456

Fix verify_ldap after refactoring in 5793cd2b