function ldap_servers_token_show_sample_user_tokens in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_servers/ldap_servers.tokens.inc \ldap_servers_token_show_sample_user_tokens()
File
- ldap_servers/
ldap_servers.tokens.inc, line 463 - collection of functions related to ldap tokens
Code
function ldap_servers_token_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
->userUserNameToExistingLdapEntry($test_username)) {
$table = theme('ldap_server_ldap_entry_table', array(
'entry' => $ldap_user['attr'],
'username' => $test_username,
'dn' => $ldap_user['dn'],
));
}
else {
$table = '<p>' . t('No sample user data found') . '</p>';
}
return $table;
}