Search in sources :

Example 1 with SearchHelper

use of com.novell.ldapchai.util.SearchHelper in project ldapchai by ldapchai.

the class ApacheLdapProviderImpl method search.

public Map<String, Map<String, String>> search(final String baseDN, final String filter, final Set<String> attributes, final SearchScope searchScope) throws ChaiOperationException, ChaiUnavailableException, IllegalStateException {
    activityPreCheck();
    getInputValidator().search(baseDN, filter, attributes, searchScope);
    final SearchHelper searchHelper = new SearchHelper();
    searchHelper.setFilter(filter);
    searchHelper.setAttributes(attributes);
    searchHelper.setSearchScope(searchScope);
    return search(baseDN, searchHelper);
}
Also used : SearchHelper(com.novell.ldapchai.util.SearchHelper)

Example 2 with SearchHelper

use of com.novell.ldapchai.util.SearchHelper in project ldapchai by ldapchai.

the class JLDAPProviderImpl method searchMultiValues.

@ChaiProvider.LdapOperation
public Map<String, Map<String, List<String>>> searchMultiValues(final String baseDN, final String filter, final Set<String> attributes, final SearchScope searchScope) throws ChaiOperationException, ChaiUnavailableException, IllegalStateException {
    activityPreCheck();
    getInputValidator().searchMultiValues(baseDN, filter, attributes, searchScope);
    final SearchHelper searchHelper = new SearchHelper();
    searchHelper.setFilter(filter);
    searchHelper.setAttributes(attributes);
    searchHelper.setSearchScope(searchScope);
    return searchImpl(baseDN, searchHelper, false);
}
Also used : SearchHelper(com.novell.ldapchai.util.SearchHelper)

Example 3 with SearchHelper

use of com.novell.ldapchai.util.SearchHelper in project ldapchai by ldapchai.

the class JNDIProviderImpl method search.

@LdapOperation
public final Map<String, Map<String, String>> search(final String baseDN, final String filter, final Set<String> attributes, final SearchScope searchScope) throws ChaiUnavailableException, ChaiOperationException {
    activityPreCheck();
    getInputValidator().search(baseDN, filter, attributes, searchScope);
    final SearchHelper searchHelper = new SearchHelper();
    searchHelper.setFilter(filter);
    searchHelper.setAttributes(attributes);
    searchHelper.setSearchScope(searchScope);
    return this.search(baseDN, searchHelper);
}
Also used : SearchHelper(com.novell.ldapchai.util.SearchHelper)

Example 4 with SearchHelper

use of com.novell.ldapchai.util.SearchHelper in project ldapchai by ldapchai.

the class UserImpl method isAccountEnabled.

public boolean isAccountEnabled() throws ChaiOperationException, ChaiUnavailableException {
    final String disabledUserSearchFilter = "(useraccountcontrol:1.2.840.113556.1.4.803:=2)";
    final SearchHelper searchHelper = new SearchHelper();
    searchHelper.setFilter(disabledUserSearchFilter);
    searchHelper.setSearchScope(SearchScope.BASE);
    final Map<String, Map<String, String>> results = this.getChaiProvider().search(this.getEntryDN(), searchHelper);
    for (final String resultDN : results.keySet()) {
        if (resultDN != null && resultDN.equals(this.getEntryDN())) {
            return false;
        }
    }
    return true;
}
Also used : SearchHelper(com.novell.ldapchai.util.SearchHelper) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 5 with SearchHelper

use of com.novell.ldapchai.util.SearchHelper in project ldapchai by ldapchai.

the class AbstractChaiEntry method readCanonicalDN.

public String readCanonicalDN() throws ChaiOperationException, ChaiUnavailableException {
    final SearchHelper searchHelper = new SearchHelper();
    searchHelper.returnNoAttributes();
    searchHelper.setSearchScope(SearchScope.BASE);
    searchHelper.setFilter(SearchHelper.DEFAULT_FILTER);
    final Map<String, Map<String, String>> results = this.getChaiProvider().search(this.getEntryDN(), searchHelper);
    if (results.size() == 1) {
        return results.keySet().iterator().next();
    }
    if (results.isEmpty()) {
        throw new ChaiOperationException("search for canonical DN resulted in no results", ChaiError.UNKNOWN);
    }
    throw new ChaiOperationException("search for canonical DN resulted in multiple results", ChaiError.UNKNOWN);
}
Also used : ChaiOperationException(com.novell.ldapchai.exception.ChaiOperationException) SearchHelper(com.novell.ldapchai.util.SearchHelper) Map(java.util.Map)

Aggregations

SearchHelper (com.novell.ldapchai.util.SearchHelper)15 Map (java.util.Map)8 LinkedHashMap (java.util.LinkedHashMap)5 ChaiOperationException (com.novell.ldapchai.exception.ChaiOperationException)4 HashMap (java.util.HashMap)4 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)4 ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)3 UserIdentity (password.pwm.bean.UserIdentity)3 ErrorInformation (password.pwm.error.ErrorInformation)3 PwmOperationalException (password.pwm.error.PwmOperationalException)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 TreeMap (java.util.TreeMap)2 SearchConfiguration (password.pwm.ldap.search.SearchConfiguration)2 UserSearchEngine (password.pwm.ldap.search.UserSearchEngine)2 LDAPAttribute (com.novell.ldap.LDAPAttribute)1 LDAPAttributeSet (com.novell.ldap.LDAPAttributeSet)1 LDAPEntry (com.novell.ldap.LDAPEntry)1 LDAPException (com.novell.ldap.LDAPException)1 LDAPSearchConstraints (com.novell.ldap.LDAPSearchConstraints)1