From: zacheiss Date: Sun, 19 May 2002 21:53:38 +0000 (+0000) Subject: A DCM for new calendar service, and Makefile.in glue to install it. X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/87be6d2199261b720e26d90802dffb7366155420 A DCM for new calendar service, and Makefile.in glue to install it. --- diff --git a/gen/Makefile.in b/gen/Makefile.in index 446703ec..40a9b020 100644 --- a/gen/Makefile.in +++ b/gen/Makefile.in @@ -42,7 +42,7 @@ TARGET= acl.gen boot.gen dhcp.gen directory.gen hesiod.gen hosts.gen \ mailhub.gen ndb.gen network.gen nfs.gen pobox.gen \ postoffice.gen print.gen warehouse.gen winad.gen www.gen zephyr.gen -SCRIPTS=boot.sh ca.gen dhcp.sh hesiod.sh ip-billing.gen ip-billing.sh \ +SCRIPTS=boot.sh ca.gen calendar.gen dhcp.sh hesiod.sh ip-billing.gen ip-billing.sh \ longjobs.gen longjobs.sh mailhub.sh ndb.sh nfs.sh null.sh \ postoffice.sh print.sh sapprint.gen sapprint.sh spwatch.gen \ stellar.gen stellar.sh warehouse.sh www.sh zephyr.sh \ diff --git a/gen/calendar.gen b/gen/calendar.gen new file mode 100755 index 00000000..4025564f --- /dev/null +++ b/gen/calendar.gen @@ -0,0 +1,36 @@ +#!/moira/bin/perl -Tw + +# $Id$ + +# The following exit codes are defined and MUST BE CONSISTENT withh the +# error codes the library uses: +$MR_DBMS_ERR = 47836421; +$MR_OCONFIG = 47836460; + +$outfile = '/moira/dcm/calendar.out'; + +use DBI; + +$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira") + || exit $MR_DBMS_ERR; + +$sth = $dbh->prepare("SELECT UNIQUE u.clearid, u.login, u.first, u.middle, " . + "u.last FROM users u, list l, imembers i " . + "WHERE l.name = 'calendar-acl' " . + "AND l.list_id = i.list_id AND l.list_id = i.list_id " . + "AND i.member_type='USER' AND i.member_id = u.users_id") + || exit $MR_DBMS_ERR; +$sth->execute || exit $MR_DBMS_ERR; + +umask 022; +open(OUT, ">$outfile") || exit $MR_OCONFIG; + +while (($clearid, $login, $first, $middle, $last) = $sth->fetchrow_array) { + $row = "$clearid^UID=$login/S=$last/G=$first/I=$middle/"; + $row .= "EMAIL=$login\@mit.edu\n"; + $row =~ s/\0//g; + print OUT $row; +} +close(OUT); +$dbh->disconnect; +exit 0;