summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-02-23 12:05:50 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-02-23 12:05:50 +0100
commit238c3a52011c9fb0f7a045b432107d587c925b72 (patch)
tree71c397b63d909c384d724b74fcf95702923d92e7 /apps/user_ldap
parent72af741e785f25f482b0b1d3284a15a85f27b19f (diff)
downloadnextcloud-server-238c3a52011c9fb0f7a045b432107d587c925b72.tar.gz
nextcloud-server-238c3a52011c9fb0f7a045b432107d587c925b72.zip
fix retrieving group members with numerical uids from LDAP
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index 6cb56941463..2e7bddb9c4d 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -207,6 +207,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
* @param string $dnGroup
* @param array|null &$seen
* @return array|mixed|null
+ * @throws \OC\ServerNotAvailableException
*/
private function _groupMembers($dnGroup, &$seen = null) {
if ($seen === null) {
@@ -220,26 +221,26 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
// used extensively in cron job, caching makes sense for nested groups
$cacheKey = '_groupMembers'.$dnGroup;
$groupMembers = $this->access->connection->getFromCache($cacheKey);
- if(!is_null($groupMembers)) {
+ if($groupMembers !== null) {
return $groupMembers;
}
$seen[$dnGroup] = 1;
$members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr,
$this->access->connection->ldapGroupFilter);
if (is_array($members)) {
- foreach ($members as $memberDN) {
- $allMembers[$memberDN] = 1;
+ foreach ($members as $member) {
+ $allMembers[$member] = 1;
$nestedGroups = $this->access->connection->ldapNestedGroups;
if (!empty($nestedGroups)) {
- $subMembers = $this->_groupMembers($memberDN, $seen);
+ $subMembers = $this->_groupMembers($member, $seen);
if ($subMembers) {
- $allMembers = array_merge($allMembers, $subMembers);
+ $allMembers += $subMembers;
}
}
}
}
- $allMembers = array_merge($allMembers, $this->getDynamicGroupMembers($dnGroup));
+ $allMembers += $this->getDynamicGroupMembers($dnGroup);
$this->access->connection->writeToCache($cacheKey, $allMembers);
return $allMembers;