Search in sources :

Example 26 with ZLdapFilter

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

the class TestLdap method getDirectChildrenDNs.

private static List<String> getDirectChildrenDNs(ZLdapContext zlc, String dn) throws Exception {
    final List<String> childrenDNs = new ArrayList<String>();
    ZLdapFilter filter = ZLdapFilterFactory.getInstance().anyEntry();
    ZSearchControls searchControls = ZSearchControls.createSearchControls(ZSearchScope.SEARCH_SCOPE_ONELEVEL, ZSearchControls.SIZE_UNLIMITED, new String[] { "objectClass" });
    ZSearchResultEnumeration sr = zlc.searchDir(dn, filter, searchControls);
    while (sr.hasMore()) {
        ZSearchResultEntry entry = sr.next();
        childrenDNs.add(entry.getDN());
    }
    sr.close();
    return childrenDNs;
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter) TestLdapZLdapFilter(com.zimbra.qa.unittest.prov.ldap.TestLdapZLdapFilter) ZSearchControls(com.zimbra.cs.ldap.ZSearchControls) ZSearchResultEnumeration(com.zimbra.cs.ldap.ZSearchResultEnumeration) ArrayList(java.util.ArrayList) ZSearchResultEntry(com.zimbra.cs.ldap.ZSearchResultEntry)

Example 27 with ZLdapFilter

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

the class TestLdapZLdapFilter method allNonSystemAccounts.

@Test
public void allNonSystemAccounts() throws Exception {
    String filter = LegacyLdapFilter.allNonSystemAccounts();
    // (&(objectclass=zimbraAccount)(!(objectclass=zimbraCalendarResource))(!(zimbraIsSystemResource=TRUE)))
    ZLdapFilter zLdapFilter = filterDactory.allNonSystemAccounts();
    String zFilter = zLdapFilter.toFilterString();
    // (&(&(objectclass=zimbraAccount)(!(objectclass=zimbraCalendarResource)))(!(zimbraIsSystemResource=TRUE)))
    // assertEquals(filter, zFilter);  the diff is OK
    verifyStatString(FilterId.ALL_NON_SYSTEM_ACCOUNTS, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 28 with ZLdapFilter

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

the class TestLdapZLdapFilter method fromFilterString.

@Test
public void fromFilterString() throws Exception {
    String FILTER_STR = "(blah=123)";
    ZLdapFilter zLdapFilter = filterDactory.fromFilterString(FilterId.AUTO_PROVISION_SEARCH, FILTER_STR);
    verify(FilterId.AUTO_PROVISION_SEARCH, FILTER_STR, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 29 with ZLdapFilter

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

the class TestLdapZLdapFilter method allMimeEntries.

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

Example 30 with ZLdapFilter

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

the class TestLdapZLdapFilter method allAliases.

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

Aggregations

ZLdapFilter (com.zimbra.cs.ldap.ZLdapFilter)121 ZSearchResultEntry (com.zimbra.cs.ldap.ZSearchResultEntry)15 ZSearchResultEnumeration (com.zimbra.cs.ldap.ZSearchResultEnumeration)11 ZLdapContext (com.zimbra.cs.ldap.ZLdapContext)8 ZSearchControls (com.zimbra.cs.ldap.ZSearchControls)8 ArrayList (java.util.ArrayList)8 ServiceException (com.zimbra.common.service.ServiceException)7 Server (com.zimbra.cs.account.Server)7 LdapDIT (com.zimbra.cs.account.ldap.LdapDIT)7 Account (com.zimbra.cs.account.Account)6 AccountServiceException (com.zimbra.cs.account.AccountServiceException)6 AuthFailedServiceException (com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException)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