I need to extract all the people managed by a particular manager ("report"). Each person has a "manager" attribute which point to the manager. I can search on the manager attribute - but this only finds direct reports. If we have a second-level manager, it doesn't find their whole team.
I realise I can use the search query repeatedly, but this could get slow when people have a large team. Especially as I don't know if a particular user is a manager or not - until I do the search query.
Is there a single LDAP query to fetch all the reports? I'm using openldap. A similar kind of query is possible in SQL using CONNECT BY or WITH RECURSIVE.