Annotation of loncom/debugging_tools/make_user_cc.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 $course    = shift; # The account to make $user a course coordinator on
                     11: my $coursedom = shift;
                     12: my $days      = shift; # The number of days to have the role last
                     13: 
                     14: if (! defined($user)) {
                     15:     die "usage: make_user_cc.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    = $course\n";
                     23: print "targetdom = $coursedom\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: my $histfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist";
                     30: 
1.2     ! www        31: my $rolesref=&LONCAPA::locking_hash_tie($dbfile,&GDBM_WRCREAT());
        !            32: $$rolesref{'/'.$coursedom.'/'.$course.'_cc'}='cc';
        !            33: &LONCAPA::locking_hash_untie($rolesref);
1.1       matthew    34: 
                     35: system ("chown www:www $histfile");
                     36: system ("chown www:www $dbfile");
                     37: 

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