[英]Get all user into subOus in a OU java ldap
i'm trying to search all user into a OU="Usuarios", but OU="Usuarios" have a subOus, example : 我正在尝试将所有用户搜索到OU =“ Usuarios”,但是OU =“ Usuarios”有一个subOus,例如:
OU=Usuarios user :ivan OU:Gerentes user:pablo OU = Usuarios用户:ivan OU:Gerentes用户:pablo
my problem : 我的问题 :
i need to find the user ivan and pablo. 我需要找到用户ivan和pablo。 but the result is comming only with ivan.
但结果仅适用于ivan。
the code : 编码 :
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
String consulta = "(& (objectClass=user))";
NamingEnumeration<SearchResult> renum = context.search("OU=Usuarios," + toDC(dominio),
consulta, controls);
I want to do this recursively, not put ("OU=Gerentes,OU=Usuarios Rimac) . 我想递归地执行此操作,而不是放(“ OU = Gerentes,OU = Usuarios Rimac)。
How can I do that? 我怎样才能做到这一点?
does your directory tree hiearachy look like this 您的目录树hiearachy看起来像这样吗
ou=Usarios
| - ivan
|
+ou=Gerentes
- pablo
you should be able to construct your search at a base of ou=Usarios
and get everything below in including the sub ou's with a scope of SUBTREE_SCOPE
. 您应该可以在
ou=Usarios
的基础上构建搜索,并获得包括SUBTREE_SCOPE
范围的子ou在内的所有内容。
A filter like (&(objectclass=user)(|(uid=ivan)(uid=pablo)))
should find both ivan and pablo if you begin your search high enough with a scope of of SUBTREE_SCOPE
. 如果您以
SUBTREE_SCOPE
的范围开始足够高的搜索,则类似(&(objectclass=user)(|(uid=ivan)(uid=pablo)))
的过滤器应同时找到ivan和pablo。
If you want all users your search string should just be (objectclass=user)
. 如果希望所有用户,则搜索字符串应仅为
(objectclass=user)
。
One thing the search base need to be fully qualified from the root. 从根本上说,搜索库需要完全合格。 This would typically be something like
通常是这样的
ou=Usarios,dc=company,dc=com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.