def __init__(self, uri, bindUser, bindPw, accountBase, accountPattern, accountFullName, accountEmail, groupBase=None, groupMemberPattern=None, groupName=None, avatarPattern=None, avatarData=None, accountExtraFields=None): self.uri = uri self.bindUser = bindUser self.bindPw = bindPw self.accountBase = accountBase self.accountEmail = accountEmail self.accountPattern = accountPattern self.accountFullName = accountFullName group_params = [p for p in (groupName, groupMemberPattern, groupBase) if p is not None] if len(group_params) not in (0, 3): raise ValueError( "Incomplete LDAP groups configuration. " "To use Ldap groups, you need to specify the three " "parameters (groupName, groupMemberPattern and groupBase). ") self.groupName = groupName self.groupMemberPattern = groupMemberPattern self.groupBase = groupBase self.avatarPattern = avatarPattern self.avatarData = avatarData if accountExtraFields is None: accountExtraFields = [] self.accountExtraFields = accountExtraFields self.ldap_encoding = ldap3.get_config_parameter('DEFAULT_SERVER_ENCODING')
remove(test_logging_filename) except OSError: pass import logging logging.basicConfig(filename=test_logging_filename, level=logging.DEBUG) set_library_log_activation_level(logging.DEBUG) set_library_log_detail_level(test_log_detail) print('Testing location:', location, ' - Test server:', test_server) print('Python version:', version, ' - ldap3 version:', ldap3_version) print('Strategy:', test_strategy, '- Lazy:', test_lazy_connection, '- Check names:', test_check_names, '- Collect usage:', test_usage, ' - pool size:', test_pool_size) print('Default client encoding:', get_config_parameter('DEFAULT_CLIENT_ENCODING'), ' - Default server encoding:', get_config_parameter('DEFAULT_SERVER_ENCODING'), '- Source encoding:', getdefaultencoding(), '- File encoding:', getfilesystemencoding(), ' - Additional server encodings:', ', '.join(get_config_parameter('ADDITIONAL_SERVER_ENCODINGS'))) print('Logging:', 'False' if not test_logging else test_logging_filename, '- Log detail:', (get_detail_level_name(test_log_detail) if test_logging else 'None') + ' - Fast decoder: ', test_fast_decoder, ' - Response waiting timeout:', get_config_parameter('RESPONSE_WAITING_TIMEOUT')) def random_id(): return str(SystemRandom().random())[-5:]
if test_logging: try: remove(test_logging_filename) except OSError: pass import logging logging.basicConfig(filename=test_logging_filename, level=logging.DEBUG) set_library_log_activation_level(logging.DEBUG) set_library_log_detail_level(test_log_detail) print('Testing location:', location, ' - Test server:', test_server) print('Python version:', version, ' - ldap3 version:', ldap3_version, ' - pyasn1 version:', pyasn1_version,) print('Strategy:', test_strategy, '- Lazy:', test_lazy_connection, '- Check names:', test_check_names, '- Collect usage:', test_usage, ' - pool size:', test_pool_size) print('Default client encoding:', get_config_parameter('DEFAULT_CLIENT_ENCODING'), ' - Default server encoding:', get_config_parameter('DEFAULT_SERVER_ENCODING'), '- Source encoding:', getdefaultencoding(), '- File encoding:', getfilesystemencoding(), ' - Additional server encodings:', ', '.join(get_config_parameter('ADDITIONAL_SERVER_ENCODINGS'))) print('Logging:', 'False' if not test_logging else test_logging_filename, '- Log detail:', (get_detail_level_name(test_log_detail) if test_logging else 'None') + ' - Internal decoder: ', test_internal_decoder, ' - Response waiting timeout:', get_config_parameter('RESPONSE_WAITING_TIMEOUT')) print() def random_id(): return str(SystemRandom().random())[-5:] def generate_dn(base, batch_id, name): return test_name_attr + '=' + batch_id + name + ',' + base def get_connection(bind=None, use_ssl=None, check_names=None, lazy_connection=None,
try: remove(test_logging_filename) except OSError: pass import logging logging.basicConfig(filename=test_logging_filename, level=logging.DEBUG) set_library_log_activation_level(logging.DEBUG) set_library_log_detail_level(test_log_detail) print('Testing location:', location) print('Test server:', test_server) print('Python version:', version) print('ldap3 version:', ldap3_version) print('Strategy:', test_strategy, '- Lazy:', test_lazy_connection, '- Check names:', test_check_names, '- Collect usage:', test_usage, ' - pool size:', test_pool_size) print('Default encoding:', get_config_parameter('DEFAULT_ENCODING'), '- Source encoding:', getdefaultencoding(), '- File encoding:', getfilesystemencoding()) print('Logging:', 'False' if not test_logging else test_logging_filename, '- Log detail:', (get_detail_level_name(test_log_detail) if test_logging else 'None') + ' - Fast decoder: ', test_fast_decoder) def random_id(): return str(SystemRandom().random())[-5:] def generate_dn(base, batch_id, name): return test_name_attr + '=' + batch_id + name + ',' + base def get_connection(bind=None, use_ssl=None, check_names=None, lazy_connection=None,