def _import_ldap_users(connection, username_pattern, sync_groups=False, import_by_dn=False, server=None, failed_users=None):
 user_info = None
 try:
  user_info = connection.find_users(username_pattern, find_by_dn=import_by_dn)
 except LdapSearchException as e:
  LOG.warn(('Failed to find LDAP user: %s' % e))
 if (not user_info):
  LOG.warn(('Could not get LDAP details for users with pattern %s' % username_pattern))
  return None
 return _import_ldap_users_info(connection, user_info, sync_groups, import_by_dn, server, failed_users=failed_users)

def _import_ldap_users ( connection , username_pattern , sync_groups = False , import_by_dn = False , server = None , failed_users = None ) : user_info = None try : user_info = connection . find_users ( username_pattern , find_by_dn = import_by_dn ) except LdapSearchException as e : LOG . warn ( ( 'Failed to find LDAP user: %s' % e ) ) if ( not user_info ) : LOG . warn ( ( 'Could not get LDAP details for users with pattern %s' % username_pattern ) ) return None return _import_ldap_users_info ( connection , user_info , sync_groups , import_by_dn , server , failed_users = failed_users )
import a user from ldap .