version 1.35.2.1, 2019/08/01 15:20:06
|
version 1.49, 2019/06/15 02:50:04
|
Line 128 sub handler {
|
Line 128 sub handler {
|
if ($env{'user.name'} eq 'public' |
if ($env{'user.name'} eq 'public' |
&& $env{'user.domain'} eq 'public') { |
&& $env{'user.domain'} eq 'public') { |
my $url = $protocol.'://'.$switch_to.$r->uri; |
my $url = $protocol.'://'.$switch_to.$r->uri; |
|
unlink($handle); |
|
#expire the cookie |
|
my $c = new CGI::Cookie(-name => 'lonPubID', |
|
-value => '', |
|
-expires => '-10y',); |
|
$r->header_out('Set-cookie' => $c); |
return &do_redirect($r,$url,1) |
return &do_redirect($r,$url,1) |
} |
} |
|
|
Line 145 sub handler {
|
Line 151 sub handler {
|
$skip_canhost_check = 1; |
$skip_canhost_check = 1; |
} |
} |
} elsif ($env{'form.role'} =~ m{^[ac]a\./($match_domain)/($match_username)$}) { |
} elsif ($env{'form.role'} =~ m{^[ac]a\./($match_domain)/($match_username)$}) { |
if (&Apache::lonnet::homeserver($2,$1) eq $env{'form.otherserver'}) { |
my ($audom,$auname) = ($1,$2); |
$skip_canhost_check = 1; |
if (&Apache::lonnet::homeserver($auname,$audom) eq $env{'form.otherserver'}) { |
|
if ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$audom)) && |
|
(&Apache::lonnet::will_trust('coaurem',$audom,$env{'user.domain'}))) { |
|
$skip_canhost_check = 1; |
|
} |
} |
} |
} |
} |
} |
} |
Line 178 sub handler {
|
Line 188 sub handler {
|
} |
} |
|
|
#remove session env, and log event |
#remove session env, and log event |
unlink($handle); |
if (unlink($handle)) { |
|
if ($env{'user.linkedenv'} ne '') { |
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
if (($env{'user.linkedenv'} =~ /^[a-f0-9]+_linked$/) && |
|
(-l "$lonidsdir/$env{'user.linkedenv'}.id") && |
|
(readlink("$lonidsdir/$env{'user.linkedenv'}.id") eq $handle)) { |
|
unlink("$lonidsdir/$env{'user.linkedenv'}.id"); |
|
} |
|
} |
|
} |
my %temp=('switchserver' => $now.':'.$env{'form.otherserver'}, |
my %temp=('switchserver' => $now.':'.$env{'form.otherserver'}, |
$env{'form.role'}); |
$env{'form.role'}); |
&Apache::lonnet::put('email_status',\%temp); |
&Apache::lonnet::put('email_status',\%temp); |
my $logmsg = "Switch Server to $env{'form.otherserver'}"; |
my $logmsg = "Switch Server to $env{'form.otherserver'}"; |
if ($env{'form.role'}) { |
if ($env{'form.role'}) { |
$logmsg .= " with role: $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 { |
} else { |
$logmsg .= " (no role)"; |
$logmsg .= " (no role)"; |
} |
} |
Line 194 sub handler {
|
Line 217 sub handler {
|
|
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
|
|
#expire the cookie |
#expire the cookies |
my $c = new CGI::Cookie(-name => 'lonID', |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
-value => '', |
foreach my $name (keys(%cookies)) { |
-expires => '-10y',); |
next unless ($name =~ /^lon(|S|Link|Pub)ID$/); |
$r->header_out('Set-cookie' => $c); |
my $c = new CGI::Cookie(-name => $name, |
|
-value => '', |
|
-expires => '-10y',); |
|
$r->headers_out->add('Set-cookie' => $c); |
|
} |
if ($r->header_only) { |
if ($r->header_only) { |
$r->send_http_header; |
$r->send_http_header; |
return OK; |
return OK; |
Line 210 sub handler {
|
Line 236 sub handler {
|
|
|
my $newcookieid; |
my $newcookieid; |
my $only_body = 0; |
my $only_body = 0; |
my ($is_balancer,$posshost,$setcookie) = |
my ($is_balancer,$posshost,$setcookie,$offloadto,$dom_balancers) = |
&Apache::lonnet::check_loadbalancing($env{'user.name'},$env{'user.domain'}); |
&Apache::lonnet::check_loadbalancing($env{'user.name'},$env{'user.domain'}); |
if ($is_balancer && $setcookie && $env{'form.otherserver'}) { |
if ($is_balancer && $setcookie && $env{'form.otherserver'}) { |
|
|
# Set a balancer cookie unless browser already sent LON-CAPA load balancer |
# Set a balancer cookie unless browser already sent LON-CAPA load balancer |
# cookie which points at the target server |
# cookie which points at the target server |
my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r,1); |
my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r,1); |
Line 226 sub handler {
|
Line 253 sub handler {
|
} |
} |
} |
} |
|
|
my %info=('ip' => $ENV{'REMOTE_ADDR'}, |
my %info=('ip' => $ENV{'REMOTE_ADDR'}, |
'domain' => $env{'user.domain'}, |
'domain' => $env{'user.domain'}, |
'username' => $env{'user.name'}, |
'username' => $env{'user.name'}, |
'role' => $env{'form.role'}, |
'home' => $env{'user.home'}, |
'server' => $r->dir_config('lonHostID'), |
'role' => $env{'form.role'}, |
'balancer' => $is_balancer); |
'server' => $r->dir_config('lonHostID'), |
|
'balancer' => $is_balancer, |
|
'dom_balancers' => $dom_balancers, |
|
'offloadto' => ''); |
|
if (ref($offloadto) eq 'HASH') { |
|
foreach my $key (keys(%{$offloadto})) { |
|
if (ref($offloadto->{$key}) eq 'ARRAY') { |
|
$info{'offloadto'} .= $key.'='.join(',',@{$offloadto->{$key}}).'&'; |
|
} |
|
} |
|
$info{'offloadto'} =~ s/\&$//; |
|
} elsif (ref($offloadto) eq 'ARRAY') { |
|
$info{'offloadto'} = join(',',@{$offloadto}); |
|
} |
if ($newcookieid) { |
if ($newcookieid) { |
$info{'balcookie'} = $newcookieid; |
$info{'balcookie'} = $newcookieid; |
} |
} |
Line 247 sub handler {
|
Line 287 sub handler {
|
if ($env{'request.sso.reloginserver'}) { |
if ($env{'request.sso.reloginserver'}) { |
$info{'sso.reloginserver'} = $env{'request.sso.reloginserver'}; |
$info{'sso.reloginserver'} = $env{'request.sso.reloginserver'}; |
} |
} |
|
if ($env{'request.linkprot'}) { |
|
$info{'linkprot'} = $env{'request.linkprot'}; |
|
} |
|
if ($env{'request.deeplink.login'}) { |
|
$info{'deeplink.login'} = $env{'request.deeplink.login'}; |
|
if ($env{'request.linkkey'}) { |
|
$info{'linkkey'} = $env{'request.linkkey'}; |
|
} |
|
} |
|
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 $token = &Apache::lonnet::tmpput(\%info,$env{'form.otherserver'}); |
my $url =$protocol.'://'.$switch_to.'/adm/login?'. |
my $url =$protocol.'://'.$switch_to.'/adm/login?'. |
'domain='.$env{'user.domain'}. |
'domain='.$env{'user.domain'}. |