diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-11-20 15:14:18 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-20 19:44:12 +0100 |
commit | 213016f7589e6eec75f3c5f4d234fce5c7e83203 (patch) | |
tree | d449f4844338621fd9726f7ac0edb059799aabae /apps/user_ldap | |
parent | 2b2626566c19280ff207cbfa2c0c235ecae2a79b (diff) | |
download | nextcloud-server-213016f7589e6eec75f3c5f4d234fce5c7e83203.tar.gz nextcloud-server-213016f7589e6eec75f3c5f4d234fce5c7e83203.zip |
uid can be false when the user record does not exit
fixes not loading files app for users who got a share by the gone LDAP user
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Group_LDAP.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 0b55f8a4e92..0a348c2ee64 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -739,20 +739,24 @@ 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]; } - $uid = $result[0]; } else { // just in case $uid = $userDN; } - if(isset($this->cachedGroupsByMember[$uid])) { - $groups = array_merge($groups, $this->cachedGroupsByMember[$uid]); - } else { - $groupsByMember = array_values($this->getGroupsByMember($uid)); - $groupsByMember = $this->access->nextcloudGroupNames($groupsByMember); - $this->cachedGroupsByMember[$uid] = $groupsByMember; - $groups = array_merge($groups, $groupsByMember); + if($uid !== false) { + if (isset($this->cachedGroupsByMember[$uid])) { + $groups = array_merge($groups, $this->cachedGroupsByMember[$uid]); + } else { + $groupsByMember = array_values($this->getGroupsByMember($uid)); + $groupsByMember = $this->access->nextcloudGroupNames($groupsByMember); + $this->cachedGroupsByMember[$uid] = $groupsByMember; + $groups = array_merge($groups, $groupsByMember); + } } if($primaryGroup !== false) { |