You are here

function ldap_servers_test_user_mapping in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_servers/ldap_servers.test_form.inc \ldap_servers_test_user_mapping()
  2. 7 ldap_servers/ldap_servers.test_form.inc \ldap_servers_test_user_mapping()
1 call to ldap_servers_test_user_mapping()
ldap_servers_test_form_submit in ldap_servers/ldap_servers.test_form.inc
Submit hook for the LDAP server form.

File

ldap_servers/ldap_servers.test_form.inc, line 380

Code

function ldap_servers_test_user_mapping($drupal_username, &$ldap_server, $direction = LDAP_USER_PROV_DIRECTION_ALL, $ldap_context = NULL) {
  $ldap_user = $ldap_server
    ->userUserNameToExistingLdapEntry($drupal_username, $ldap_context);
  $errors = FALSE;
  if (!$ldap_user) {
    $results[] = t('Failed to find test user %username by searching on  %user_attr = %username.', array(
      '%username' => $drupal_username,
      '%user_attr' => $ldap_server->user_attr,
    )) . ' ' . t('Error Message:') . ' ' . $ldap_server
      ->errorMsg('ldap');
    $errors = TRUE;
  }
  else {
    $results[] = t('Found test user %username by searching on  %user_attr = %username.', array(
      '%username' => $drupal_username,
      '%user_attr' => $ldap_server->user_attr,
    ));
  }
  return array(
    $errors,
    $results,
    $ldap_user,
  );
}