--- rat/lonpageflip.pm 2021/04/29 17:45:25 1.103 +++ rat/lonpageflip.pm 2021/06/07 19:04:20 1.104 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.103 2021/04/29 17:45:25 raeburn Exp $ +# $Id: lonpageflip.pm,v 1.104 2021/06/07 19:04:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -99,7 +99,7 @@ sub hash_src { } sub move { - my ($next,$endupmap,$direction) = @_; + my ($next,$endupmap,$direction,$firstres) = @_; my $safecount=0; my $allowed=0; my $deeplinkonly=0; @@ -116,7 +116,7 @@ sub move { $allowed = 0; } else { my $priv = &Apache::lonnet::allowed('bre',$url,$symb); - $allowed = (($priv eq 'F') || ($priv eq '2')); + $allowed = (($priv eq 'F') || ($priv eq '2') || ($priv eq 'A')); } $deeplinkonly = 0; if ($hash{'deeplinkonly_'.$next}) { @@ -128,7 +128,7 @@ sub move { $deeplinkonly = 1; } } - } elsif ($hash{'deeplinkonly_'.$prev}) { + } elsif (($hash{'deeplinkonly_'.$prev}) && (!$firstres)) { my ($value,$level) = split(/:/,$hash{'deeplinkonly_'.$prev}); if ($level eq 'resource') { $deeplinkonly = 1; @@ -262,9 +262,11 @@ sub first_accessible_resource { my ($name,$value) = split(/=/,$pair); $args{&unescape($name)} = &unescape($value); } - if (!&Apache::lonnet::allowed('bre',$url,$args{'symb'})) { + my $priv = &Apache::lonnet::allowed('bre',$url,$args{'symb'}); + my $allowed = (($priv eq 'F') || ($priv eq '2') || ($priv eq 'A')); + if (!$allowed) { # Wow, we cannot see this ... move forward to the next one that we can see - my ($newrid,$newmap)=&move($hash{'first_rid'},$hash{'first_mapurl'},'forward'); + my ($newrid,$newmap)=&move($hash{'first_rid'},$hash{'first_mapurl'},'forward',1); # Build the new URL my ($newmapid,$newresid)=split(/\./,$newrid); my $symb=&Apache::lonnet::encode_symb($newmap,$newresid,$hash{'src_'.$newrid});