use of com.iplanet.ums.SearchControl in project OpenAM by OpenRock.
the class AMRoleImpl method searchUsers.
/**
* Searches for users in this role using wildcards and attribute values.
* Wildcards can be specified such as a*, *, *a. To further refine the
* search, attribute-value pairs can be specifed so that DNs of users with
* matching attribute-value pairs will be returned.
*
* @param wildcard
* wildcard pattern to be used in the search
* @param avPairs
* attribute-value pairs to match when searching users
* @param searchControl
* specifies the search scope to be used, VLV ranges etc.,
*
* @return AMSearchResults which contains a Set DNs of Users matching the
* search
*
* @throws AMException
* if there is an internal error in the AM Store
* @throws SSOException
* if the sign on is no longer valid
*/
public AMSearchResults searchUsers(AMSearchControl searchControl, String avFilter) throws AMException, SSOException {
int level = searchControl.getSearchScope();
if ((level != AMConstants.SCOPE_ONE) && (level != AMConstants.SCOPE_SUB))
throw new AMException(AMSDKBundle.getString("123", super.locale), "123");
String filter = "(&" + getSearchFilter(AMObject.USER) + "(" + roleDNsAN + "=" + super.entryDN + ")" + avFilter + ")";
if (debug.messageEnabled()) {
debug.message("AMRoleImpl.searchUsers: " + filter);
}
searchControl.setSearchScope(AMConstants.SCOPE_SUB);
SearchControl sc = searchControl.getSearchControl();
String[] returnAttrs = searchControl.getReturnAttributes();
return dsServices.search(super.token, getOrganizationDN(), filter, sc, returnAttrs);
}
Aggregations