from ..config.ldap import LdapConfiguration, LdapConnectionInfo
from ..xlate import XLATOR, format_list
-__version__ = '0.11.5'
+__version__ = '0.11.6'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
del self.ldap_server[inst]
# -------------------------------------------------------------------------
- def get_all_entries(self, inst, base_dn=None, ldap_filter=None, attributes=None):
+ def get_all_entries(self, inst, base_dn=None, ldap_filter=None, attributes=None, scope=None):
"""
Get all LDAP entries bellow the given BaseDN and the given LDAP filter.
"""
connect_info = self.cfg.ldap_connection[inst]
ldap = self.ldap_connection[inst]
+ if scope is None:
+ scope = SUBTREE
result = {}
LOG.debug(msg)
req_status, req_result, req_response, req_whatever = ldap.search(
- search_base=base_dn, search_scope=SUBTREE, attributes=attributes,
+ search_base=base_dn, search_scope=scope, attributes=attributes,
search_filter=ldap_filter, time_limit=self.cfg.ldap_timeout)
if req_status:
return result
# -------------------------------------------------------------------------
- def get_all_entry_dns(self, inst, ldap_filter=None):
+ def get_all_entry_dns(self, inst, ldap_filter=None, base_dn=None, scope=None):
"""Get DNs of all entries in the given LDAP instance and sort them."""
connect_info = self.cfg.ldap_connection[inst]
- base_dn = connect_info.base_dn
+ if not base_dn:
+ base_dn = connect_info.base_dn
ldap = self.ldap_connection[inst]
+ if scope is None:
+ scope = SUBTREE
result = []