Commit 70abbda8 authored by Leigh Stoller's avatar Leigh Stoller

Fix minor bug; Need to always load showlogfile_sup.php3 after the

current user has been loaded and checked. A little bit of refactoring
work as well.
parent c16d76bd
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
include("showstuff.php3");
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
# This will not return if its a sajax request.
include("showlogfile_sup.php3");
......@@ -15,13 +22,6 @@ include("showlogfile_sup.php3");
#
PAGEHEADER("Snapshot Node Disk into Existing Image Descriptor");
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
if (! isset($imageid)) {
USERERROR("Must pass image name to page as 'imageid'.", 1 );
}
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005, 2006 University of Utah and the Flux Group.
# Copyright (c) 2005, 2006, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
require_once("Sajax.php");
......@@ -16,7 +16,7 @@ if (sajax_client_request()) {
}
function CHECKPAGEARGS($pid, $eid) {
global $uid, $TB_EXPT_READINFO;
global $this_user, $TB_EXPT_READINFO;
#
# Verify page arguments.
......@@ -36,16 +36,25 @@ function CHECKPAGEARGS($pid, $eid) {
PAGEARGERROR("Invalid experiment ID.");
}
#
# If $this_user is not set, someone got confused.
#
if (!isset($this_user)) {
TBERROR("Current user is not defined in CHECKPAGEARGS()", 1);
}
#
# Check to make sure this is a valid PID/EID tuple.
#
if (! TBValidExperiment($pid, $eid)) {
$experiment = Experiment::LookupByPidEid($pid, $eid);
if (! $experiment) {
USERERROR("The experiment $pid/$eid is not a valid experiment!", 1);
}
#
# Verify permission.
#
if (! TBExptAccessCheck($uid, $pid, $eid, $TB_EXPT_READINFO)) {
if (! $experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) {
USERERROR("You do not have permission to view the log for $pid/$eid!", 1);
}
}
......
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