Skip to content
Snippets Groups Projects
Commit 5caf0150 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

impoving ui on ldap status when only requesting one host

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1254 44740490-163a-0410-bde0-09ae8108e29a
parent 49079b27
No related branches found
No related tags found
No related merge requests found
<?php
$this->data['header'] = 'LDAP status page';
$this->data['head'] = '<style>
table.statustable td {
border-bottom: 1px solid #eee;
}
a {
color: #333;
text-decoration: none;
border-bottom: 1px dotted #aaa;
}
a:hover {
border-bottom: 1px solid #aaa;
}
div#content {
margin: .4em ! important;
}
p {
margin: 1em 0px 2px 0px
}
div.inbox p { margin: 0; }
</style>';
$this->includeAtTemplateBase('includes/header.php');
?>
<h2>LDAP test for <?php echo $this->getTranslation($this->data['org']['description']); ?></h2>
<p>[ <a href="?">return to list of all organizations</a> ]</p>
<?php
$t = $this;
function presentRes($restag) {
global $t;
echo('<div class="inbox" style="border: 1px solid #aaa; background: #eee; padding: .4em; margin: .2em;">');
if (array_key_exists($restag, $t->data['res'])) {
$res = $t->data['res'][$restag];
if ($res[0]) {
echo('<img style="float: right" src="/' . $t->data['baseurlpath'] . 'resources/icons/accept.png" />');
echo('OK');
} else {
echo('<img style="float: right" src="/' . $t->data['baseurlpath'] . 'resources/icons/gn/stop-l.png" />');
echo($res[1]);
}
echo('<div style="clear: both; height: 0px"></div>');
} else {
echo('<p style="color: #ccc">NA</p>');
}
echo('</div>');
}
$ok = TRUE;
foreach ($this->data['res'] AS $tag => $res) {
if ($tag == 'time') continue;
if ($res[0] == 0) $ok = FALSE;
# echo ('failed: ' . $tag . '[' . $res[0] . ']'); }
}
echo('<p>Status:</p>');
if ($ok) {
echo('<div class="inbox" style="border: 1px solid #aaa; background: yellow; padding: .4em; margin: .2em;">');
echo('<img style="float: right" src="/' . $t->data['baseurlpath'] . 'resources/icons/gn/success-l.png" />');
echo('All checks was OK');
echo('<div style="clear: both; height: 0px"></div>');
echo('</div>');
} else {
echo('<div class="inbox" style="border: 1px solid #aaa; background: yellow; padding: .4em; margin: .2em;">');
echo('<img style="float: right" src="/' . $t->data['baseurlpath'] . 'resources/icons/gn/stop-l.png" />');
echo('At least one test failed.');
echo('<div style="clear: both; height: 0px"></div>');
echo('</div>');
}
?>
<p>Checking configuration if all parameters are set properly.</p>
<?php presentRes('config'); ?>
<p>Trying to setup a TCP socket against the LDAP host.</p>
<?php presentRes('ping'); ?>
<p>Trying to bind() with the LDAP admin user.</p>
<?php presentRes('adminBind'); ?>
<p>Trying to search LDAP with a bogus user (should return zero results, and no error)</p>
<?php presentRes('ldapSearchBogus'); ?>
<p>Is a test user defined?</p>
<?php presentRes('configTest'); ?>
<p>Search LDAP for the DN of the test user given a specific eduPersonPrincipalName</p>
<?php presentRes('ldapSearchTestUser'); ?>
<p>Trying to bind() as the DN found when searching for the test user</p>
<?php presentRes('ldapBindTestUser'); ?>
<p>Getting attributes from the DN of the test user</p>
<?php presentRes('ldapGetAttributesTestUser'); ?>
<p>Checking for additional contact addresss in configuration.</p>
<?php presentRes('configMeta'); ?>
<?php $this->includeAtTemplateBase('includes/footer.php'); ?>
\ No newline at end of file
...@@ -88,19 +88,16 @@ $maxtime = $ldapStatusConfig->getValue('maxExecutionTime', 15); ...@@ -88,19 +88,16 @@ $maxtime = $ldapStatusConfig->getValue('maxExecutionTime', 15);
if (array_key_exists('orgtest', $_REQUEST)) { if (array_key_exists('orgtest', $_REQUEST)) {
$old_error_handler = set_error_handler("myErrorHandler"); $old_error_handler = set_error_handler("myErrorHandler");
echo('<html><head><style> $tester = new sspmod_ldapstatus_LDAPTester($orgs[$_REQUEST['orgtest']], $debug);
p {
font-family: monospace; color: #333;
}
</style></head><body><h1>Test connection to [' . $_REQUEST['orgtest'] . ']</h1>');
$tester = new sspmod_ldapstatus_LDAPTester($orgs[$_REQUEST['orgtest']], $debug, TRUE);
$res = $tester->test(); $res = $tester->test();
echo('<pre>');
print_r($res); $t = new SimpleSAML_XHTML_Template($config, 'ldapstatus:ldapsinglehost.php');
echo('</p>');
echo('</body>'); $t->data['res'] = $res;
$t->data['org'] = $orgs[$_REQUEST['orgtest']];
$t->show();
exit; exit;
} }
...@@ -128,7 +125,7 @@ $lightCounter = array(0,0,0); ...@@ -128,7 +125,7 @@ $lightCounter = array(0,0,0);
function resultCode($res) { function resultCode($res) {
global $lightCounter; global $lightCounter;
$code = ''; $code = '';
$columns = array('config', 'ping', 'adminBind', 'ldapSearchBogus', 'configTest', 'ldapSearchTestUser', 'ldapBindTestUser', 'ldapGetAttributesTestUser', 'configMeta'); $columns = array('configMeta', 'config', 'ping', 'adminBind', 'ldapSearchBogus', 'configTest', 'ldapSearchTestUser', 'ldapBindTestUser', 'ldapGetAttributesTestUser', );
foreach ($columns AS $c) { foreach ($columns AS $c) {
if (array_key_exists($c, $res)) { if (array_key_exists($c, $res)) {
if ($res[$c][0]) { if ($res[$c][0]) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment