--- loncom/lonnet/perl/lonnet.pm 2022/05/26 02:07:36 1.1485 +++ loncom/lonnet/perl/lonnet.pm 2022/06/08 01:42:20 1.1486 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1485 2022/05/26 02:07:36 raeburn Exp $ +# $Id: lonnet.pm,v 1.1486 2022/06/08 01:42:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -8128,6 +8128,7 @@ sub check_can_request { my @options = ('approval','validate','autolimit'); my $optregex = join('|',@options); if ((ref($can_request) eq 'HASH') && (ref($types) eq 'ARRAY')) { + my %willtrust; foreach my $type (@{$types}) { if (&usertools_access($uname,$udom,$type,undef, 'requestcourses')) { @@ -8147,12 +8148,17 @@ sub check_can_request { if (ref($request_domains) eq 'HASH') { my ($otherdom) = ($item =~ /^($match_domain):($optregex)(=?\d*)$/); if ($otherdom ne '') { - if (ref($request_domains->{$type}) eq 'ARRAY') { - unless (grep(/^\Q$otherdom\E$/,@{$request_domains->{$type}})) { + unless (exists($willtrust{$otherdom})) { + $willtrust{$otherdom} = &will_trust('reqcrs',$env{'user.domain'},$otherdom); + } + if ($willtrust{$otherdom}) { + if (ref($request_domains->{$type}) eq 'ARRAY') { + unless (grep(/^\Q$otherdom\E$/,@{$request_domains->{$type}})) { + push(@{$request_domains->{$type}},$otherdom); + } + } else { push(@{$request_domains->{$type}},$otherdom); } - } else { - push(@{$request_domains->{$type}},$otherdom); } } }