--- loncom/interface/loncommon.pm 2007/12/23 16:55:25 1.629 +++ loncom/interface/loncommon.pm 2008/01/01 20:27:29 1.630 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.629 2007/12/23 16:55:25 raeburn Exp $ +# $Id: loncommon.pm,v 1.630 2008/01/01 20:27:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5851,6 +5851,8 @@ previous, future, or all. 6. reference to results object (hash of hashes). 7. reference to optional userdata hash 8. reference to optional statushash +9. flag if privileged users (except those set to unhide in + course settings) should be excluded Keys of top level results hash are roles. Keys of inner hashes are username:domain, with values set to access type. @@ -5867,7 +5869,7 @@ of the possibility of multiple values fo ############################################### sub get_course_users { - my ($cdom,$cnum,$types,$roles,$sections,$users,$userdata,$statushash) = @_; + my ($cdom,$cnum,$types,$roles,$sections,$users,$userdata,$statushash,$hidepriv) = @_; my %idx = (); my %seclists; @@ -5943,6 +5945,17 @@ sub get_course_users { active => 'Active', future => 'Future', ); + my %nothide; + if ($hidepriv) { + my %coursehash=&Apache::lonnet::coursedescription($cdom.'_'.$cnum); + foreach my $user (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) { + if ($user !~ /:/) { + $nothide{join(':',split(/[\@]/,$user))}=1; + } else { + $nothide{$user} = 1; + } + } + } foreach my $person (sort(keys(%coursepersonnel))) { my $match = 0; my $secmatch = 0; @@ -5976,6 +5989,12 @@ sub get_course_users { $usec = 'none'; } if ($uname ne '' && $udom ne '') { + if ($hidepriv) { + if ((&Apache::lonnet::privileged($uname,$udom)) && + (!$nothide{$uname.':'.$udom})) { + next; + } + } if ($end > 0 && $end < $now) { $status = 'previous'; } elsif ($start > $now) { @@ -7756,7 +7775,7 @@ sub build_recipient_list { sub commit_customrole { my ($udom,$uname,$url,$three,$four,$five,$start,$end) = @_; - my $output = &mt('Assigning custom role').' "'.$five.'" by '.$four.'@'.$three.' in '.$url. + my $output = &mt('Assigning custom role').' "'.$five.'" by '.$four.':'.$three.' in '.$url. ($start?', '.&mt('starting').' '.localtime($start):''). ($end?', ending '.localtime($end):'').': '. &Apache::lonnet::assigncustomrole( @@ -8116,7 +8135,7 @@ sub construct_course { } if ($args->{'notify_dc'}) { if ($uname ne '') { - push(@notified,$uname.'@'.$udom); + push(@notified,$uname.':'.$udom); } } if (@notified > 0) {