--- loncom/automation/Autocreate.pl 2010/08/28 19:00:42 1.15 +++ loncom/automation/Autocreate.pl 2010/09/26 02:29:55 1.16 @@ -2,7 +2,7 @@ # # Automated Course Creation script # -# $Id: Autocreate.pl,v 1.15 2010/08/28 19:00:42 raeburn Exp $ +# $Id: Autocreate.pl,v 1.16 2010/09/26 02:29:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -219,21 +219,12 @@ sub process_xml { sub check_activedc { my ($dcdom,$dcname,$defdom) = @_; - my %dumphash= - &Apache::lonnet::dump('roles',$dcdom,$dcname); - my $now=time; - my $activedc = 0; - 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; - } + my %roleshash = + &Apache::lonnet::get_my_roles($dcname,$dcdom,'userroles',undef,['dc'],[$defdom]); + if (keys(%roleshash) > 0) { + return 1; } - return $activedc; + return 0; } sub set_permissions {