Commit 4ae52ce4 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Allow cross-project experiment copy when the source experiment is

a current experiment and the user has permission to view the source.
parent 095adf54
...@@ -292,20 +292,35 @@ $exp_pid = $formfields[exp_pid]; ...@@ -292,20 +292,35 @@ $exp_pid = $formfields[exp_pid];
$exp_gid = ((isset($formfields[exp_gid]) && $formfields[exp_gid] != "") ? $exp_gid = ((isset($formfields[exp_gid]) && $formfields[exp_gid] != "") ?
$formfields[exp_gid] : $exp_pid); $formfields[exp_gid] : $exp_pid);
$exp_id = $formfields[exp_id]; $exp_id = $formfields[exp_id];
$extragroups = "";
# #
# Verify permissions. We do this here since pid/eid/gid could be bogus above. # Verify permissions. We do this here since pid/eid/gid could be bogus above.
# #
if (! TBProjAccessCheck($uid, $exp_pid, $exp_gid, $TB_PROJECT_CREATEEXPT)) { if (! TBProjAccessCheck($uid, $exp_pid, $exp_gid, $TB_PROJECT_CREATEEXPT)) {
$errors["Project/Group"] = "Not $exp_gid enough permission to create experiment"; $errors["Project/Group"] = "Not enough permission to create experiment";
XMLERROR(); XMLERROR();
} }
# #
# Figure out the NS file to give to the script. Eventually we will allow # Figure out the NS file to give to the script. Eventually we will allow
# it to come inline as an XML argument. # it to come inline as an XML argument.
# #
if ($nsfilelocale == "copyid") { if ($nsfilelocale == "copyid") {
if (preg_match("/^([-\w]+),([-\w]+)$/", $formfields['copyid'], $matches)) {
$copypid = $matches[1];
$copyeid = $matches[2];
if (! TBExptAccessCheck($uid, $copypid, $copyeid, $TB_EXPT_READINFO)){
$errors["Project/Group"] =
"Not enough permission to copy experiment $copypid/$copyeid";
XMLERROR();
}
if ($copypid != $exp_pid)
$extragroups = ",$copypid";
}
$thensfile = "-c " . $formfields['copyid']; $thensfile = "-c " . $formfields['copyid'];
# A branch needs the -b option. # A branch needs the -b option.
...@@ -426,7 +441,7 @@ TBGroupUnixInfo($exp_pid, $exp_gid, $unix_gid, $unix_name); ...@@ -426,7 +441,7 @@ TBGroupUnixInfo($exp_pid, $exp_gid, $unix_gid, $unix_name);
# #
set_time_limit(0); set_time_limit(0);
$retval = SUEXEC($uid, "$exp_pid,$unix_gid", $retval = SUEXEC($uid, "$exp_pid,$unix_gid" . $extragroups ,
"webbatchexp $batcharg -E $exp_desc $exp_swappable ". "webbatchexp $batcharg -E $exp_desc $exp_swappable ".
"$linktestarg -p $exp_pid -g $exp_gid -e $exp_id ". "$linktestarg -p $exp_pid -g $exp_gid -e $exp_id ".
($nonsfile ? "" : "$thensfile"), ($nonsfile ? "" : "$thensfile"),
......
Supports Markdown
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