uid can be false when the user record does not exit (#18030)

uid can be false when the user record does not exit
This commit is contained in:
John Molakvoæ 2019-11-21 07:08:33 +01:00 committed by GitHub
commit b9dccf5929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 8 deletions

View File

@ -739,13 +739,16 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
if ($result === false) {
\OCP\Util::writeLog('user_ldap', 'No uid attribute found for DN ' . $userDN . ' on '.
$this->access->connection->ldapHost, ILogger::DEBUG);
}
$uid = false;
} else {
$uid = $result[0];
}
} else {
// just in case
$uid = $userDN;
}
if($uid !== false) {
if (isset($this->cachedGroupsByMember[$uid])) {
$groups = array_merge($groups, $this->cachedGroupsByMember[$uid]);
} else {
@ -754,6 +757,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$this->cachedGroupsByMember[$uid] = $groupsByMember;
$groups = array_merge($groups, $groupsByMember);
}
}
if($primaryGroup !== false) {
$groups[] = $primaryGroup;