Commit f15291fa authored by Leigh Stoller's avatar Leigh Stoller

Do not show ssh links or ssh console when the person viewing the page is an

admin, looking at another user's status page. This takes care of the first
bullet in emulab/emulab-devel#7
parent bea213c1
......@@ -23,6 +23,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
var oneonly = 0;
var isadmin = 0;
var isguest = 0;
var dossh = 1;
var extend = null;
var status_collapsed = false;
var status_message = "";
......@@ -36,6 +37,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
oneonly = window.APT_OPTIONS.oneonly;
isadmin = window.APT_OPTIONS.isadmin;
isguest = !window.APT_OPTIONS.registered;
dossh = window.APT_OPTIONS.dossh;
extend = window.APT_OPTIONS.extend || null;
var instanceStatus = window.APT_OPTIONS.instanceStatus;
......@@ -714,7 +716,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
var ssh = "n/a";
var cons = "n/a";
if (login.length) {
if (login.length && dossh) {
var user = login.attr("username");
var host = login.attr("hostname");
var port = login.attr("port");
......@@ -792,7 +794,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
}
// And start up ssh for single node topologies.
if (nodecount == 1 && nodehostport && !oneonly) {
if (nodecount == 1 && nodehostport && !oneonly && dossh) {
NewSSHTab(nodehostport, nodename);
}
}
......@@ -847,6 +849,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
var callback = function(json) {
sup.HideModal('#waitwait-modal');
//console.log("StartSnapshot");
//console.log(json);
if (json.code) {
......
......@@ -132,6 +132,7 @@ $canclone = (($profile->published() && isset($this_user) &&
$snapping = 0;
$oneonly = (isset($oneonly) && $oneonly ? 1 : 0);
$isadmin = (ISADMIN() ? 1 : 0);
$dossh = $this_user->SameUser($creator) ? 1 : 0;
#
# See if we have a task running in the background for this instance.
......@@ -171,6 +172,7 @@ echo " window.APT_OPTIONS.cansnap = $cansnap;\n";
echo " window.APT_OPTIONS.canclone = $canclone;\n";
echo " window.APT_OPTIONS.snapping = $snapping;\n";
echo " window.APT_OPTIONS.oneonly = $oneonly;\n";
echo " window.APT_OPTIONS.dossh = $dossh;\n";
echo " window.APT_OPTIONS.AJAXURL = 'server-ajax.php';\n";
if (isset($extend) && $extend != "") {
echo " window.APT_OPTIONS.extend = $extend;\n";
......
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