Commit b7c57734 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Address a number of issues raised by Mac in email regarding root vs

user/none trust and approved/unapproved.
Allow admin types to terminate any experiment.
Add trust/approval status in user list in project page.
parent f822e4cc
......@@ -16,13 +16,16 @@ LOGGEDINORDIE($uid);
# See what projects the uid is a member of. Must be at least one!
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT pid FROM proj_memb WHERE uid=\"$uid\"");
"SELECT pid FROM proj_memb WHERE uid=\"$uid\" ".
"and (trust='local_root' or trust='group_root')");
if (! $query_result) {
$err = mysql_error();
TBERROR("Database Error finding project membership: $uid: $err\n", 1);
}
if (mysql_num_rows($query_result) == 0) {
USERERROR("You do not appear to be a member of any Projects!", 1);
USERERROR("You do not appear to be a member of any Projects in which ".
"you have permission (root) to create new experiments.", 1);
}
?>
......
......@@ -12,13 +12,23 @@ PAGEHEADER("Terminate Experiment List");
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);
#
# Lets see if the user is even part of any experiements
#
$query_result = mysql_db_query($TBDBNAME,
if ($isadmin) {
$query_result = mysql_db_query($TBDBNAME,
"select pid,eid,expt_name from experiments ".
"order by pid,eid,expt_name");
}
else {
$query_result = mysql_db_query($TBDBNAME,
"select e.pid,eid,expt_name from experiments as e ".
"left join proj_memb as p on p.pid=e.pid where p.uid='$uid' ".
"left join proj_memb as p on p.pid=e.pid ".
"where p.uid='$uid' and (trust='local_root' or trust='group_root') ".
"order by e.pid,eid");
}
if (mysql_num_rows($query_result) == 0) {
USERERROR("There are no experiments running in any of the projects ".
......
......@@ -133,6 +133,7 @@ if (mysql_num_rows($reserved_result)) {
<tr>
<td align=center>Change</td>
<td align=center>Node ID</td>
<td align=center>Node Name</td>
<td align=center>Type</td>
<td align=center>Default<br>Image</td>
<td align=center>Default<br>Path</td>
......@@ -143,7 +144,7 @@ if (mysql_num_rows($reserved_result)) {
# I'm so proud!
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT nodes.* ".
"SELECT nodes.*,reserved.vname ".
"FROM nodes LEFT JOIN reserved ".
"ON nodes.node_id=reserved.node_id ".
"WHERE reserved.eid=\"$exp_eid\" and reserved.pid=\"$exp_pid\" ".
......@@ -151,6 +152,7 @@ if (mysql_num_rows($reserved_result)) {
while ($row = mysql_fetch_array($query_result)) {
$node_id = $row[node_id];
$vname = $row[vname];
$type = $row[type];
$def_boot_image_id = $row[def_boot_image_id];
$def_boot_path = $row[def_boot_path];
......@@ -166,12 +168,15 @@ if (mysql_num_rows($reserved_result)) {
$next_boot_path = "NULL";
if (!$next_boot_cmd_line)
$next_boot_cmd_line = "NULL";
if (!$vname)
$vname = "--";
echo "<tr>
<td align=center>
<A href='nodecontrol_form.php3?node_id=$node_id&refer=$exp_pideid'>
<img alt=\"o\" src=\"redball.gif\"></A></td>
<td>$node_id</td>
<td>$vname</td>
<td>$type</td>
<td>$def_boot_image_id</td>
<td>$def_boot_path</td>
......
......@@ -61,20 +61,51 @@ SHOWPROJECT($pid, $uid);
# A list of project members.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT uid FROM proj_memb WHERE pid=\"$pid\"");
"SELECT p.*,u.* FROM proj_memb as p ".
"left join users as u on u.uid=p.uid ".
"WHERE pid=\"$pid\"");
if (mysql_num_rows($query_result)) {
echo "<center>
<h3>Project Members</h3>
</center>
<table align=center border=1>\n";
while ($row = mysql_fetch_row($query_result)) {
$target_uid = $row[0];
echo "<tr><td>
<A href='showuser.php3?target_uid=$target_uid'>
$target_uid</A>
echo "<tr>
<td align=center>Name</td>
<td align=center>UID</td>
<td align=center>Privs</td>
<td align=center>Approved?</td>
</tr>\n";
while ($row = mysql_fetch_array($query_result)) {
$target_uid = $row[uid];
$usr_name = $row[usr_name];
$status = $row[status];
$trust = $row[trust];
if (strcmp($trust, "local_root") == 0 ||
strcmp($trust, "group_root") == 0) {
$trust = "root";
}
echo "<tr>
<td>$usr_name</td>
<td>
<A href='showuser.php3?target_uid=$target_uid'>
$target_uid</A>
</td>
</tr>\n";
<td>$trust</td>\n";
if (strcmp($status, "active") == 0 ||
strcmp($status, "unverified") == 0) {
echo "<td align=center>
<img alt=\"Y\" src=\"greenball.gif\"></td>\n";
}
else {
echo "<td align=center>
<img alt=\"N\" src=\"redball.gif\"></td>\n";
}
echo "</tr>\n";
}
echo "</table>\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