Revision 24319,
1.1 KB
checked in by broder, 15 years ago
(diff) |
New Moira snapshot from SVN.
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/moira/bin/perl -Tw |
---|
2 | |
---|
3 | # $Id: calendar.gen 3956 2010-01-05 20:56:56Z zacheiss $ |
---|
4 | |
---|
5 | # The following exit codes are defined and MUST BE CONSISTENT withh the |
---|
6 | # error codes the library uses: |
---|
7 | $MR_DBMS_ERR = 47836421; |
---|
8 | $MR_OCONFIG = 47836460; |
---|
9 | |
---|
10 | $outfile = '/moira/dcm/calendar.out'; |
---|
11 | |
---|
12 | use DBI; |
---|
13 | |
---|
14 | $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira") |
---|
15 | || exit $MR_DBMS_ERR; |
---|
16 | |
---|
17 | $sth = $dbh->prepare("SELECT UNIQUE u.clearid, u.login, u.first, u.middle, " . |
---|
18 | "u.last FROM users u, list l, imembers i " . |
---|
19 | "WHERE l.name = 'calendar-acl' " . |
---|
20 | "AND l.list_id = i.list_id AND l.list_id = i.list_id " . |
---|
21 | "AND i.member_type='USER' AND i.member_id = u.users_id") |
---|
22 | || exit $MR_DBMS_ERR; |
---|
23 | $sth->execute || exit $MR_DBMS_ERR; |
---|
24 | |
---|
25 | umask 022; |
---|
26 | open(OUT, ">$outfile") || exit $MR_OCONFIG; |
---|
27 | |
---|
28 | while (($clearid, $login, $first, $middle, $last) = $sth->fetchrow_array) { |
---|
29 | $row = "$clearid|$login^UID=$login/S=$last/G=$first/I=$middle/"; |
---|
30 | $row .= "OU1=/JOB-TITLE=/PHONE=/LOC=/EMAIL=$login\@mit.edu\n"; |
---|
31 | $row =~ s/\0//g; |
---|
32 | print OUT $row; |
---|
33 | } |
---|
34 | close(OUT); |
---|
35 | $dbh->disconnect; |
---|
36 | exit 0; |
---|
Note: See
TracBrowser
for help on using the repository browser.