version 1.1, 2004/09/12 21:27:05
|
version 1.2, 2006/06/19 09:36:22
|
Line 2
|
Line 2
|
# |
# |
use strict; |
use strict; |
use GDBM_File; |
use GDBM_File; |
my %roles; |
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
my $user = shift; |
my $user = shift; |
my $userdom = shift; |
my $userdom = shift; |
Line 27 my ($a,$b,$c,undef) = split(//,$user,4);
|
Line 28 my ($a,$b,$c,undef) = split(//,$user,4);
|
my $dbfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.db"; |
my $dbfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.db"; |
my $histfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist"; |
my $histfile = "/home/httpd/lonUsers/$userdom/$a/$b/$c/$user/roles.hist"; |
|
|
tie (%roles,'GDBM_File',$dbfile,&GDBM_WRCREAT(),0640); |
my $rolesref=&LONCAPA::locking_hash_tie($dbfile,&GDBM_WRCREAT()); |
$roles{'/'.$coursedom.'/'.$course.'_cc'}='cc'; |
$$rolesref{'/'.$coursedom.'/'.$course.'_cc'}='cc'; |
|
&LONCAPA::locking_hash_untie($rolesref); |
open OUT, ">".$histfile; |
|
foreach (keys(%roles)) { |
|
print OUT $_.' : '.$roles{$_}."\n"; |
|
} |
|
close OUT; |
|
|
|
untie %roles; |
|
|
|
system ("chown www:www $histfile"); |
system ("chown www:www $histfile"); |
system ("chown www:www $dbfile"); |
system ("chown www:www $dbfile"); |