version 1.13, 2010/03/30 15:24:52
|
version 1.17, 2011/03/06 21:17:23
|
Line 110
|
Line 110
|
close($fh); |
close($fh); |
exit; |
exit; |
} |
} |
|
$env{'user.name'} = $dcname; |
|
$env{'user.domain'} = $dcdom; |
|
$env{'request.role.domain'} = $defdom; |
|
my @permissions = ('mau','ccc','cin','cta','cep','ccr','cst'); |
|
my %permissionflags = (); |
|
&set_permissions(\%permissionflags,\@permissions); |
my $output = &process_xml($fh,$defdom,$dcname,$dcdom); |
my $output = &process_xml($fh,$defdom,$dcname,$dcdom); |
print $output; |
print $output; |
|
&unset_permissions(\%permissionflags); |
} |
} |
} else { |
} else { |
my @permissions = ('mau','ccc','cin','cta','cep','ccr','cst'); |
my @permissions = ('mau','ccc','cin','cta','cep','ccr','cst'); |
Line 128
|
Line 135
|
if ($settings->{'xml'}) { |
if ($settings->{'xml'}) { |
if ($settings->{'xmldc'}) { |
if ($settings->{'xmldc'}) { |
my ($dcname,$dcdom) = split(':',$settings->{'xmldc'}); |
my ($dcname,$dcdom) = split(':',$settings->{'xmldc'}); |
$env{'user.name'} = $dcname; |
|
$env{'user.domain'} = $dcdom; |
|
$env{'request.role.domain'} = $dom; |
|
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 142
|
Line 146
|
} |
} |
} |
} |
if ($settings->{'req'}) { |
if ($settings->{'req'}) { |
my $output = &Apache::process_official_reqs('auto',$dom); |
my $output = &Apache::loncoursequeueadmin::process_official_reqs('auto',$dom,$dcname,$dcdom); |
if ($output) { |
if ($output) { |
print $fh $output; |
print $fh $output; |
} |
} |
Line 212 sub process_xml {
|
Line 216 sub process_xml {
|
|
|
sub check_activedc { |
sub check_activedc { |
my ($dcdom,$dcname,$defdom) = @_; |
my ($dcdom,$dcname,$defdom) = @_; |
my %dumphash= |
my %roleshash = |
&Apache::lonnet::dump('roles',$dcdom,$dcname); |
&Apache::lonnet::get_my_roles($dcname,$dcdom,'userroles',undef,['dc'],[$defdom]); |
my $now=time; |
if (keys(%roleshash) > 0) { |
my $activedc = 0; |
return 1; |
foreach my $item (keys %dumphash) { |
|
my ($domain,$role) = ($item =~ m-^/([^/]+)/[^_]*_(\w+)$-); |
|
if ($role eq 'dc' && $domain eq $defdom) { |
|
my ($trole,$tend,$tstart)=split(/_/,$dumphash{$item}); |
|
if (($tend) && ($tend<$now)) { next; } |
|
if (($tstart) && ($now<$tstart)) { next; } |
|
$activedc = 1; |
|
last; |
|
} |
|
} |
} |
return $activedc; |
return 0; |
} |
} |
|
|
sub set_permissions { |
sub set_permissions { |