-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: do not fetch LDAP display name all the time #38624
Conversation
@@ -462,7 +462,7 @@ | |||
/** | |||
* get display name of the user | |||
* @param string $uid user ID of the user | |||
* @return string|false display name | |||
* @return ?string|false display name |
Check notice
Code scanning / Psalm
ImplementedReturnTypeMismatch Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the interface this should always return a string. It seems other backends return the uid when a display name cannot be found.
How does this work with new instances? If I setup a fresh instance with ldap, will it have no display names till cron has done it's thing? |
It's only about updates. Newly discovered users will have all their details set when fetched for the first time on demand. |
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small refactor is needed to default to uid in getDisplayName directly in User_LDAP insead of returning null or false, otherwise good for me.
@@ -462,7 +462,7 @@ | |||
/** | |||
* get display name of the user | |||
* @param string $uid user ID of the user | |||
* @return string|false display name | |||
* @return ?string|false display name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the interface this should always return a string. It seems other backends return the uid when a display name cannot be found.
- use cache and rely on background update mechanism - with ajax cron it will still run - core User must not cache uid as displayname to address edge case (early announcement with displayname not ready) Signed-off-by: Arthur Schiwon <[email protected]>
aa6fd30
to
bdd3756
Compare
Summary
One one hand this targets a theoretical/rare edge case, where the Accounts Manager would attempt to insert a row, and in the process fetches the display name, upon with a change would also insert the same row, ending in a database exception.
On the other hand, this removes a lot of LDAP requests only looking for the displayname. Like with the email address, this value would be only updated twice a day in the background and upon login (unless ajax is used as background job, then updates will happen always, which is slowing doing responsiveness).
Checklist