Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(user_ldap): Avoid extra LDAP request when mapping a user for the first time #46114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented Jun 25, 2024

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

  • 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

@come-nc come-nc added this to the Nextcloud 30 milestone Jun 25, 2024
@come-nc come-nc self-assigned this Jun 25, 2024
$filter = $this->connection->ldapUserFilter;
$uuidAttr = 'ldapUuidUserAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
$usernameAttribute = (string)$this->connection->ldapExpertUsernameAttr;

Check notice

Code scanning / Psalm

RedundantCastGivenDocblockType Note

Redundant cast to string given docblock-provided type
…first time

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.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
…n mapping new user

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc come-nc force-pushed the enh/improve-ldap-group-members-listing-performances branch from 4b75668 to e681d82 Compare July 9, 2024 07:29
@come-nc come-nc added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 9, 2024
@come-nc come-nc marked this pull request as ready for review July 9, 2024 07:33
@come-nc
Copy link
Contributor Author

come-nc commented Jul 9, 2024

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:

// user display name does not lower case because
// we rely on an upper case N as indicator whether to
// auto-detect it or not. FIXME

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant