--- loncom/auth/migrateuser.pm 2018/12/07 23:33:55 1.41 +++ loncom/auth/migrateuser.pm 2018/12/26 20:10:21 1.42 @@ -1,7 +1,7 @@ # The LearningOnline Network # Starts a user off based of an existing token. # -# $Id: migrateuser.pm,v 1.41 2018/12/07 23:33:55 raeburn Exp $ +# $Id: migrateuser.pm,v 1.42 2018/12/26 20:10:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -672,6 +672,29 @@ sub handler { if ($handle) { &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), $handle); + if ($data{'linkprot'} ne '') { + my ($linkprotector,$deeplink) = split(/:/,$data{'linkprot'},2); + if ($env{'user.linkprotector'}) { + my @protectors = split(/,/,$env{'user.linkprotector'}); + unless (grep(/^\Q$linkprotector\E$/,@protectors)) { + push(@protectors,$linkprotector); + @protectors = sort { $a <=> $b } @protectors; + &Apache::lonnet::appenv({'user.linkprotector' => join(',',@protectors)}); + } + } else { + &Apache::lonnet::appenv({'user.linkprotector' => $linkprotector }); + } + if ($env{'user.linkproturi'}) { + my @proturis = split(/,/,$env{'user.linkproturi'}); + unless(grep(/^\Q$deeplink\E$/,@proturis)) { + push(@proturis,$deeplink); + @proturis = sort @proturis; + &Apache::lonnet::appenv({'user.linkproturi' => join(',',@proturis)}); + } + } else { + &Apache::lonnet::appenv({'user.linkproturi' => $deeplink}); + } + } if ($data{'lti.login'}) { my $needslogout; if ($env{'request.lti.login'}) { @@ -765,6 +788,18 @@ sub handler { $desturl .= (($desturl =~/\?/)?'&':'?').'navmap=1'; } } + if ($data{'linkprot'}) { + my ($linkprotector,$linkuri) = split(/:/,$data{'linkprot'},2); + if ($linkprotector) { + if (ref($extra_env) eq 'HASH') { + $extra_env->{'user.linkprotector'} = $linkprotector; + $extra_env->{'user.linkproturi'} = $linkuri; + } else { + $extra_env = {'user.linkprotector' => $linkprotector, + 'user.linkproturi' => $linkuri,}; + } + } + } } my $skipcritical; if (($data{'lti.login'}) && ($data{'lti.reqcrs'}) &&