version 1.17, 2011/03/06 21:17:23
|
version 1.19, 2011/03/07 02:10:40
|
Line 110
|
Line 110
|
close($fh); |
close($fh); |
exit; |
exit; |
} |
} |
$env{'user.name'} = $dcname; |
&set_dc_env($dcname,$dcdom,$defdom); |
$env{'user.domain'} = $dcdom; |
|
$env{'request.role.domain'} = $defdom; |
|
my @permissions = ('mau','ccc','cin','cta','cep','ccr','cst'); |
my @permissions = ('mau','ccc','cin','cta','cep','ccr','cst'); |
my %permissionflags = (); |
my %permissionflags = (); |
&set_permissions(\%permissionflags,\@permissions); |
&set_permissions(\%permissionflags,\@permissions); |
my $output = &process_xml($fh,$defdom,$dcname,$dcdom); |
my $output = &process_xml($fh,$defdom,$dcname,$dcdom); |
print $output; |
|
&unset_permissions(\%permissionflags); |
&unset_permissions(\%permissionflags); |
|
&unset_dc_env(); |
|
print $output; |
} |
} |
} else { |
} else { |
my @permissions = ('mau','ccc','cin','cta','cep','ccr','cst'); |
my @permissions = ('mau','ccc','cin','cta','cep','ccr','cst'); |
Line 132
|
Line 131
|
my $settings; |
my $settings; |
if (ref($domconfig{'autocreate'}) eq 'HASH') { |
if (ref($domconfig{'autocreate'}) eq 'HASH') { |
$settings = $domconfig{'autocreate'}; |
$settings = $domconfig{'autocreate'}; |
|
my ($dcname,$dcdom); |
|
if ($settings->{'xmldc'}) { |
|
($dcname,$dcdom) = split(':',$settings->{'xmldc'}); |
|
} |
if ($settings->{'xml'}) { |
if ($settings->{'xml'}) { |
if ($settings->{'xmldc'}) { |
if ($settings->{'xmldc'}) { |
my ($dcname,$dcdom) = split(':',$settings->{'xmldc'}); |
|
if (!&check_activedc($dcdom,$dcname,$dom)) { |
if (!&check_activedc($dcdom,$dcname,$dom)) { |
print $fh "Autocreate.pl in domain $dom configured to run under the auspices of a user without an active domain coordinator role in the domain - course creation will be skipped.\n\n"; |
print $fh "Autocreate.pl in domain $dom configured to run under the auspices of a user without an active domain coordinator role in the domain - course creation will be skipped.\n\n"; |
next; |
next; |
Line 146
|
Line 148
|
} |
} |
} |
} |
if ($settings->{'req'}) { |
if ($settings->{'req'}) { |
|
&set_dc_env($dcname,$dcdom); |
my $output = &Apache::loncoursequeueadmin::process_official_reqs('auto',$dom,$dcname,$dcdom); |
my $output = &Apache::loncoursequeueadmin::process_official_reqs('auto',$dom,$dcname,$dcdom); |
|
&unset_dc_env(); |
if ($output) { |
if ($output) { |
print $fh $output; |
print $fh $output; |
} |
} |
Line 161
|
Line 165
|
|
|
sub process_xml { |
sub process_xml { |
my ($fh,$dom,$dcname,$dcdom) = @_; |
my ($fh,$dom,$dcname,$dcdom) = @_; |
$env{'user.name'} = $dcname; |
&set_dc_env($dcname.$dcdom,$dom); |
$env{'user.domain'} = $dcdom; |
|
$env{'request.role.domain'} = $dom; |
|
|
|
# Initialize language handler |
# Initialize language handler |
&Apache::lonlocal::get_language_handle(); |
&Apache::lonlocal::get_language_handle(); |
|
|
Line 208 sub process_xml {
|
Line 209 sub process_xml {
|
$output .= $newcourse.':'; |
$output .= $newcourse.':'; |
} |
} |
$output =~ s/:$//; |
$output =~ s/:$//; |
delete($env{'user.name'}); |
&unset_dc_env(); |
delete($env{'user.domain'}); |
|
delete($env{'request.role.domain'}); |
|
return $output; |
return $output; |
} |
} |
|
|
Line 240 sub unset_permissions {
|
Line 239 sub unset_permissions {
|
delete($env{"allowed.$allowtype"}); |
delete($env{"allowed.$allowtype"}); |
} |
} |
} |
} |
|
|
|
sub set_dc_env { |
|
my ($dcname,$dcdom,$defdom) = @_; |
|
$env{'user.name'} = $dcname; |
|
$env{'user.domain'} = $dcdom; |
|
$env{'user.home'} = &Apache::lonnet::homeserver($dcname,$dcdom); |
|
if ($defdom ne '') { |
|
$env{'request.role.domain'} = $defdom; |
|
} |
|
return; |
|
} |
|
|
|
sub unset_dc_env { |
|
delete($env{'user.name'}); |
|
delete($env{'user.domain'}); |
|
delete($env{'user.home'}); |
|
if ($env{'request.role.domain'}) { |
|
delete($env{'request.role.domain'}); |
|
} |
|
return; |
|
} |