Only show warning if ldap is enabled

Ticket: #6318