From eab4f0427cb7d5ce2ea415402daa75d0dbff49e8 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 20 Mar 2025 21:03:34 +1100 Subject: [PATCH] No need to retrieve all records by default when getting children. By default sort records by DN until we implemented configurable sorting. Should help the timeout issues reported in #301 --- app/Classes/LDAP/Server.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Classes/LDAP/Server.php b/app/Classes/LDAP/Server.php index 19bd9346..017c9cbd 100644 --- a/app/Classes/LDAP/Server.php +++ b/app/Classes/LDAP/Server.php @@ -247,14 +247,15 @@ final class Server * @param string $dn * @return LDAPCollection|NULL */ - public function children(string $dn): ?LDAPCollection + public function children(string $dn,array $attrs=['dn']): ?LDAPCollection { return ($x=(new Entry) ->on($this->connection) ->cache(Carbon::now()->addSeconds(Config::get('ldap.cache.time'))) - ->select(['*','hassubordinates']) + ->select(array_merge($attrs,['hassubordinates'])) ->setDn($dn) ->list() + ->orderBy('dn') ->get()) ? $x : NULL; }