[1960] in Moira
Re: calendar.gen
daemon@ATHENA.MIT.EDU (Mark Silis)
Thu May 16 00:08:15 2002
Date: Thu, 16 May 2002 00:08:13 -0400
From: Mark Silis <mark@MIT.EDU>
To: Jonathon Weiss <jweiss@MIT.EDU>
Cc: Mark Silis <mark@MIT.EDU>, moiradev@MIT.EDU
Message-ID: <20020516040813.GA24226@I-fear-reorgs.MIT.EDU>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200205152328.TAA17976@vorpal-blade.mit.edu>
Ok this discussion has shown to me that taking phone and department
information from moira isn't the right approach. I'll get that data
from a different location, and just obtain some basic information that
can't be modified by the users with things like chfn from moira.
Jonathon, yes I want the clearid, I am using it for a join against
another set of data. Garry, I'd like to keep the hard coded list option
for now, as the limitation probably won't be necessary long term. Here
is a simplified version.
-- Mark
--- /dev/null Thu May 16 00:00:00 2002
+++ calendar.gen Thu May 16 00:00:19 2002
@@ -0,0 +1,35 @@
+#!/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 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;
+exit 0;
On Wed, May 15, 2002 at 07:28:39PM -0400, Jonathon Weiss wrote:
> > +$sth = $dbh->prepare("SELECT u.clearid, u.login, u.first, u.middle, u.last, " .
> > + "u.office_phone, u.department 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;
>
> Did you mean to use clearid (MIT id number) here, or should this have
> been unix_uid? Is there a reason the calendar server would care what
> someone's MIT id number is?
>
> Jonathon
>
>