You are here

function ldap_servers_show_sample_user_tokens in Lightweight Directory Access Protocol (LDAP) 7

1 call to ldap_servers_show_sample_user_tokens()
LdapProfileConfAdmin::drupalForm in ldap_profile/LdapProfileConfAdmin.class.php

File

ldap_servers/ldap_servers.functions.inc, line 324
collection of functions that don't belong in server object

Code

function ldap_servers_show_sample_user_tokens($sid) {
  $ldap_server = ldap_servers_get_servers($sid, 'all', TRUE);
  $test_username = $ldap_server->testingDrupalUsername;
  if (!$test_username || !($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT || $ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_ANON)) {
    return FALSE;
  }
  if ($ldap_user = $ldap_server
    ->user_lookup($test_username)) {
    $table = theme('ldap_server_ldap_entry_table', array(
      'entry' => $ldap_user['attr'],
      'username' => $test_username,
    ));
  }
  else {
    $table = '<p>' . t('No sample user data found') . '</p>';
  }
  return $table;
}