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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations