aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2021-12-13 16:02:05 +0100
committerCarl Schwan <carl@carlschwan.eu>2022-10-20 12:09:06 +0200
commit8b19cfcd885451080a5114dc451a3c78a8dccc81 (patch)
treef9a5352d91e15428613c4d08316402750bdf783b /apps/user_ldap/lib
parentd07f43dc12addf21aaa76e6b330560b42d8f3ced (diff)
downloadnextcloud-server-8b19cfcd885451080a5114dc451a3c78a8dccc81.tar.gz
nextcloud-server-8b19cfcd885451080a5114dc451a3c78a8dccc81.zip
Small optimisation of _groupMembers
This will not change the result as users are check to be existing afterwards but avoids this check when we know it’s a group. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index 3962b064fde..a7a22ff46d9 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -294,8 +294,13 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
if ((int)$this->access->connection->ldapNestedGroups === 1) {
while ($recordDn = array_shift($members)) {
$nestedMembers = $this->_groupMembers($recordDn, $seen);
- $members = array_merge($members, $nestedMembers);
- $allMembers[] = $recordDn;
+ if (!empty($nestedMembers)) {
+ // Group, queue its members for processing
+ $members = array_merge($members, $nestedMembers);
+ } else {
+ // User (or empty group, or previously seen group), add it to the member list
+ $allMembers[] = $recordDn;
+ }
}
} else {
$allMembers = $members;