--- loncom/auth/switchserver.pm 2023/07/05 21:13:07 1.35.2.6.2.6 +++ loncom/auth/switchserver.pm 2024/10/08 02:46:19 1.35.2.8 @@ -1,7 +1,7 @@ # The LearningOnline Network # Switch Servers Handler # -# $Id: switchserver.pm,v 1.35.2.6.2.6 2023/07/05 21:13:07 raeburn Exp $ +# $Id: switchserver.pm,v 1.35.2.8 2024/10/08 02:46:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -54,7 +54,7 @@ sub init_env { } sub do_redirect { - my ($r,$url,$only_body,$extra_text,$write_to_opener) = @_; + my ($r,$url,$only_body,$extra_text) = @_; $r->send_http_header; my $delay = 0.5; if ($only_body && !$extra_text) { @@ -62,8 +62,11 @@ sub do_redirect { } my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef, - {'redirect' => [$delay,$url,'',$write_to_opener,1], - 'only_body' => $only_body,}); + {'redirect' => [$delay,$url,'',1], + 'only_body' => $only_body, + 'switchserver' => 1, + 'links_disabled' => 1, + 'no_inline_link' => 1,}); my $end_page = &Apache::loncommon::end_page(); $r->print($start_page.$extra_text.$end_page); unless ($env{'user.name'} eq 'public' && ($env{'user.domain'} eq 'public')) { @@ -97,12 +100,12 @@ sub flush_course_logs { sub handler { my ($r) = @_; - + my $handle=&init_env($r); if (!defined($handle)) { return FORBIDDEN; } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['otherserver','role','origurl','symb','lcssowin','edit']); + ['otherserver','role','origurl','symb','edit']); my $switch_to=&Apache::lonnet::hostname($env{'form.otherserver'}); if (! $env{'form.otherserver'}) { @@ -242,10 +245,6 @@ sub handler { my $logmsg = "Switch Server to $env{'form.otherserver'}"; if ($env{'form.role'}) { $logmsg .= " with role: $env{'form.role'}"; - } elsif (($env{'form.lti.reqcrs'}) && ($env{'form.lti.reqrole'} eq 'cc')) { - $logmsg .= " to create new LTI course"; - } elsif ($env{'form.lti.selfenrollrole'}) { - $logmsg .= " to selfenroll with role: $env{'form.lti.selfenrollrole'}"; } else { $logmsg .= " (no role)"; } @@ -308,18 +307,11 @@ sub handler { } if ($env{'form.origurl'}) { $info{'origurl'} = $env{'form.origurl'}; - if ($env{'form.origurl'} eq '/adm/email') { - if ($env{'request.display'} && ($env{'request.mailrecip'} eq "$env{'user.name'}:$env{'user.domain'}")) { - $info{'display'} = &escape($env{'request.display'}); - $info{'mailrecip'} = &escape($env{'request.mailrecip'}); - } - } } if ($env{'form.symb'}) { $info{'symb'} = $env{'form.symb'}; } - my $ssologoutscript = ''; - my $write_to_opener; + my $ssologoutscript = ''; if ($env{'request.sso.login'}) { $info{'sso.login'} = $env{'request.sso.login'}; if (defined($r->dir_config("lonSSOUserLogoutScriptFile_$info{domain}"))) { @@ -338,65 +330,13 @@ sub handler { if ($env{'request.sso.reloginserver'}) { $info{'sso.reloginserver'} = $env{'request.sso.reloginserver'}; } - if ($env{'request.linkprot'}) { - $info{'linkprot'} = $env{'request.linkprot'}; - foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') { - if ($env{'request.'.$item}) { - $info{$item} = $env{'request.'.$item}; - } - } - } elsif ($env{'request.linkkey'} ne '') { - $info{'linkkey'} = $env{'request.linkkey'}; - } - if ($env{'request.deeplink.login'}) { - $info{'deeplink.login'} = $env{'request.deeplink.login'}; - } - if ($env{'request.lti.login'}) { - $info{'lti.login'} = $env{'request.lti.login'}; - } - if ($env{'request.lti.uri'}) { - $info{'lti.uri'} = $env{'request.lti.uri'}; - } - if ($env{'request.lti.reqcrs'}) { - $info{'lti.reqcrs'} = $env{'request.lti.reqcrs'}; - } - if ($env{'request.lti.reqrole'}) { - $info{'lti.reqrole'} = $env{'request.lti.reqrole'}; - } - if ($env{'request.lti.selfenrollrole'}) { - $info{'lti.selfenrollrole'} = $env{'request.lti.selfenrollrole'}; - } - if ($env{'request.lti.sourcecrs'}) { - $info{'lti.sourcecrs'} = $env{'request.lti.sourcecrs'}; - } - if ($env{'request.lti.passbackid'}) { - $info{'lti.passbackid'} = $env{'request.lti.passbackid'}; - } - if ($env{'request.lti.passbackurl'}) { - $info{'lti.passbackurl'} = $env{'request.lti.passbackurl'}; - } - if ($env{'request.lti.rosterid'}) { - $info{'lti.rosterid'} = $env{'request.lti.rosterid'}; - } - if ($env{'request.lti.rosterurl'}) { - $info{'lti.rosterurl'} = $env{'request.lti.rosterurl'}; - } - if ($env{'request.lti.target'}) { - $info{'lti.target'} = $env{'request.lti.target'}; - } my $token = &Apache::lonnet::tmpput(\%info,$env{'form.otherserver'}); - my @args = ("domain=$env{'user.domain'}", - "username=$env{'user.name'}", - "token=$token"); - my $url = $protocol.'://'.$switch_to.'/adm/login?'; - if ($env{'form.lcssowin'}) { - $url .= join('&',@args); - $only_body = 1; - } else { - $url .= join('&',@args); - } + my $url =$protocol.'://'.$switch_to.'/adm/login?'. + 'domain='.$env{'user.domain'}. + '&username='.$env{'user.name'}. + '&token='.$token; # --------------------------------------------------------------- Screen Output - return &do_redirect($r, $url, $only_body, $ssologoutscript, $env{'form.lcssowin'}); + return &do_redirect($r, $url, $only_body, $ssologoutscript); } 1;