Search in sources :

Example 96 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method cosesByMailHostPool.

@Test
public void cosesByMailHostPool() throws Exception {
    String SERVER_ID = genUUID();
    String filter = LegacyLdapFilter.cosesByMailHostPool(SERVER_ID);
    ZLdapFilter zLdapFilter = filterDactory.cosesByMailHostPool(SERVER_ID);
    verify(FilterId.COSES_BY_MAILHOST_POOL, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 97 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method bug64260.

@Test
@Bug(bug = 64260)
public void bug64260() throws Exception {
    String badStringFilter = "ad:(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(givenName=*%s*)(mail=*%s*))(!(msExchHideFromAddressLists=TRUE))(!(displayName=*(EMC)))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))";
    ZLdapFilter filter;
    boolean caughtException = false;
    try {
        filter = filterDactory.fromFilterString(FilterId.UNITTEST, badStringFilter);
    } catch (LdapException e) {
        // e.printStackTrace();
        if (LdapException.INVALID_SEARCH_FILTER.equals(e.getCode())) {
            caughtException = true;
        }
    }
    assertTrue(caughtException);
    String goodStringFilter = "(&(|(displayName=*)(cn=*)(sn=*)(givenName=*)(mail=*))(!(msExchHideFromAddressLists=TRUE))(!(displayName=*\\28EMC\\29))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))";
    // String goodStringFilter = "(displayName=*\\28EMC\\29)";
    filter = filterDactory.fromFilterString(FilterId.UNITTEST, goodStringFilter);
// System.out.println(filter.toFilterString());
/*
DEV:
zmprov mcf -zimbraGalLdapFilterDef 'zimbraAccountSync:(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(gn=*%s*)(zimbraPhoneticFirstName=*%s*)(zimbraPhoneticLastName=*%s*)(mail=*%s*)(zimbraMailDeliveryAddress=*%s*)(zimbraMailAlias=*%s*))(|(objectclass=zimbraAccount)(objectclass=zimbraDistributionList))(!(objectclass=zimbraCalendarResource)))'
zmprov mcf +zimbraGalLdapFilterDef 'zimbraAccountSync:(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(gn=*%s*)(zimbraPhoneticFirstName=*%s*)(zimbraPhoneticLastName=*%s*)(mail=*%s*)(zimbraMailDeliveryAddress=*%s*)(zimbraMailAlias=*%s*))(|(objectclass=zimbraAccount)(objectclass=zimbraDistributionList))(!(objectclass=zimbraCalendarResource))(!(displayName=*\28EMC\29)))'


DF:
zmprov mds galsync@zimbra.com VMware -zimbraGalSyncLdapFilter '(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(givenName=*%s*)(mail=*%s*))(!(msExchHideFromAddressLists=TRUE))(!(displayName=*EMC))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))'
zmprov mds galsync@zimbra.com VMware +zimbraGalSyncLdapFilter '(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(givenName=*%s*)(mail=*%s*))(!(msExchHideFromAddressLists=TRUE))(!(displayName=*\28EMC\29))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))'

zmprov mcf -zimbraGalLdapFilterDef 'ad:(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(givenName=*%s*)(mail=*%s*))(!(msExchHideFromAddressLists=TRUE))(!(displayName=*EMC))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))'
zmprov mcf +zimbraGalLdapFilterDef 'ad:(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(givenName=*%s*)(mail=*%s*))(!(msExchHideFromAddressLists=TRUE))(!(displayName=*\28EMC\29))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))'
         */
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter) LdapException(com.zimbra.cs.ldap.LdapException) Bug(com.zimbra.qa.QA.Bug)

Example 98 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method serverById.

@Test
public void serverById() throws Exception {
    String ID = genUUID();
    String filter = LegacyLdapFilter.serverById(ID);
    ZLdapFilter zLdapFilter = filterDactory.serverById(ID);
    verify(FilterId.SERVER_BY_ID, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 99 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method domainByForeignName.

@Test
public void domainByForeignName() throws Exception {
    String FOREIGN_NAME = getTestName();
    String filter = LegacyLdapFilter.domainByForeignName(FOREIGN_NAME);
    ZLdapFilter zLdapFilter = filterDactory.domainByForeignName(FOREIGN_NAME);
    verify(FilterId.DOMAIN_BY_FOREIGN_NAME, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 100 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method domainLockedForEagerAutoProvision.

@Test
public void domainLockedForEagerAutoProvision() throws Exception {
    String filter = LegacyLdapFilter.domainLockedForEagerAutoProvision();
    ZLdapFilter zLdapFilter = filterDactory.domainLockedForEagerAutoProvision();
    verify(FilterId.DOMAIN_LOCKED_FOR_AUTO_PROVISION, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Aggregations

ZLdapFilter (com.zimbra.cs.ldap.ZLdapFilter)123 ZSearchResultEntry (com.zimbra.cs.ldap.ZSearchResultEntry)15 ZSearchResultEnumeration (com.zimbra.cs.ldap.ZSearchResultEnumeration)13 ZLdapContext (com.zimbra.cs.ldap.ZLdapContext)10 ZSearchControls (com.zimbra.cs.ldap.ZSearchControls)10 ServiceException (com.zimbra.common.service.ServiceException)9 AccountServiceException (com.zimbra.cs.account.AccountServiceException)8 AuthFailedServiceException (com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException)8 ArrayList (java.util.ArrayList)8 Server (com.zimbra.cs.account.Server)7 LdapDIT (com.zimbra.cs.account.ldap.LdapDIT)7 Account (com.zimbra.cs.account.Account)6 LdapSizeLimitExceededException (com.zimbra.cs.ldap.LdapException.LdapSizeLimitExceededException)6 NamedEntry (com.zimbra.cs.account.NamedEntry)5 SearchAccountsOptions (com.zimbra.cs.account.SearchAccountsOptions)5 BySearchResultEntrySearcher (com.zimbra.cs.account.ldap.BySearchResultEntrySearcher)5 SearchLdapOptions (com.zimbra.cs.ldap.SearchLdapOptions)5 ProvTest (com.zimbra.qa.unittest.prov.ProvTest)5 LDAPException (com.unboundid.ldap.sdk.LDAPException)3 SearchRequest (com.unboundid.ldap.sdk.SearchRequest)3