summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-10-19 13:17:06 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-10-21 16:26:47 +0200
commit85d5ac5c91933e0697d506e521c38d77cb800571 (patch)
tree104d78bf028d1406685d3097390baa9736f48b6f /apps/user_ldap/lib
parent227d237690fe51baca25b0da6c6de9cb5b6eab01 (diff)
downloadnextcloud-server-85d5ac5c91933e0697d506e521c38d77cb800571.tar.gz
nextcloud-server-85d5ac5c91933e0697d506e521c38d77cb800571.zip
when nesting is not enabled, the group filter can be applied right away
- helps performance, but skipping unnecessary entries - reduces reoccuring info-level log output against groups that do not qualify ("no or empty name") Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index 54a8eaf08ae..233077c99f3 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -343,7 +343,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
}
$seen = [];
- while ($record = array_pop($list)) {
+ while ($record = array_shift($list)) {
$recordDN = $recordMode ? $record['dn'][0] : $record;
if ($recordDN === $dn || array_key_exists($recordDN, $seen)) {
// Prevent loops
@@ -841,6 +841,12 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$allGroups = [];
$seen[$dn] = true;
$filter = $this->access->connection->ldapGroupMemberAssocAttr . '=' . $dn;
+
+ $nesting = (int)$this->access->connection->ldapNestedGroups;
+ if ($nesting === 0) {
+ $filter = $this->access->combineFilterWithAnd([$filter, $this->access->connection->ldapGroupFilter]);
+ }
+
$groups = $this->access->fetchListOfGroups($filter,
[strtolower($this->access->connection->ldapGroupMemberAssocAttr), $this->access->connection->ldapGroupDisplayName, 'dn']);
if (is_array($groups)) {