Commit eae2f4ce authored by Russ Fish's avatar Russ Fish

Only show KB "Testbed Operations" section for admins (red-dot) or...

Only show KB "Testbed Operations" section for admins (red-dot) or foreign_admins (from the testbed-admins list.)
parent d7f54235
......@@ -54,8 +54,14 @@ PAGEHEADER("Documentation");
Emulab Advanced Tutorial</a></b>
<li><b><a href="tutorial/docwrapper.php3?docname=advanced.html">
Emulab Advanced Example</a></b>
<li><b><a href="kb-search.php3">
Search or Browse the Emulab Knowledge Base</a></b>
<?php
# Link to kb-search through $TBBASE (https:), not $TBDOCBASE (http:).
# On https:, the browser sends HashCookie, so we get CHECKLOGIN_LOGGEDIN
# status. Going via http:, we get CHECKLOGIN_MAYBEVALID, and can't know
# whether to show admin KB entries.
echo "<li><b><a href=\"$TBBASE/kb-search.php3\">\n
Search or Browse the Emulab Knowledge Base</a></b>\n";
?>
<li><b><a href="tutorial/docwrapper.php3?docname=nscommands.html">
Emulab-specific NS Extensions Reference Manual</a></b>
<li><b><a href = "xmlrpcapi.php3">Emulab's XML-RPC interface reference</a></b>
......
......@@ -6,6 +6,10 @@
#
if (!isset($embedded)) {
require("defs.php3");
# Some Knowledge Base entries are visible only to admins.
$uid = GETLOGIN();
$admin_access = ISADMIN($uid) || ISFOREIGN_ADMIN($uid);
}
#
......@@ -17,6 +21,8 @@ if (!isset($embedded)) {
function SPITFORM($query, $query_type, $query_which, $error)
{
global $TBBASE;
echo "<table align=center border=1>
<form action=kb-search.php3 method=get>\n";
......@@ -97,8 +103,12 @@ function SPITFORM($query, $query_type, $query_which, $error)
echo "</form>
</table><br>\n";
# Link to kb-browse through $TBBASE (https:), not $TBDOCBASE (http:).
# On https:, the browser sends HashCookie, so we get CHECKLOGIN_LOGGEDIN
# status. Going via http:, we get CHECKLOGIN_MAYBEVALID, and can't know
# whether to show admin KB entries.
echo "<center>".
"You may also <a href=kb-browse.php3>
"You may also <a href=$TBBASE/kb-browse.php3>
browse the entire Knowledge Base</a>.".
"</center>\n";
}
......@@ -161,6 +171,8 @@ if ($query == "*" ||
preg_match("/^\s+$/", $query)) {
$search_result =
DBQueryFatal("select * from knowledge_base_entries ".
($admin_access ? "" :
"where section != 'Testbed Operations' ").
"order by section,date_created");
}
else {
......@@ -224,6 +236,8 @@ else {
$search_result =
DBQueryFatal("select * from knowledge_base_entries ".
"$clause ".
($admin_access ? "" :
"and section != 'Testbed Operations' ").
"order by section,date_created");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment