--- loncom/auth/lonroles.pm 2021/11/28 19:18:00 1.357 +++ loncom/auth/lonroles.pm 2022/02/24 13:08:59 1.360 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.357 2021/11/28 19:18:00 raeburn Exp $ +# $Id: lonroles.pm,v 1.360 2022/02/24 13:08:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -195,6 +195,7 @@ $msg var url = "$js_url"; \$(location).attr('href',url); }); +// ]]> $link $end_page @@ -277,7 +278,8 @@ sub handler { $update = $then; } - my ($norolelist,$blocked_by_ip,$blocked_type,$blocked_ipaddr); + my ($norolelist,$blocked_by_ip,$blocked_type,$clientip); + $clientip = &Apache::lonnet::get_requestor_ip($r); if (($env{'request.course.id'}) && ($env{'request.deeplink.login'})) { my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; @@ -355,16 +357,15 @@ sub handler { unless (defined($cached)) { my %domconfig = &Apache::lonnet::get_dom('configuration',['ipaccess'],$cdom); - $ipaccessref = &do_cache_new('ipaccess',$cdom,$domconfig{'ipaccess'},1800); + $ipaccessref = &Apache::lonnet::do_cache_new('ipaccess',$cdom,$domconfig{'ipaccess'},1800); } if (ref($ipaccessref) eq 'HASH') { - my $remote_ip = &Apache::lonnet::get_requestor_ip(); foreach my $id (keys(%{$ipaccessref})) { if (ref($ipaccessref->{$id}) eq 'HASH') { my $range = $ipaccessref->{$id}->{'ip'}; if ($range) { my $type = 'exclude'; - if (&Apache::lonnet::ip_match($remote_ip,$range)) { + if (&Apache::lonnet::ip_match($clientip,$range)) { $type = 'include'; } if (ref($ipaccessref->{$id}->{'courses'}) eq 'HASH') { @@ -386,9 +387,6 @@ sub handler { } } } - unless ($showrole) { - $blocked_ipaddr = $remote_ip; - } } } } @@ -783,7 +781,7 @@ ENDCLOSE $r->rflush(); my ($msg,$blockcrit,$critmsg_check); $critmsg_check = 1; - $blockcrit = &Apache::loncommon::blocking_status('alert',$cnum,$cdom,undef,1); + $blockcrit = &Apache::loncommon::blocking_status('alert',$clientip,$cnum,$cdom,undef,1); if ($blockcrit) { my $checkrole = "cm./$cdom/$cnum"; if ($csec ne '') { @@ -1354,7 +1352,7 @@ ENDHEADER } $r->print('