]> andersk Git - moira.git/blobdiff - regtape/grouper.pl
Athena is a dirty word.
[moira.git] / regtape / grouper.pl
index a60cc45e9afa45342f071a774d09c1252de31214..097b91e814306bcae61616698fa3ffd995475748 100755 (executable)
@@ -5,6 +5,7 @@ die "Usage: $0 password\n" unless ($#ARGV == 0);
 $whpassword = $ARGV[0];
 $db = "";
 $mrtest = "mrtest";
+$logfile = "/moira/grouper.log";
 $ENV{'PATH'} = "/moira/bin";
 use DBI;
 
@@ -47,25 +48,30 @@ while (($user, $mitid) = $sth->fetchrow_array) {
 ($root_id) = $moira->selectrow_array("SELECT users_id FROM users ".
                                   "WHERE login = 'root'");
 
-open(MRTEST, "|$mrtest");
+open(MRTEST, "|$mrtest >/dev/null 2>&1");
 print MRTEST "connect $db\n";
 print MRTEST "auth\n";
+open(LOG, ">>$logfile");
 
 # Create any lists that don't already exist in Moira
 foreach $class (@$classes) {
      $base = "\L$term-$class";
      $staff = "$base-staff";
 
-     # check_list(name, owner, export, parent, desc)
-
-     &check_list($base, "registrar", 1, "",
-               "Automatically-created class participants list for $class");
-     &check_list("$base-reg", "registrar", 0, $base,
-               "Automatically-generated registered students list for $class");
-     &check_list($staff, $staff, 0, $base,
-               "Automatically-created teaching staff list for $class");
-     &check_list("$base-others", $staff, 0, $base,
-               "Automatically-created non-registered students and miscellaneous people list for $class");
+     # check_list(name, owner, export, desc)
+     &check_list($staff, $staff, 0, 
+                "Teaching staff list for $class");
+     &check_list("$base-reg", $staff, 0,
+                "*** DO NOT MODIFY *** Automatically-created registered students list for $class");
+     &check_list("$base-others", $staff, 0,
+                "Non-registered students and miscellaneous people list for $class");
+     &check_list($base, $staff, 1,
+                "*** DO NOT MODIFY *** Automatically-created participants list for $class");
+     if (!$lists{$base}) {
+        &add_member($staff, LIST, $base);
+        &add_member("$base-reg", LIST, $base);
+        &add_member("$base-others", LIST, $base);
+     }
 }
 
 # Now fill in -reg lists
@@ -94,7 +100,7 @@ foreach $class (@$classes) {
        $login = $users{$mitid};
        next if !$login;
        if (!$mstudents{$login}) {
-           print "Adding $login to $clist\n";
+           print LOG "Adding $login to $clist\n";
            &add_member($login, USER, $clist);
            $changed = 1;
        } else {
@@ -105,7 +111,7 @@ foreach $class (@$classes) {
     # Everyone in wstudents will have been removed from mstudents
     # now, so delete the remaining users since they don't belong
     foreach $login (keys(%mstudents)) {
-       print "Deleting $login from $clist\n";
+       print LOG "Deleting $login from $clist\n";
        &del_member($login, USER, $clist);
        $changed = 1;
     }
@@ -119,19 +125,17 @@ foreach $class (@$classes) {
 
 print MRTEST "quit\n";
 close(MRTEST);
+close(LOG);
 $moira->disconnect;
 $warehouse->disconnect;
 
 exit 0;
 
 sub check_list {
-    my ( $name, $owner, $export, $parent, $desc ) = @_;
+    my ( $name, $owner, $export, $desc ) = @_;
     if (!$lists{$name}) {
-       print "Creating $name\n";
-       print MRTEST "qy alis $name 1 0 1 $export $export \"create unique GID\" 0 LIST $owner \"$desc\"\n";
-        if ($parent) {
-           &add_member($name, LIST, $parent);
-       }
+       print LOG "Creating $name\n";
+       print MRTEST "qy alis $name 0 0 1 $export $export \"create unique GID\" 0 0 [NONE] LIST $owner NONE NONE \"$desc\"\n";
     }
 }
 
This page took 0.046665 seconds and 4 git commands to generate.