fix(user_ldap): Avoid extra LDAP request when mapping a user for the first time
Summary
Avoids using several LDAP searches to get UUID, display name and internal name, now gets all attributes at the same time. Also avoids extra request to build an unused user object in userExists.
TODO
- [x] ~~Avoid extra request to fetch the display name by directly caching it. (The display name is fetched by dav to update the calendar entry as soon as the user is mapped).~~ This is too complicated because of internal quirks, keeping an extra request for the display name for now.
Checklist
- Code is properly formatted
- Sign-off message is added to all commits
- [x] Tests (unit, integration, api and/or acceptance) are included
- [x] Screenshots before/after for front-end changes
- [x] Documentation (manuals or wiki) has been updated or is not required
- [x] Backports requested where applicable (ex: critical bugfixes)
Tests are failing indicating problems with attributes case, but I have a hard time understanding how it’s supposed to be.
There is this worrying comment: https://github.com/nextcloud/server/blob/3a97dbf248b3e581b5782a638743958eb6f2a640/apps/user_ldap/lib/Configuration.php#L301-L303
It’s not the only one a few of the attributes are not lower cased by the configuration it seems, but as far as I can see all methods getting record from the LDAP do lower case the keys so I’m not sure how it works.
/backport to stable30