Search in sources :

Example 6 with LdapDIT

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

the class TestLdapHelper method searchForEntryNotFound.

@Test
public void searchForEntryNotFound() throws Exception {
    LdapDIT dit = prov.getDIT();
    String base = dit.configBranchBaseDN();
    ZLdapFilter filter = filterFactory.fromFilterString(FilterId.UNITTEST, "(cn=bogus)");
    ZSearchResultEntry sr = ldapHelper.searchForEntry(base, filter, null, false);
    assertNull(sr);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter) LdapDIT(com.zimbra.cs.account.ldap.LdapDIT) ZSearchResultEntry(com.zimbra.cs.ldap.ZSearchResultEntry)

Example 7 with LdapDIT

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

the class TestLdap method deleteAllNonDefaultCoses.

private static void deleteAllNonDefaultCoses() throws Exception {
    LdapDIT dit = ((LdapProv) Provisioning.getInstance()).getDIT();
    String cosBaseDN = dit.cosBaseDN();
    Set<String> defaultCosDN = new HashSet<String>();
    defaultCosDN.add(dit.cosNametoDN(Provisioning.DEFAULT_COS_NAME));
    defaultCosDN.add(dit.cosNametoDN(Provisioning.DEFAULT_EXTERNAL_COS_NAME));
    deleteAllChildrenUnderDN(cosBaseDN, defaultCosDN);
}
Also used : LdapDIT(com.zimbra.cs.account.ldap.LdapDIT) LdapProv(com.zimbra.cs.account.ldap.LdapProv) HashSet(java.util.HashSet)

Example 8 with LdapDIT

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

the class Cleanup method deleteAllNonDefaultCoses.

private static void deleteAllNonDefaultCoses() throws Exception {
    LdapDIT dit = ((LdapProv) Provisioning.getInstance()).getDIT();
    String cosBaseDN = dit.cosBaseDN();
    Set<String> defaultCosDN = new HashSet<String>();
    defaultCosDN.add(dit.cosNametoDN(Provisioning.DEFAULT_COS_NAME));
    defaultCosDN.add(dit.cosNametoDN(Provisioning.DEFAULT_EXTERNAL_COS_NAME));
    deleteAllChildrenUnderDN(cosBaseDN, defaultCosDN);
}
Also used : LdapDIT(com.zimbra.cs.account.ldap.LdapDIT) LdapProv(com.zimbra.cs.account.ldap.LdapProv) HashSet(java.util.HashSet)

Example 9 with LdapDIT

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

the class Cleanup method deleteAllNonDefaultServers.

private static void deleteAllNonDefaultServers() throws Exception {
    LdapProv ldapProv = LdapProv.getInst();
    LdapDIT dit = ldapProv.getDIT();
    String serverBaseDN = dit.serverBaseDN();
    Set<String> defaultServerDN = new HashSet<String>();
    defaultServerDN.add(dit.serverNameToDN(ldapProv.getLocalServer().getName()));
    deleteAllChildrenUnderDN(serverBaseDN, defaultServerDN);
}
Also used : LdapDIT(com.zimbra.cs.account.ldap.LdapDIT) LdapProv(com.zimbra.cs.account.ldap.LdapProv) HashSet(java.util.HashSet)

Example 10 with LdapDIT

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

the class CollectAllEffectiveRights method getAllCalendarResources.

private Set<String> getAllCalendarResources() throws ServiceException {
    LdapDIT ldapDIT = mProv.getDIT();
    String base = ldapDIT.mailBranchBaseDN();
    ZLdapFilter filter = ZLdapFilterFactory.getInstance().allCalendarResources();
    // hack, see LDAPDIT.dnToEmail, for now we get naming rdn for both default and possible custom DIT
    String[] returnAttrs = new String[] { Provisioning.A_cn, Provisioning.A_uid };
    Visitor visitor = new Visitor(mProv);
    mProv.searchLdapOnMaster(base, filter, returnAttrs, visitor);
    return visitor.getResult();
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter) LdapDIT(com.zimbra.cs.account.ldap.LdapDIT) SearchLdapVisitor(com.zimbra.cs.ldap.SearchLdapOptions.SearchLdapVisitor)

Aggregations

LdapDIT (com.zimbra.cs.account.ldap.LdapDIT)15 ZLdapFilter (com.zimbra.cs.ldap.ZLdapFilter)7 HashSet (java.util.HashSet)7 ZSearchResultEntry (com.zimbra.cs.ldap.ZSearchResultEntry)5 ServiceException (com.zimbra.common.service.ServiceException)4 LdapProv (com.zimbra.cs.account.ldap.LdapProv)4 SearchLdapOptions (com.zimbra.cs.ldap.SearchLdapOptions)4 SearchLdapVisitor (com.zimbra.cs.ldap.SearchLdapOptions.SearchLdapVisitor)4 Account (com.zimbra.cs.account.Account)2 IAttributes (com.zimbra.cs.ldap.IAttributes)2 ZLdapContext (com.zimbra.cs.ldap.ZLdapContext)2 ZSearchControls (com.zimbra.cs.ldap.ZSearchControls)2 ZSearchResultEnumeration (com.zimbra.cs.ldap.ZSearchResultEnumeration)2 LdapMultipleEntriesMatchedException (com.zimbra.cs.ldap.LdapException.LdapMultipleEntriesMatchedException)1