Commit b6f69ada authored by Leigh B Stoller's avatar Leigh B Stoller

Add "Su as User" to the user admin menu, based on Classic page.

parent 68e019a5
......@@ -752,6 +752,15 @@ function SpitNSFModal()
</div>\n";
}
function SpitPageReplace($newpage, $when = 0) {
$when = $when * 1000;
echo "<script type='text/javascript' language='javascript'>\n";
echo "setTimeout(function f() { ";
echo " window.location.replace('$newpage'); }, $when)\n";
echo "</script>\n";
}
#
# Generate an authentication object to pass to the browser that
# is passed to the web server on boss. This is used to grant
......
<?php
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
chdir("..");
include("defs.php3");
chdir("apt");
include("quickvm_sup.php");
$page_title = "SU as User";
#
# Only known and logged in users allowed.
#
$this_user = CheckLoginOrDie();
if (!ISADMIN()) {
USERERROR("You do not have permission to do this!", 1);
}
#
# Verify arguments.
#
$reqargs = RequiredPageArguments("target_user", PAGEARG_USER);
$target_uid = $target_user->uid();
if (DOLOGIN_MAGIC($target_user->uid(), $target_user->uid_idx()) < 0) {
USERERROR("Could not log you in as $target_uid", 1);
}
# So the menu and headers get spit out properly.
$_COOKIE[$TBNAMECOOKIE] = $target_uid;
SPITHEADER(1);
echo "<center>";
echo "<br><br>";
echo "<font size=+2>You are now logged in as <b>$target_uid</b></font>\n";
echo "<br><br>";
echo "<font size=+1>Be Careful!</font>\n";
echo "</center>";
SpitPageReplace($APTBASE, 2);
#
# Standard Testbed Footer
#
SPITNULLREQUIRE();
SPITFOOTER();
?>
......@@ -79,6 +79,8 @@
<li class='divider'></li>
<li><a role="button" id="sendtestmessage">
Send Test Message</a></li>
<li><a href="suuser.php?user=<%= target_user %>">
<span class="text-danger">SU as User</span></a></li>
<li role="presentation">
<a href='<%- emulablink %>'>
Emulab User Page</a></li>
......
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