--- loncom/auth/switchserver.pm 2024/10/09 15:49:17 1.35.2.6.2.8 +++ loncom/auth/switchserver.pm 2024/07/02 19:42:06 1.35.2.7 @@ -1,7 +1,7 @@ # The LearningOnline Network # Switch Servers Handler # -# $Id: switchserver.pm,v 1.35.2.6.2.8 2024/10/09 15:49:17 raeburn Exp $ +# $Id: switchserver.pm,v 1.35.2.7 2024/07/02 19:42:06 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,8 +31,6 @@ package Apache::switchserver; use strict; use Apache::Constants qw(:common :remotehost); use Apache::lonnet; -use Apache::loncommon; -use Apache::lonmenu; use Digest::MD5 qw(md5_hex); use CGI::Cookie(); use Apache::lonlocal; @@ -56,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) { @@ -64,11 +62,8 @@ sub do_redirect { } my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef, - {'redirect' => [$delay,$url,'',$write_to_opener,1], - 'only_body' => $only_body, - 'switchserver' => 1, - 'links_disabled' => 1, - 'no_inline_link' => 1,}); + {'redirect' => [$delay,$url,'',1], + 'only_body' => $only_body,}); 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')) { @@ -102,12 +97,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'}) { @@ -247,10 +242,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)"; } @@ -276,8 +267,6 @@ sub handler { } # -------------------------------------------------------- Menu script and info - my $windowinfo = &Apache::lonmenu::close(); - # ---------------------------------------------------------------- Get handover my ($is_balancer,$setcookie,$newcookieid,$otherbalcookie); @@ -315,18 +304,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}"))) { @@ -345,66 +327,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, $windowinfo.$ssologoutscript, - $env{'form.lcssowin'}); + return &do_redirect($r, $url, $only_body, $ssologoutscript); } 1;