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

Add per-group email lists as per payment by Eric.

parent 3175c488
......@@ -25,6 +25,7 @@ my $USERS = "@USERNODE@";
my $TBACTIVE = "@TBACTIVEARCHIVE@";
my $TBALL = "@TBUSERSARCHIVE@";
my $PROJROOT = "/proj";
my $GRPROOT = "/groups";
# Note no -n option. We redirect stdin from the new exports file below.
my $SSH = "$TB/bin/sshtb -l root -host $USERS";
......@@ -53,7 +54,7 @@ if ($EUID != 0) {
" Must be root! Maybe its a development version?\n");
}
# XXX Hacky!
if (1 && $TB ne "/usr/testbed") {
if (0 && $TB ne "/usr/testbed") {
die("*** $0:\n".
" Wrong version. Maybe its a development version?\n");
}
......@@ -211,31 +212,38 @@ if (defined($newuser) || defined($allprojects)) {
if (defined($newuser)) {
$proj_result =
DBQueryFatal("select pid from group_membership ".
"where uid='$newuser' and pid=gid");
DBQueryFatal("select pid,gid from group_membership ".
"where uid='$newuser'");
}
else {
$proj_result =
DBQueryFatal("select pid from projects");
DBQueryFatal("select pid,gid from groups");
}
while (($pid) = $proj_result->fetchrow_array) {
print "Getting project members for $pid\n" if $d;
while (my ($pid,$gid) = $proj_result->fetchrow_array) {
print "Getting project members for $pid/$gid\n" if $d;
my $query_result =
DBQueryFatal("SELECT distinct u.usr_email from ".
" group_membership as p ".
"left join users as u on u.uid=p.uid ".
"where p.pid='$pid' and p.pid=p.gid and ".
"where p.pid='$pid' and p.gid='$gid' and ".
" p.trust!='none' ".
"order by u.usr_email");
if ($query_result->numrows) {
my $archive = "$PROJROOT/$pid/$pid-users.mail";
my $archive;
if ($pid eq $gid) {
$archive = "$PROJROOT/$pid/$pid-users.mail";
}
else {
$archive = "$GRPROOT/$pid/$gid/$pid-$gid.mail";
}
#
# This would be nice, but will not work since the mailer daemon
# cannot access files in /proj/$pid.
# cannot access files in /proj/$pid or /groups/$pid
#
if (0 && ! -e $archive) {
open(ARCHIVE, ">>$archive") or
......@@ -245,7 +253,12 @@ if (defined($newuser) || defined($allprojects)) {
chmod(0666, "$archive") or
fatal("Could not chmod(666) $archive: $!");
}
genelist($query_result, undef, "$pid-users");
if ($pid eq $gid) {
genelist($query_result, undef, "$pid-users");
}
else {
genelist($query_result, undef, "$pid-$gid-users");
}
}
}
}
......
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