File:
[LON-CAPA] /
loncom /
debugging_tools /
make_user_cc.pl
Revision
1.1:
download - view:
text,
annotated -
select for diffs
Sun Sep 12 21:27:05 2004 UTC (20 years, 8 months ago) by
matthew
Branches:
MAIN
CVS tags:
version_2_1_X,
version_2_1_3,
version_2_1_2,
version_2_1_1,
version_2_1_0,
version_2_0_X,
version_2_0_99_1,
version_2_0_2,
version_2_0_1,
version_2_0_0,
version_1_99_3,
version_1_99_2,
version_1_99_1_tmcc,
version_1_99_1,
version_1_99_0_tmcc,
version_1_99_0,
version_1_3_X,
version_1_3_3,
version_1_3_2,
version_1_3_1,
version_1_3_0,
version_1_2_99_1,
version_1_2_99_0,
HEAD
Some debugging tools that have been sitting around for a while.
#!/usr/bin/perl -w
#
use strict;
use GDBM_File;
my %roles;
my $user = shift;
my $userdom = shift;
my $course = shift; # The account to make $user a course coordinator on
my $coursedom = shift;
my $days = shift; # The number of days to have the role last
if (! defined($user)) {
die "usage: make_user_cc.pl user userdom course coursedom daysuntilexpire";
}
my $endtime = time + 24*60*60*$days;
print "user = $user\n";
print "userdom = $userdom\n";
print "target = $course\n";
print "targetdom = $coursedom\n";
print "days = $days\n";
print "endtime = $endtime\n";
my ($a,$b,$c,undef) = split(//,$user,4);
my $dbfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.db";
my $histfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist";
tie (%roles,'GDBM_File',$dbfile,&GDBM_WRCREAT(),0640);
$roles{'/'.$coursedom.'/'.$course.'_cc'}='cc';
open OUT, ">".$histfile;
foreach (keys(%roles)) {
print OUT $_.' : '.$roles{$_}."\n";
}
close OUT;
untie %roles;
system ("chown www:www $histfile");
system ("chown www:www $dbfile");
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>