isolated LDAP check into a function and added a post block for addUser