Annotation of loncom/debugging_tools/make_user_ca.pl, revision 1.1

1.1     ! matthew     1: #!/usr/bin/perl -w
        !             2: #
        !             3: use strict;
        !             4: use GDBM_File;
        !             5: my %roles;
        !             6: 
        !             7: my $user      = shift;
        !             8: my $userdom   = shift;
        !             9: my $target    = shift; # The account to make $user a co-author on
        !            10: my $targetdom = shift;
        !            11: my $days      = shift; # The number of days to have the role last
        !            12: 
        !            13: if (! defined($user)) {
        !            14:     die "usage: make_user_ca.pl user userdom course coursedom daysuntilexpire";
        !            15: }
        !            16: 
        !            17: my $endtime = time + 24*60*60*$days;
        !            18: 
        !            19: print "user      = $user\n";
        !            20: print "userdom   = $userdom\n";
        !            21: print "target    = $target\n";
        !            22: print "targetdom = $targetdom\n";
        !            23: print "days      = $days\n";
        !            24: print "endtime   = $endtime\n";
        !            25: 
        !            26: my ($a,$b,$c,undef) = split(//,$user,4);
        !            27: my $dbfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.db";
        !            28: 
        !            29: print "dbfile = $dbfile\n";
        !            30: 
        !            31: tie (%roles,'GDBM_File',$dbfile,
        !            32: 	&GDBM_WRCREAT(),0640);
        !            33: $roles{'/'.$targetdom.'/'.$target.'_ca'}='ca_'.$endtime.'_'.time;
        !            34: open OUT, ">/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist";
        !            35: foreach (keys(%roles)) {
        !            36:     print OUT $_.' : '.$roles{$_}."\n";
        !            37: }
        !            38: close OUT;
        !            39: 
        !            40: untie %roles;
        !            41: `chown www:www /home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist`;
        !            42: `chown www:www /home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.db`;
        !            43: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>