Commit dc0adaed authored by Leigh Stoller's avatar Leigh Stoller

Call SUEXEC() with project object instead of pid.

parent 99f4893e
...@@ -248,7 +248,7 @@ function Do_CreateDataSet() ...@@ -248,7 +248,7 @@ function Do_CreateDataSet()
$command = "webmanage_dataset $wopt -- create $options"; $command = "webmanage_dataset $wopt -- create $options";
} }
$retval = SUEXEC($this_uid, $pid, $command, SUEXEC_ACTION_IGNORE); $retval = SUEXEC($this_uid, $project, $command, SUEXEC_ACTION_IGNORE);
if ($retval) { if ($retval) {
$webtask->Refresh(); $webtask->Refresh();
if (!$webtask->exited() || $retval < 0) { if (!$webtask->exited() || $retval < 0) {
...@@ -343,6 +343,8 @@ function Do_ModifyDataSet() ...@@ -343,6 +343,8 @@ function Do_ModifyDataSet()
SPITAJAX_ERROR(1, "Unknown dataset"); SPITAJAX_ERROR(1, "Unknown dataset");
return; return;
} }
$project = $dataset->Project();
if ($this_uid != $dataset->owner_uid() && !ISADMIN()) { if ($this_uid != $dataset->owner_uid() && !ISADMIN()) {
SPITAJAX_ERROR(1, "Not enough permission"); SPITAJAX_ERROR(1, "Not enough permission");
return; return;
...@@ -457,7 +459,7 @@ function Do_ModifyDataSet() ...@@ -457,7 +459,7 @@ function Do_ModifyDataSet()
if ($opt != "") { if ($opt != "") {
if ($dataset->islocal()) { if ($dataset->islocal()) {
$command = $dataset->grantCommand() . " "; $command = $dataset->grantCommand() . " ";
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $project,
"$command $opt $leaseid", "$command $opt $leaseid",
SUEXEC_ACTION_CONTINUE); SUEXEC_ACTION_CONTINUE);
if ($retval) { if ($retval) {
...@@ -468,7 +470,7 @@ function Do_ModifyDataSet() ...@@ -468,7 +470,7 @@ function Do_ModifyDataSet()
else { else {
$webtask = WebTask::CreateAnonymous(); $webtask = WebTask::CreateAnonymous();
$command = $dataset->grantCommand($webtask); $command = $dataset->grantCommand($webtask);
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $project,
"$command $opt $leaseid", "$command $opt $leaseid",
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
if ($retval) { if ($retval) {
...@@ -495,7 +497,7 @@ function Do_ModifyDataSet() ...@@ -495,7 +497,7 @@ function Do_ModifyDataSet()
$pid = $dataset->pid(); $pid = $dataset->pid();
if ($embedded || $dataset->islocal()) { if ($embedded || $dataset->islocal()) {
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $project,
"webclone_image -b $safe_bsname ". "webclone_image -b $safe_bsname ".
"$dname $safe_nodeid", "$dname $safe_nodeid",
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
...@@ -509,7 +511,7 @@ function Do_ModifyDataSet() ...@@ -509,7 +511,7 @@ function Do_ModifyDataSet()
} }
else { else {
$webtask = WebTask::CreateAnonymous(); $webtask = WebTask::CreateAnonymous();
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $project,
"webmanage_dataset -t ". $webtask->task_id() . "webmanage_dataset -t ". $webtask->task_id() .
" snapshot -i $instance_uuid ". " snapshot -i $instance_uuid ".
" -b $safe_bsname $pid/$dname $safe_nodeid", " -b $safe_bsname $pid/$dname $safe_nodeid",
...@@ -562,6 +564,8 @@ function Do_DeleteDataset() ...@@ -562,6 +564,8 @@ function Do_DeleteDataset()
SPITAJAX_ERROR(1, "Unknown dataset"); SPITAJAX_ERROR(1, "Unknown dataset");
return; return;
} }
$project = $dataset->Project();
if ($this_uid != $dataset->owner_uid() && !ISADMIN()) { if ($this_uid != $dataset->owner_uid() && !ISADMIN()) {
SPITAJAX_ERROR(1, "Not enough permission"); SPITAJAX_ERROR(1, "Not enough permission");
return; return;
...@@ -572,7 +576,7 @@ function Do_DeleteDataset() ...@@ -572,7 +576,7 @@ function Do_DeleteDataset()
# #
if ($dataset->islocal()) { if ($dataset->islocal()) {
$command = $dataset->deleteCommand(); $command = $dataset->deleteCommand();
$retval = SUEXEC($this_uid, $dataset->pid(), $command, $retval = SUEXEC($this_uid, $project, $command,
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
if ($retval != 0) { if ($retval != 0) {
if ($retval < 0) { if ($retval < 0) {
...@@ -590,7 +594,7 @@ function Do_DeleteDataset() ...@@ -590,7 +594,7 @@ function Do_DeleteDataset()
else { else {
$webtask = WebTask::CreateAnonymous(); $webtask = WebTask::CreateAnonymous();
$command = $dataset->deleteCommand($webtask); $command = $dataset->deleteCommand($webtask);
$retval = SUEXEC($this_uid, $dataset->pid(), $command, $retval = SUEXEC($this_uid, $project, $command,
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
if ($retval) { if ($retval) {
$webtask->Refresh(); $webtask->Refresh();
...@@ -644,7 +648,7 @@ function Do_ApproveDataset() ...@@ -644,7 +648,7 @@ function Do_ApproveDataset()
return; return;
} }
if ($dataset->islocal()) { if ($dataset->islocal()) {
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $dataset->Project(),
"webapprovelease " . "webapprovelease " .
$dataset->pid() . "/" . $dataset->pid() . "/" .
$dataset->gid() . "/" . $dataset->lease_id(), $dataset->gid() . "/" . $dataset->lease_id(),
...@@ -662,7 +666,7 @@ function Do_ApproveDataset() ...@@ -662,7 +666,7 @@ function Do_ApproveDataset()
else { else {
$webtask = WebTask::CreateAnonymous(); $webtask = WebTask::CreateAnonymous();
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $dataset->Project(),
"webmanage_dataset -t ". $webtask->task_id() . "webmanage_dataset -t ". $webtask->task_id() .
" approve " . $dataset->pid() . "/" . $dataset->id(), " approve " . $dataset->pid() . "/" . $dataset->id(),
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
...@@ -712,7 +716,7 @@ function Do_RefreshDataset() ...@@ -712,7 +716,7 @@ function Do_RefreshDataset()
# #
$webtask = WebTask::CreateAnonymous(); $webtask = WebTask::CreateAnonymous();
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $dataset->Project(),
"webmanage_dataset -t ". $webtask->task_id() . "webmanage_dataset -t ". $webtask->task_id() .
" refresh " . $dataset->pid() . "/" . $dataset->id(), " refresh " . $dataset->pid() . "/" . $dataset->id(),
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
...@@ -772,7 +776,7 @@ function Do_ExtendDataset() ...@@ -772,7 +776,7 @@ function Do_ExtendDataset()
$command = "webextendlease "; $command = "webextendlease ";
$command .= $dataset->pid() . "/" . $dataset->id(); $command .= $dataset->pid() . "/" . $dataset->id();
$retval = SUEXEC($this_uid, $dataset->pid(), $command, $retval = SUEXEC($this_uid, $dataset->Project(), $command,
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
if ($retval != 0) { if ($retval != 0) {
if ($retval < 0) { if ($retval < 0) {
...@@ -789,7 +793,7 @@ function Do_ExtendDataset() ...@@ -789,7 +793,7 @@ function Do_ExtendDataset()
} }
else { else {
$webtask = WebTask::CreateAnonymous(); $webtask = WebTask::CreateAnonymous();
$retval = SUEXEC($this_uid, $dataset->pid(), $retval = SUEXEC($this_uid, $dataset->Project(),
"webmanage_dataset -t ". $webtask->task_id() . "webmanage_dataset -t ". $webtask->task_id() .
" extend ". $dataset->pid() . "/" . $dataset->id(), " extend ". $dataset->pid() . "/" . $dataset->id(),
SUEXEC_ACTION_IGNORE); SUEXEC_ACTION_IGNORE);
......
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