--- loncom/lonnet/perl/lonnet.pm 2023/12/28 15:57:28 1.1521 +++ loncom/lonnet/perl/lonnet.pm 2024/02/24 23:41:44 1.1523 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1521 2023/12/28 15:57:28 raeburn Exp $ +# $Id: lonnet.pm,v 1.1523 2024/02/24 23:41:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2975,6 +2975,17 @@ sub get_domain_defaults { $domdefaults{'ltiprivhosts'} = $domconfig{'ltisec'}{'private'}{'keys'}; } } + if (ref($domconfig{'ltisec'}{'suggested'}) eq 'HASH') { + my %suggestions = %{$domconfig{'ltisec'}{'suggested'}}; + foreach my $item (keys(%{$domconfig{'ltisec'}{'suggested'}})) { + unless (ref($domconfig{'ltisec'}{'suggested'}{$item}) eq 'HASH') { + delete($suggestions{$item}); + } + } + if (keys(%suggestions)) { + $domdefaults{'linkprotsuggested'} = \%suggestions; + } + } } if (ref($domconfig{'toolsec'}) eq 'HASH') { if (ref($domconfig{'toolsec'}{'encrypt'}) eq 'HASH') { @@ -8004,7 +8015,7 @@ sub get_portfolio_access { $portaccess = &usertools_access($unum,$udom,'portaccess',undef,'tools'); } - my ($public,$guest,@domains,@users,@courses,@groups,@ips); + my ($public,$guest,@domains,@users,@courses,@groups,@ips,@userips); my $now = time; if (ref($access_hash) eq 'HASH') { foreach my $key (keys(%{$access_hash})) { @@ -8031,6 +8042,8 @@ sub get_portfolio_access { push(@groups,$key); } elsif ($scope eq 'ip') { push(@ips,$key); + } elsif ($scope eq 'userip') { + push(@userips,$key); } } if ($public) { @@ -8045,6 +8058,19 @@ sub get_portfolio_access { } } } + if ($allowed) { + return 'ok'; + } + } elsif (@userips > 0) { + my $allowed; + foreach my $useripkey (@userips) { + if (ref($access_hash->{$useripkey}{'ip'}) eq 'ARRAY') { + if (&Apache::loncommon::check_ip_acc(join(',',@{$access_hash->{$useripkey}{'ip'}}),$clientip)) { + $allowed = 1; + last; + } + } + } if ($allowed) { return 'ok'; }