use of com.zimbra.cs.account.SearchAccountsOptions.IncludeType in project zm-mailbox by Zimbra.
the class LdapProvisioning method searchAccountsOnServerInternal.
private List<NamedEntry> searchAccountsOnServerInternal(Server server, SearchAccountsOptions options, NamedEntry.Visitor visitor) throws ServiceException {
// filter cannot be set
if (options.getFilter() != null || options.getFilterString() != null) {
throw ServiceException.INVALID_REQUEST("cannot set filter for searchAccountsOnServer", null);
}
if (server == null) {
throw ServiceException.INVALID_REQUEST("missing server", null);
}
IncludeType includeType = options.getIncludeType();
/*
* This is the ONLY place where search filter can be affected by domain, because
* we have to support custom DIT where account/cr entries are NOT populated under
* the domain tree. In our default LdapDIT implementation, domain is always
* ignored in the filterXXX(domain, server) calls.
*
* Would be great if we don't have to support custom DIT someday.
*/
Domain domain = options.getDomain();
ZLdapFilter filter;
if (includeType == IncludeType.ACCOUNTS_AND_CALENDAR_RESOURCES) {
filter = mDIT.filterAccountsByDomainAndServer(domain, server);
} else if (includeType == IncludeType.ACCOUNTS_ONLY) {
filter = mDIT.filterAccountsOnlyByDomainAndServer(domain, server);
} else {
filter = mDIT.filterCalendarResourceByDomainAndServer(domain, server);
}
options.setFilter(filter);
return searchDirectoryInternal(options, visitor);
}
Aggregations