use of com.zimbra.cs.account.ldap.LdapGalMapRules in project zm-mailbox by Zimbra.
the class GalSearchConfig method loadConfig.
protected void loadConfig(Domain domain, GalOp op) throws ServiceException {
mRules = new LdapGalMapRules(domain, false);
mOp = op;
GalMode galMode = domain.getGalMode();
if (galMode == GalMode.zimbra)
loadZimbraConfig(domain, op, null);
switch(op) {
case sync:
mUrl = domain.getMultiAttr(Provisioning.A_zimbraGalSyncLdapURL);
mFilter = domain.getAttr(Provisioning.A_zimbraGalLdapFilter);
mSearchBase = domain.getAttr(Provisioning.A_zimbraGalSyncLdapSearchBase, "");
mStartTlsEnabled = domain.getBooleanAttr(Provisioning.A_zimbraGalSyncLdapStartTlsEnabled, false);
mAuthMech = domain.getAttr(Provisioning.A_zimbraGalSyncLdapAuthMech, Provisioning.LDAP_AM_SIMPLE);
mBindDn = domain.getAttr(Provisioning.A_zimbraGalSyncLdapBindDn);
mBindPassword = domain.getAttr(Provisioning.A_zimbraGalSyncLdapBindPassword);
mKerberosPrincipal = domain.getAttr(Provisioning.A_zimbraGalSyncLdapKerberos5Principal);
mKerberosKeytab = domain.getAttr(Provisioning.A_zimbraGalSyncLdapKerberos5Keytab);
mTimestampFormat = domain.getAttr(Provisioning.A_zimbraGalSyncTimestampFormat, LdapDateUtil.ZIMBRA_LDAP_GENERALIZED_TIME_FORMAT_LEGACY);
mPageSize = domain.getIntAttr(Provisioning.A_zimbraGalSyncLdapPageSize, 1000);
if (isConfigComplete())
break;
case search:
mUrl = domain.getMultiAttr(Provisioning.A_zimbraGalLdapURL);
mFilter = domain.getAttr(Provisioning.A_zimbraGalLdapFilter);
mSearchBase = domain.getAttr(Provisioning.A_zimbraGalLdapSearchBase, "");
mStartTlsEnabled = domain.getBooleanAttr(Provisioning.A_zimbraGalLdapStartTlsEnabled, false);
mAuthMech = domain.getAttr(Provisioning.A_zimbraGalLdapAuthMech, Provisioning.LDAP_AM_SIMPLE);
mBindDn = domain.getAttr(Provisioning.A_zimbraGalLdapBindDn);
mBindPassword = domain.getAttr(Provisioning.A_zimbraGalLdapBindPassword);
mKerberosPrincipal = domain.getAttr(Provisioning.A_zimbraGalLdapKerberos5Principal);
mKerberosKeytab = domain.getAttr(Provisioning.A_zimbraGalLdapKerberos5Keytab);
mTokenizeKey = domain.getAttr(Provisioning.A_zimbraGalTokenizeSearchKey);
mPageSize = domain.getIntAttr(Provisioning.A_zimbraGalLdapPageSize, 1000);
break;
case autocomplete:
mUrl = domain.getMultiAttr(Provisioning.A_zimbraGalLdapURL);
mFilter = domain.getAttr(Provisioning.A_zimbraGalAutoCompleteLdapFilter);
mSearchBase = domain.getAttr(Provisioning.A_zimbraGalLdapSearchBase, "");
mStartTlsEnabled = domain.getBooleanAttr(Provisioning.A_zimbraGalLdapStartTlsEnabled, false);
mAuthMech = domain.getAttr(Provisioning.A_zimbraGalLdapAuthMech, Provisioning.LDAP_AM_SIMPLE);
mBindDn = domain.getAttr(Provisioning.A_zimbraGalLdapBindDn);
mBindPassword = domain.getAttr(Provisioning.A_zimbraGalLdapBindPassword);
mKerberosPrincipal = domain.getAttr(Provisioning.A_zimbraGalLdapKerberos5Principal);
mKerberosKeytab = domain.getAttr(Provisioning.A_zimbraGalLdapKerberos5Keytab);
mTokenizeKey = domain.getAttr(Provisioning.A_zimbraGalTokenizeAutoCompleteKey);
mPageSize = domain.getIntAttr(Provisioning.A_zimbraGalLdapPageSize, 1000);
break;
}
if (mFilter != null && mFilter.indexOf("(") == -1)
mFilter = GalSearchConfig.getFilterDef(mFilter);
mGalType = GalType.ldap;
}
use of com.zimbra.cs.account.ldap.LdapGalMapRules in project zm-mailbox by Zimbra.
the class GalSearchConfig method loadZimbraConfig.
protected void loadZimbraConfig(Domain domain, GalOp op, GalSearchType stype) throws ServiceException {
mRules = new LdapGalMapRules(domain, true);
mOp = op;
NamedFilter filterName = null;
switch(op) {
case sync:
filterName = (stype == GalSearchType.all) ? NamedFilter.zimbraSync : (stype == GalSearchType.resource) ? NamedFilter.zimbraResourceSync : (stype == GalSearchType.group) ? NamedFilter.zimbraGroupSync : NamedFilter.zimbraAccountSync;
break;
case search:
filterName = (stype == GalSearchType.all) ? NamedFilter.zimbraSearch : (stype == GalSearchType.resource) ? NamedFilter.zimbraResources : (stype == GalSearchType.group) ? NamedFilter.zimbraGroups : NamedFilter.zimbraAccounts;
mTokenizeKey = domain.getAttr(Provisioning.A_zimbraGalTokenizeSearchKey, null);
break;
case autocomplete:
filterName = (stype == GalSearchType.all) ? NamedFilter.zimbraAutoComplete : (stype == GalSearchType.resource) ? NamedFilter.zimbraResourceAutoComplete : (stype == GalSearchType.group) ? NamedFilter.zimbraGroupAutoComplete : NamedFilter.zimbraAccountAutoComplete;
mTokenizeKey = domain.getAttr(Provisioning.A_zimbraGalTokenizeAutoCompleteKey, null);
break;
}
String filter = null;
if (filterName != null) {
filter = GalSearchConfig.getFilterDef(filterName);
}
if (filter == null && op == GalOp.sync) {
filter = GalFilter.DEFAULT_SYNC_FILTER;
}
mAuthMech = Provisioning.LDAP_AM_SIMPLE;
if (filter == null) {
filter = "";
} else if (!filter.startsWith("(")) {
filter = "(" + filter + ")";
}
String dnSubtreeMatchFilter = null;
String searchBaseRaw = ZimbraGalSearchBase.getSearchBaseRaw(domain, op);
if (ZimbraGalSearchBase.PredefinedSearchBase.DOMAIN.name().equals(searchBaseRaw)) {
dnSubtreeMatchFilter = ((LdapDomain) domain).getDnSubtreeMatchFilter().toFilterString();
}
if (dnSubtreeMatchFilter == null) {
dnSubtreeMatchFilter = "";
}
mFilter = "(&" + filter + "(!(zimbraHideInGal=TRUE))(!(zimbraIsSystemResource=TRUE))" + dnSubtreeMatchFilter + ")";
mSearchBase = ZimbraGalSearchBase.getSearchBase(domain, op);
mGalType = GalType.zimbra;
mTimestampFormat = LdapDateUtil.ZIMBRA_LDAP_GENERALIZED_TIME_FORMAT_LEGACY;
mPageSize = 1000;
}
Aggregations