Annotation of loncom/debugging_tools/make_user_cc.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 $course = shift; # The account to make $user a course coordinator on
! 10: my $coursedom = shift;
! 11: my $days = shift; # The number of days to have the role last
! 12:
! 13: if (! defined($user)) {
! 14: die "usage: make_user_cc.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 = $course\n";
! 22: print "targetdom = $coursedom\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: my $histfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist";
! 29:
! 30: tie (%roles,'GDBM_File',$dbfile,&GDBM_WRCREAT(),0640);
! 31: $roles{'/'.$coursedom.'/'.$course.'_cc'}='cc';
! 32:
! 33: open OUT, ">".$histfile;
! 34: foreach (keys(%roles)) {
! 35: print OUT $_.' : '.$roles{$_}."\n";
! 36: }
! 37: close OUT;
! 38:
! 39: untie %roles;
! 40:
! 41: system ("chown www:www $histfile");
! 42: system ("chown www:www $dbfile");
! 43:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>