--- loncom/lonnet/perl/lonnet.pm 2023/12/28 15:57:28 1.1521 +++ loncom/lonnet/perl/lonnet.pm 2023/12/28 18:14:09 1.1522 @@ -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.1522 2023/12/28 18:14:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -8004,7 +8004,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 +8031,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 +8047,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'; }