Search in sources :

Example 91 with ZLdapFilter

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

the class TestLdapZLdapFilter method accountsByGrants.

@Test
public void accountsByGrants() throws Exception {
    List<String> GRANTEE_IDS = Lists.newArrayList("GRANTEE-ID-1", "GRANTEE-ID-2", "...");
    boolean includePublicShares = true;
    boolean includeAllAuthedShares = true;
    // legacy code
    StringBuilder searchQuery = new StringBuilder().append("(&(objectClass=zimbraAccount)(|");
    for (String id : GRANTEE_IDS) {
        searchQuery.append(String.format("(zimbraSharedItem=granteeId:%s*)", id));
    }
    if (includePublicShares) {
        searchQuery.append("(zimbraSharedItem=*granteeType:pub*)");
    }
    if (includeAllAuthedShares) {
        searchQuery.append("(zimbraSharedItem=*granteeType:all*)");
    }
    searchQuery.append("))");
    String legacyFilter = searchQuery.toString();
    String filter = LegacyLdapFilter.accountsByGrants(GRANTEE_IDS, includePublicShares, includeAllAuthedShares);
    ZLdapFilter zLdapFilter = filterDactory.accountsByGrants(GRANTEE_IDS, includePublicShares, includeAllAuthedShares);
    assertEquals(legacyFilter, filter);
    verify(FilterId.ACCOUNTS_BY_GRANTS, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 92 with ZLdapFilter

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

the class TestLdapZLdapFilter method mimeEntryByMimeType.

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

Example 93 with ZLdapFilter

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

the class TestLdapZLdapFilter method groupByName.

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

Example 94 with ZLdapFilter

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

the class TestLdapZLdapFilter method allIdentities.

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

Example 95 with ZLdapFilter

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

the class TestLdapZLdapFilter method hasSubordinates.

@Test
public void hasSubordinates() throws Exception {
    String filter = LegacyLdapFilter.hasSubordinates();
    ZLdapFilter zLdapFilter = filterDactory.hasSubordinates();
    verify(FilterId.HAS_SUBORDINATES, 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