Answer the question
In order to leave comments, you need to log in
How can I get the organizationalUnit tree in ldap (Open ldap) or at least the organizationalUnit tree directly from the parent?
Let's have categories
-Worker
--Forestry worker --It
industry worker
---
Frontend ---Backend
--Fishing worker
Wrote the code
List<String> nameList = ldapTemplate.search("", "(objectClass=organizationalUnit)",
new AttributesMapper<String>() {
@Override
public String mapFromAttributes(Attributes attributes) throws NamingException {
String group = "";
Attribute groupAttr = attributes.get("ou");
Attribute userAttr = attributes.get("cn");
if (groupAttr != null) {
group = groupAttr.get() + "\n";
}
return group;
}
(objectClass=organizationalUnit)
Answer the question
In order to leave comments, you need to log in
Use SearchBase (where to start searching) and SearchScope (search scope - Base, OneLevel or SubTree)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question