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

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

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