owncloud/core — pull request #9214 by blizzz (2014-06-25 17:41:54+00:00)
Title: LDAP: Wizard email attribute detection

This PR introduces auto-detection of the mail attribute. #7895

How to test?
1. Have an LDAP with mail or mailPrimaryAddress set for at least one user
2. Go to the wizard, configure the first tab, then go to the next tab
3. Upon automatically creating the user list filter the email attribute will be detected. You can see it in the Advanced tab or via ./occ ldap:show-config [configPrefix]

Trigger: user list filter created/changed
Condition: email attribute is not configured OR (it is configured, but the search results in 0 findings)

How does the detection work?
- Define email attributes (mail, mailPrimaryAddress)
- AND-combine user list filter with ($attrname=*)
- Count results for each attribute
- Take the one with most results

Other criteria:
- If a set attribute is replaced, drop a log message

Q: Can admin still configure it manually?
A: Configuration field stays in Advanced tab. Custom setting will override wizard detection, as long as it is valid, i.e. returns at least one result. OTOH it means that if you have an email field in LDAP it will not be possible to live without set email attribute.

Please test/review @PVince81 @Xenopathic @MorrisJobke, cc @MTRichards