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

[stable29] fix(user_ldap): Avoid extra LDAP request when mapping a user for the first time #51255

Open
wants to merge 6 commits into
base: stable29
Choose a base branch
from

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Mar 5, 2025

Backport of PR #50778

@backportbot backportbot bot requested review from artonge and come-nc March 5, 2025 06:31
@backportbot backportbot bot added 3. to review Waiting for reviews feature: ldap labels Mar 5, 2025
@backportbot backportbot bot added this to the Nextcloud 29.0.13 milestone Mar 5, 2025
@@ -523,6 +569,36 @@
return false;
}

if ($isUser) {
$nameAttribute = strtolower($this->connection->ldapUserDisplayName);

Check notice

Code scanning / Psalm

UndefinedMagicPropertyFetch Note

Magic instance property OCA\User_LDAP\Connection::$ldapUserDisplayName is not defined
@@ -523,6 +569,36 @@
return false;
}

if ($isUser) {
$nameAttribute = strtolower($this->connection->ldapUserDisplayName);
$filter = $this->connection->ldapUserFilter;

Check notice

Code scanning / Psalm

UndefinedMagicPropertyFetch Note

Magic instance property OCA\User_LDAP\Connection::$ldapUserFilter is not defined
$nameAttribute = strtolower($this->connection->ldapUserDisplayName);
$filter = $this->connection->ldapUserFilter;
$uuidAttr = 'ldapUuidUserAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;

Check notice

Code scanning / Psalm

UndefinedMagicPropertyFetch Note

Magic instance property OCA\User_LDAP\Connection::$ldapExpertUUIDUserAttr is not defined
$filter = $this->connection->ldapUserFilter;
$uuidAttr = 'ldapUuidUserAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
$usernameAttribute = strtolower($this->connection->ldapExpertUsernameAttr);

Check notice

Code scanning / Psalm

UndefinedMagicPropertyFetch Note

Magic instance property OCA\User_LDAP\Connection::$ldapExpertUsernameAttr is not defined
$attributesToRead = [$nameAttribute,$usernameAttribute];
// TODO fetch also display name attributes and cache them if the user is mapped
} else {
$nameAttribute = strtolower($this->connection->ldapGroupDisplayName);

Check notice

Code scanning / Psalm

UndefinedMagicPropertyFetch Note

Magic instance property OCA\User_LDAP\Connection::$ldapGroupDisplayName is not defined
// TODO fetch also display name attributes and cache them if the user is mapped
} else {
$nameAttribute = strtolower($this->connection->ldapGroupDisplayName);
$filter = $this->connection->ldapGroupFilter;

Check notice

Code scanning / Psalm

UndefinedMagicPropertyFetch Note

Magic instance property OCA\User_LDAP\Connection::$ldapGroupFilter is not defined
$nameAttribute = strtolower($this->connection->ldapGroupDisplayName);
$filter = $this->connection->ldapGroupFilter;
$uuidAttr = 'ldapUuidGroupAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDGroupAttr;

Check notice

Code scanning / Psalm

UndefinedMagicPropertyFetch Note

Magic instance property OCA\User_LDAP\Connection::$ldapExpertUUIDGroupAttr is not defined
@max-nextcloud max-nextcloud changed the title [stable29] [stable30] fix(user_ldap): Avoid extra LDAP request when mapping a user for the first time [stable29] fix(user_ldap): Avoid extra LDAP request when mapping a user for the first time Mar 5, 2025
come-nc added 6 commits March 5, 2025 14:03
…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 <[email protected]>
Avoid surprises by making sure these are lowercased apart from
 documented special case user displayname.

Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
@backportbot backportbot bot force-pushed the backport/50778/stable29 branch from 400fae4 to 7ea4c49 Compare March 5, 2025 14:03
@blizzz blizzz mentioned this pull request Mar 5, 2025
12 tasks
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.

2 participants