Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
ea5680c9
Commit
ea5680c9
authored
Nov 03, 2000
by
Leigh B. Stoller
Browse files
Database changes: Get rid of group table and make it the project table.
Also change grp_memb to proj_memb.
parent
72ec2795
Changes
9
Hide whitespace changes
Inline
Side-by-side
www/approval.php3
View file @
ea5680c9
...
...
@@ -28,24 +28,23 @@ they will be able to log into machines in your Project's experiments.</p>
more or less access to your nodes:
<ul>
<li>User - Can log into machines in your experiments.
<li>Local Root - Granted root access on your project's machines; can create new experiments.
"
;
#echo "<li>Group Root - Can approve users, create projects, and update any project info or personal info for project members.";
echo
"</ul>
</p></h3>
\n
"
;
$query
=
"SELECT gid FROM grp_memb WHERE uid='
$auth_usr
' and trust='group_root'"
;
<li>Root - Granted root access on your project's machines;
can create new experiments.
</ul></p></h3>
\n
"
;
$query
=
"SELECT pid FROM proj_memb WHERE uid='
$auth_usr
' and trust='group_root'"
;
$result
=
mysql_db_query
(
"tbdb"
,
$query
);
$select
=
"SELECT"
;
while
(
$row
=
mysql_fetch_row
(
$result
))
{
$
g
id
=
$row
[
0
];
$
p
id
=
$row
[
0
];
if
(
$select
==
"SELECT"
)
{
$select
.
=
" DISTINCT uid FROM
grp
_memb WHERE
g
id='
$
g
id
'"
;
$select
.
=
" DISTINCT uid FROM
proj
_memb WHERE
p
id='
$
p
id
'"
;
}
else
{
$select
.
=
" OR
g
id='
$
g
id
'"
;
$select
.
=
" OR
p
id='
$
p
id
'"
;
}
}
if
(
$select
==
"SELECT"
)
{
echo
"<h3>You do not have
G
ro
up
Root permissions in any
g
ro
up.
</h3>"
;
echo
"<h3>You do not have
P
ro
ject
Root permissions in any
P
ro
ject
</h3>"
;
echo
"</body></html>
\n
"
;
exit
;
}
...
...
@@ -102,8 +101,7 @@ if ( mysql_num_rows($found) == 0 ) {
<option value='later'>Postpone</option></select></td>
<td rowspan=2><select name=
\"
$uid
-trust
\"
>
<option value='user'>User</option>
<option value='local_root'>Local Root</option>"
;
#echo "<option value='group_root'>Group Root</option>";
<option value='local_root'>Root</option>"
;
echo
"</select></td>
<td rowspan=2>
$uid
</td><td>
$name
</td><td>
$title
</td><td>
$affil
</td><td>
$email
</td><td>
$phone
</td></tr>
<tr><td>
$addr
</td><td>
$addr2
</td><td> city </td><td>
$state
</td><td>
$zip
</td>
...
...
www/approved.php3
View file @
ea5680c9
...
...
@@ -23,19 +23,19 @@ LOGGEDINORDIE($auth_usr);
echo
"
<h1>Approving new users...</h1>
"
;
$query
=
"SELECT
g
id FROM
grp
_memb WHERE uid='
$auth_usr
' and trust='group_root'"
;
$query
=
"SELECT
p
id FROM
proj
_memb WHERE uid='
$auth_usr
' and trust='group_root'"
;
$result
=
mysql_db_query
(
"tbdb"
,
$query
);
$select
=
"SELECT"
;
$
g
ro
up
[
0
]
=
""
;
$
p
ro
ject
[
0
]
=
""
;
$n
=
0
;
while
(
$row
=
mysql_fetch_row
(
$result
))
{
$
g
id
=
$row
[
0
];
$
g
ro
up
[
$n
]
=
$
g
id
;
$
p
id
=
$row
[
0
];
$
p
ro
ject
[
$n
]
=
$
p
id
;
$n
=
$n
+
1
;
if
(
$select
==
"SELECT"
)
{
$select
.
=
" DISTINCT uid FROM
grp
_memb WHERE
g
id='
$
g
id
'"
;
$select
.
=
" DISTINCT uid FROM
proj
_memb WHERE
p
id='
$
p
id
'"
;
}
else
{
$select
.
=
" OR
g
id='
$
g
id
'"
;
$select
.
=
" OR
p
id='
$
p
id
'"
;
}
}
$selected
=
mysql_db_query
(
"tbdb"
,
$select
);
...
...
@@ -54,14 +54,14 @@ while ($row = mysql_fetch_row($found)) {
$uid
=
$row
[
0
];
$status
=
$row
[
1
];
$email
=
$row
[
2
];
$cmd
=
"select
g
id from
grp
_memb where uid='
$uid
' and trust='none' and ("
;
$cmd
.
=
"
g
id='
$
g
ro
up
[0]
'"
;
$cmd
=
"select
p
id from
proj
_memb where uid='
$uid
' and trust='none' and ("
;
$cmd
.
=
"
p
id='
$
p
ro
ject
[0]
'"
;
$n
=
1
;
while
(
isset
(
$
g
ro
up
[
$n
])
)
{
$cmd
.
=
" or
g
id='
$
g
ro
up
[$n]
'"
;
$n
++
;
}
while
(
isset
(
$
p
ro
ject
[
$n
])
)
{
$cmd
.
=
" or
p
id='
$
p
ro
ject
[$n]
'"
;
$n
++
;
}
$cmd
.
=
")"
;
$result
=
mysql_db_query
(
"tbdb"
,
$cmd
);
$row
=
mysql_fetch_row
(
$result
);
$
g
id
=
$row
[
0
];
$
p
id
=
$row
[
0
];
if
(
isset
(
$$uid
))
{
if
(
$$uid
==
"approve"
)
{
$trust
=
$
{
"
$uid
-trust"
};
...
...
@@ -73,43 +73,39 @@ while ($row = mysql_fetch_row($found)) {
$cmd
=
"update users set status='
$newstatus
' where uid='
$uid
'"
;
$cmd
.
=
"and status='
$status
'"
;
$result
=
mysql_db_query
(
"tbdb"
,
$cmd
);
$cmd
=
"update grp_memb set trust='
$trust
' where uid='
$uid
'"
;
$cmd
.
=
"and trust='none' and gid='
$gid
'"
;
$result
=
mysql_db_query
(
"tbdb"
,
$cmd
);
#
# Bogus grp vs proj issue.
#
$cmd
=
"insert into proj_memb (uid, pid) values ('
$uid
', '
$gid
')"
;
$cmd
=
"update proj_memb set trust='
$trust
' where uid='
$uid
'"
;
$cmd
.
=
"and trust='none' and pid='
$pid
'"
;
$result
=
mysql_db_query
(
"tbdb"
,
$cmd
);
mail
(
"
$email
"
,
"TESTBED:
G
ro
u
p Approval"
,
mail
(
"
$email
"
,
"TESTBED:
P
ro
ject Membershi
p Approval"
,
"
\n
This message is to notify you that you have been approved "
.
"as a member of
\n
the
$
g
id
g
ro
up
with
$trust
permissions.
\n
"
.
"as a member of
\n
the
$
p
id
p
ro
ject
with
$trust
permissions.
\n
"
.
"
\n
Your status as a Testbed user is now
$newstatus
."
.
"
\n\n
Thanks,
\n
Testbed Ops
\n
Utah Network Testbed
\n
"
,
"From: Testbed Ops <testbed-ops@flux.cs.utah.edu>
\n
"
.
"Cc: Testbed WWW <testbed-www@flux.cs.utah.edu>
\n
"
.
"Errors-To: Testbed WWW <testbed-www@flux.cs.utah.edu>"
);
echo
"<h3><p>User
$uid
was changed to status
$newstatus
and "
;
echo
"granted
$trust
permissions for
g
ro
up
$
g
id
.</p></h3>
\n
"
;
echo
"granted
$trust
permissions for
p
ro
ject
$
p
id
.</p></h3>
\n
"
;
}
elseif
(
$$uid
==
"deny"
)
{
# Delete all rows from
grp
memb that are for that person, no privs
# and one of the
g
ro
up
s that the user is a leader of
$cmd
=
"delete from
grp
_memb where uid='
$uid
' and trust='none' and ("
;
$cmd
.
=
"
g
id='
$
g
ro
up
[0]
'"
;
# Delete all rows from
proj_
memb that are for that person, no privs
# and one of the
p
ro
ject
s that the user is a leader of
$cmd
=
"delete from
proj
_memb where uid='
$uid
' and trust='none' and ("
;
$cmd
.
=
"
p
id='
$
p
ro
ject
[0]
'"
;
$n
=
1
;
while
(
isset
(
$
g
ro
up
[
$n
])
)
{
$cmd
.
=
" or
g
id='
$
g
ro
up
[$n]
'"
;
$n
++
;
}
while
(
isset
(
$
p
ro
ject
[
$n
])
)
{
$cmd
.
=
" or
p
id='
$
p
ro
ject
[$n]
'"
;
$n
++
;
}
$cmd
.
=
")"
;
$result
=
mysql_db_query
(
"tbdb"
,
$cmd
);
mail
(
"
$email
"
,
"TESTBED:
G
ro
up
Membership Denied"
,
mail
(
"
$email
"
,
"TESTBED:
P
ro
ject
Membership Denied"
,
"
\n
This message is to notify you that you have been denied "
.
"as a member of
\n
the
$
g
id
g
ro
up.
\n
"
.
"as a member of
\n
the
$
p
id
p
ro
ject
\n
"
.
"
\n
Your status as a Testbed user is still
$status
."
.
"
\n\n
Thanks,
\n
Testbed Ops
\n
Utah Network Testbed
\n
"
,
"From: Testbed Ops <testbed-ops@flux.cs.utah.edu>
\n
"
.
"Cc: Testbed WWW <testbed-www@flux.cs.utah.edu>
\n
"
.
"Errors-To: Testbed WWW <testbed-www@flux.cs.utah.edu>"
);
echo
"<h3><p>User
$uid
was denied membership in your group.</p></h3>
\n
"
;
echo
"<h3><p>User
$uid
was denied membership in your project.</p>
</h3>
\n
"
;
}
else
{
echo
"<h3><p>User
$uid
was postponed for later decision.</p></h3>
\n
"
;
}
...
...
www/beginexp_form.php3
View file @
ea5680c9
...
...
@@ -23,13 +23,13 @@ LOGGEDINORDIE($uid);
# See what projects the uid is a member of. Must be at least one!
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT
g
id FROM
grp
_memb WHERE uid=
\"
$uid
\"
"
);
"SELECT
p
id FROM
proj
_memb WHERE uid=
\"
$uid
\"
"
);
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 an Projects!"
,
1
);
USERERROR
(
"You do not appear to be a member of an
y
Projects!"
,
1
);
}
?>
...
...
@@ -66,7 +66,7 @@ echo "<tr>
<td>*Select Project:</td>"
;
echo
" <td><select name=
\"
exp_pid
\"
>"
;
while
(
$row
=
mysql_fetch_array
(
$query_result
))
{
$project
=
$row
[
g
id
];
$project
=
$row
[
p
id
];
echo
"<option value=
\"
$project
\"
>
$project
</option>
\n
"
;
}
echo
" </select>"
;
...
...
www/beginexp_process.php3
View file @
ea5680c9
...
...
@@ -86,11 +86,8 @@ if ($row = mysql_fetch_row($query_result)) {
# Next, is this person a member of the project specified, and is the trust
# equal to group or local root?
#
# XXX Split across grp_memb and proj_memb. grp_memb needs to be flushed, but
# right now that has all the info we need.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM
grp
_memb WHERE
g
id=
\"
$exp_pid
\"
and uid=
\"
$uid
\"
"
);
"SELECT * FROM
proj
_memb WHERE
p
id=
\"
$exp_pid
\"
and uid=
\"
$uid
\"
"
);
if
((
$row
=
mysql_fetch_array
(
$query_result
))
==
0
)
{
USERERROR
(
"You are not a member of Project
$exp_pid
, so you cannot begin "
.
"an experiment in that project."
,
1
);
...
...
www/endexp_form.php3
View file @
ea5680c9
...
...
@@ -23,12 +23,9 @@ LOGGEDINORDIE($uid);
# Show a menu of all experiments for all projects that this uid
# is a member of.
#
# XXX Split across grp_memb and proj_memb. grp_memb needs to be flushed, but
# right now that has all the info we need.
#
$groupmemb_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM grp_memb WHERE uid=
\"
$uid
\"
"
);
if
(
mysql_num_rows
(
$groupmemb_result
)
==
0
)
{
$projmemb_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM proj_memb WHERE uid=
\"
$uid
\"
"
);
if
(
mysql_num_rows
(
$projmemb_result
)
==
0
)
{
USERERROR
(
"You are not a member of any Projects, so you cannot "
.
"show any experiment information"
,
1
);
}
...
...
@@ -38,8 +35,8 @@ if (mysql_num_rows($groupmemb_result) == 0) {
# presenting a bogus option list.
#
$experiments
=
""
;
while
(
$
grp
row
=
mysql_fetch_array
(
$
g
ro
up
memb_result
))
{
$pid
=
$
grp
row
[
g
id
];
while
(
$
proj
row
=
mysql_fetch_array
(
$
p
ro
j
memb_result
))
{
$pid
=
$
proj
row
[
p
id
];
$exp_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT eid FROM experiments WHERE pid=
\"
$pid
\"
"
);
while
(
$exprow
=
mysql_fetch_array
(
$exp_result
))
{
...
...
www/index.php3
View file @
ea5680c9
...
...
@@ -83,7 +83,7 @@ if (isset($uid)) {
$status
=
$row
[
0
];
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT trust FROM
grp
_memb WHERE uid='
$uid
'"
);
"SELECT trust FROM
proj
_memb WHERE uid='
$uid
'"
);
$row
=
mysql_fetch_row
(
$query_result
);
$trust
=
$row
[
0
];
...
...
@@ -127,11 +127,11 @@ if (isset($uid)) {
# Standard options for anyone.
#
if
(
isset
(
$uid
))
{
echo
"<p><A href=
\"
addgrp
.php3?
$uid
\"
>Start a Project</A>
\n
"
;
echo
"<p><A href=
\"
newproject_form
.php3?
$uid
\"
>Start a Project</A>
\n
"
;
echo
"<p><A href=
\"
addusr.php3?
$uid
\"
>Join a Project</A>
\n
"
;
}
else
{
echo
"<p><A href=
\"
addgrp
.php3
\"
>Start a Project</A>
\n
"
;
echo
"<p><A href=
\"
newproject_form
.php3
\"
>Start a Project</A>
\n
"
;
echo
"<p><A href=
\"
addusr.php3
\"
>Join a Project</A>
\n
"
;
}
echo
"<hr>"
;
...
...
www/showexp.php3
View file @
ea5680c9
...
...
@@ -162,7 +162,7 @@ if (mysql_num_rows($reserved_result)) {
# Lets dump the project information too.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM
g
ro
up
s WHERE
g
id=
\"
$exp_pid
\"
"
);
"SELECT * FROM
p
ro
ject
s WHERE
p
id=
\"
$exp_pid
\"
"
);
if
(
!
$query_result
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error getting info for project
$exp_pid
:
$err
\n
"
,
1
);
...
...
@@ -174,42 +174,41 @@ echo "<center>
</center>
<table align=center border=1>
\n
"
;
$gid
=
$row
[
gid
];
$grp_created
=
$row
[
grp_created
];
$grp_expires
=
$row
[
grp_expires
];
$grp_name
=
$row
[
grp_name
];
$grp_URL
=
$row
[
grp_URL
];
$grp_affil
=
$row
[
grp_affil
];
$grp_addr
=
$row
[
grp_addr
];
$grp_head_uid
=
$row
[
grp_head_uid
];
$cntrl_node
=
$row
[
cntrl_node
];
$proj_created
=
$row
[
created
];
$proj_expires
=
$row
[
expires
];
$proj_name
=
$row
[
name
];
$proj_URL
=
$row
[
URL
];
$proj_affil
=
$row
[
affil
];
$proj_addr
=
$row
[
addr
];
$proj_head_uid
=
$row
[
head_uid
];
$control_node
=
$row
[
control_node
];
#
# Generate the table.
#
echo
"<tr>
<td>Name: </td>
<td class=
\"
left
\"
>
$
g
id
</td>
<td class=
\"
left
\"
>
$
exp_p
id
</td>
</tr>
\n
"
;
echo
"<tr>
<td>Long Name: </td>
<td class=
\"
left
\"
>
$
grp
_name
</td>
<td class=
\"
left
\"
>
$
proj
_name
</td>
</tr>
\n
"
;
echo
"<tr>
<td>Project Head: </td>
<td class=
\"
left
\"
>
$
grp
_head_uid
</td>
<td class=
\"
left
\"
>
$
proj
_head_uid
</td>
</tr>
\n
"
;
echo
"<tr>
<td>Created: </td>
<td class=
\"
left
\"
>
$
grp
_created
</td>
<td class=
\"
left
\"
>
$
proj
_created
</td>
</tr>
\n
"
;
echo
"<tr>
<td>Expires: </td>
<td class=
\"
left
\"
>
$
grp
_expires
</td>
<td class=
\"
left
\"
>
$
proj
_expires
</td>
</tr>
\n
"
;
echo
"</table>
\n
"
;
...
...
www/showexp_form.php3
View file @
ea5680c9
...
...
@@ -23,12 +23,9 @@ LOGGEDINORDIE($uid);
# Show a menu of all experiments for all projects that this uid
# is a member of.
#
# XXX Split across grp_memb and proj_memb. grp_memb needs to be flushed, but
# right now that has all the info we need.
#
$groupmemb_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM grp_memb WHERE uid=
\"
$uid
\"
"
);
if
(
mysql_num_rows
(
$groupmemb_result
)
==
0
)
{
$projmemb_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM proj_memb WHERE uid=
\"
$uid
\"
"
);
if
(
mysql_num_rows
(
$projmemb_result
)
==
0
)
{
USERERROR
(
"You are not a member of any Projects, so you cannot "
.
"show any experiment information"
,
1
);
}
...
...
@@ -38,8 +35,8 @@ if (mysql_num_rows($groupmemb_result) == 0) {
# presenting a bogus option list.
#
$experiments
=
""
;
while
(
$
grp
row
=
mysql_fetch_array
(
$
g
ro
up
memb_result
))
{
$pid
=
$
grp
row
[
g
id
];
while
(
$
proj
row
=
mysql_fetch_array
(
$
p
ro
j
memb_result
))
{
$pid
=
$
proj
row
[
p
id
];
$exp_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT eid FROM experiments WHERE pid=
\"
$pid
\"
"
);
while
(
$exprow
=
mysql_fetch_array
(
$exp_result
))
{
...
...
www/usradded.php3
View file @
ea5680c9
...
...
@@ -193,7 +193,7 @@ if (! $returning) {
# Don't try to join twice!
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"select * from
grp
_memb where uid='
$uid
' and
g
id='
$pid
'"
);
"select * from
proj
_memb where uid='
$uid
' and
p
id='
$pid
'"
);
if
(
mysql_num_rows
(
$query_result
)
>
0
)
{
die
(
"<h3><br><br>"
.
"You have already applied for membership in project:
$pid
."
.
...
...
@@ -205,10 +205,12 @@ if (mysql_num_rows($query_result) > 0) {
# to upgrade the trust level, making the new user real.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"insert into grp_memb (uid,gid,trust) values ('
$uid
','
$pid
','none');"
);
"insert into proj_memb (uid,pid,trust) "
.
"values ('
$uid
','
$pid
','none');"
);
if
(
!
$query_result
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error adding adding user
$uid
to group
$pid
:
$err
\n
"
,
1
);
TBERROR
(
"Database Error adding adding user
$uid
to "
.
"project
$pid
:
$err
\n
"
,
1
);
}
#
...
...
@@ -216,23 +218,24 @@ if (! $query_result) {
# email message out of the database, of course.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT
grp_
head_uid FROM
g
ro
up
s WHERE
g
id='
$pid
'"
);
"SELECT head_uid FROM
p
ro
ject
s WHERE
p
id='
$pid
'"
);
if
((
$row
=
mysql_fetch_row
(
$query_result
))
==
0
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error getting project leader for group
$pid
:
$err
\n
"
,
1
);
TBERROR
(
"Database Error getting project leader for project
$pid
:
$err
\n
"
,
1
);
}
$
g
ro
up
_leader_uid
=
$row
[
0
];
$
p
ro
ject
_leader_uid
=
$row
[
0
];
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT usr_email FROM users WHERE uid='
$
g
ro
up
_leader_uid
'"
);
"SELECT usr_email FROM users WHERE uid='
$
p
ro
ject
_leader_uid
'"
);
if
((
$row
=
mysql_fetch_row
(
$query_result
))
==
0
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error getting email address for
g
ro
up
leader "
.
"
$
g
ro
up
_leader_uid
:
$err
\n
"
,
1
);
TBERROR
(
"Database Error getting email address for
p
ro
ject
leader "
.
"
$
p
ro
ject
_leader_uid
:
$err
\n
"
,
1
);
}
$
g
ro
up
_leader_email
=
$row
[
0
];
$
p
ro
ject
_leader_email
=
$row
[
0
];
mail
(
"
$
g
ro
up
_leader_email
"
,
mail
(
"
$
p
ro
ject
_leader_email
"
,
"TESTBED: New Project Member"
,
"
\n
$usr_name
(
$uid
) is trying to join your project (
$pid
).
\n
"
.
"
$usr_name
has the
\n
"
.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment