[auth-ldap] Define an index for the email attribute results

Merged Florent requested to merge fflorent/official-plugins:index-email-property into master

Use case

As an administrator, I take advantage of the OpenLDAP integrated in Yunohost (thanks to which I installed PeerTube).

I use the maildrop attribute to get the email which returns several entries.

I know that I want to use is the second entry of this attribute.

Proposed solution

I add the mail-property-index which, in case of several entries are returned, choose the entry by its array index.

Alternative ?

I have thought of some alternatives, which may be a little bit harder to implement but above all to understand by the user:

  • use regexp to select the right email property
  • a textarea in which the user may enter a JS function (not sure at all about how easy it would be to use for the user…)


  • We have to test the solution and get feedback. We will open the MR once we have successfully authenticated the user and fetched the right email from the Yunohost LDAP.
  • If the index is above the array length, log a warning.
  • A hint on how to use the index (explain that it is 0-based)

NB: the patch is small enough, feedback welcome at any time by anyone :).

Edited by Florent

Merge request reports