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
This commit is contained in:
Deon George 2025-03-20 21:03:34 +11:00
parent fd2c5d1286
commit eab4f0427c

View File

@ -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;
}