use of org.forgerock.openam.utils.CrestQuery in project OpenAM by OpenRock.
the class IdServicesImpl method getSpecialIdentities.
public IdSearchResults getSpecialIdentities(SSOToken token, IdType type, String orgName) throws IdRepoException, SSOException {
Set pluginClasses = new OrderedSet();
if (ServiceManager.isConfigMigratedTo70() && ServiceManager.getBaseDN().equalsIgnoreCase(orgName)) {
// Check the cache
if (specialIdentities != null) {
return (specialIdentities);
}
// get the "SpecialUser plugin
Set repos = idrepoCache.getIdRepoPlugins(orgName);
for (Iterator items = repos.iterator(); items.hasNext(); ) {
IdRepo repo = (IdRepo) items.next();
if (repo instanceof SpecialRepo) {
pluginClasses.add(repo);
}
}
}
// If no plugins found, return empty results
if (pluginClasses.isEmpty()) {
return (emptyUserIdentities);
} else {
IdRepo specialRepo = (IdRepo) pluginClasses.iterator().next();
CrestQuery crestQuery = new CrestQuery("*");
RepoSearchResults res = specialRepo.search(token, type, crestQuery, 0, 0, Collections.EMPTY_SET, false, 0, Collections.EMPTY_MAP, false);
Object[][] obj = new Object[1][2];
obj[0][0] = res;
obj[0][1] = Collections.EMPTY_MAP;
specialIdentities = combineSearchResults(token, obj, 1, type, orgName, false, null);
}
return (specialIdentities);
}
use of org.forgerock.openam.utils.CrestQuery in project OpenAM by OpenRock.
the class IdServicesImpl method isSpecialIdentity.
protected boolean isSpecialIdentity(SSOToken token, String name, IdType type, String orgName) throws IdRepoException, SSOException {
if (ServiceManager.isConfigMigratedTo70() && ServiceManager.getBaseDN().equalsIgnoreCase(orgName) && type.equals(IdType.USER)) {
// Check the cache
if (specialIdentityNames == null) {
// get the "SpecialUser plugin
Set spIds = new CaseInsensitiveHashSet();
Set repos = idrepoCache.getIdRepoPlugins(orgName);
for (Iterator items = repos.iterator(); items.hasNext(); ) {
IdRepo repo = (IdRepo) items.next();
if (repo instanceof SpecialRepo) {
CrestQuery crestQuery = new CrestQuery("*");
RepoSearchResults res = repo.search(token, type, crestQuery, 0, 0, Collections.EMPTY_SET, false, 0, Collections.EMPTY_MAP, false);
Set identities = res.getSearchResults();
for (Iterator ids = identities.iterator(); ids.hasNext(); ) {
spIds.add(ids.next());
}
}
}
specialIdentityNames = spIds;
}
if ((specialIdentityNames != null) && !specialIdentityNames.isEmpty()) {
return (specialIdentityNames.contains(name));
}
}
return (false);
}
use of org.forgerock.openam.utils.CrestQuery in project OpenAM by OpenRock.
the class IdRepoJAXRPCObjectImpl method search2_idrepo.
public Map search2_idrepo(String token, String type, String pattern, int maxTime, int maxResults, Set returnAttrs, boolean returnAllAttrs, int filterOp, Map avPairs, boolean recursive, String amOrgName) throws RemoteException, IdRepoException, SSOException {
SSOToken ssoToken = getSSOToken(token);
IdType idtype = IdUtils.getType(type);
IdSearchControl ctrl = new IdSearchControl();
ctrl.setAllReturnAttributes(returnAllAttrs);
ctrl.setMaxResults(maxResults);
ctrl.setReturnAttributes(returnAttrs);
ctrl.setTimeOut(maxTime);
IdSearchOpModifier modifier = (filterOp == IdRepo.OR_MOD) ? IdSearchOpModifier.OR : IdSearchOpModifier.AND;
ctrl.setSearchModifiers(modifier, avPairs);
CrestQuery crestQuery = new CrestQuery(pattern);
return IdSearchResultsToMap(idServices.search(ssoToken, idtype, ctrl, amOrgName, crestQuery));
}
Aggregations