version 1.37, 2022/06/18 02:10:19
|
version 1.41, 2023/05/24 14:55:57
|
Line 146 sub handler {
|
Line 146 sub handler {
|
my ($itemid,$ltitype,%crslti,%lti_in_use,$ltiuser); |
my ($itemid,$ltitype,%crslti,%lti_in_use,$ltiuser); |
$itemid = &get_lti_itemid($requri,$hostname,$params,$cdom,$cnum,'linkprot'); |
$itemid = &get_lti_itemid($requri,$hostname,$params,$cdom,$cnum,'linkprot'); |
if ($itemid) { |
if ($itemid) { |
%crslti = &Apache::lonnet::get_course_lti($cnum,$cdom); |
%crslti = &Apache::lonnet::get_course_lti($cnum,$cdom,'provider'); |
} |
} |
if (($itemid) && (ref($crslti{$itemid}) eq 'HASH')) { |
if (($itemid) && (ref($crslti{$itemid}) eq 'HASH')) { |
$ltitype = 'c'; |
$ltitype = 'c'; |
Line 175 sub handler {
|
Line 175 sub handler {
|
} |
} |
} |
} |
} |
} |
|
my $exiturl; |
|
if (($itemid) && ($lti_in_use{'returnurl'} ne '')) { |
|
if (exists($params->{$lti_in_use{'returnurl'}})) { |
|
$exiturl = $params->{$lti_in_use{'returnurl'}}; |
|
} elsif (exists($params->{'custom_'.$lti_in_use{'returnurl'}})) { |
|
$exiturl = $params->{'custom_'.$lti_in_use{'returnurl'}}; |
|
} |
|
} |
if (($itemid) && ($lti_in_use{'requser'})) { |
if (($itemid) && ($lti_in_use{'requser'})) { |
my %courseinfo = &Apache::lonnet::coursedescription($cdom.'_'.$cnum); |
my %courseinfo = &Apache::lonnet::coursedescription($cdom.'_'.$cnum); |
my $ltiauth; |
my $ltiauth; |
Line 225 sub handler {
|
Line 233 sub handler {
|
foreach my $key (%{$params}) { |
foreach my $key (%{$params}) { |
delete($env{'form.'.$key}); |
delete($env{'form.'.$key}); |
} |
} |
&linkprot_session($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype,$tail,$lonhost); |
&linkprot_session($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype,$tail,$lonhost,$exiturl); |
return OK; |
return OK; |
} |
} |
} |
} |
Line 248 sub handler {
|
Line 256 sub handler {
|
if ($ltiuser ne '') { |
if ($ltiuser ne '') { |
$info{'linkprotuser'} = $ltiuser; |
$info{'linkprotuser'} = $ltiuser; |
} |
} |
|
if ($exiturl ne '') { |
|
$info{'linkprotexit'} = $exiturl; |
|
} |
my $ltoken = &Apache::lonnet::tmpput(\%info,$lonhost,'link'); |
my $ltoken = &Apache::lonnet::tmpput(\%info,$lonhost,'link'); |
if (($ltoken eq 'con_lost') || ($ltoken eq 'refused') || ($ltoken =~ /^error:/) || |
if (($ltoken eq 'con_lost') || ($ltoken eq 'refused') || ($ltoken =~ /^error:/) || |
($ltoken eq 'unknown_cmd') || ($ltoken eq 'no_such_host') || |
($ltoken eq 'unknown_cmd') || ($ltoken eq 'no_such_host') || |
Line 1061 sub lti_session {
|
Line 1072 sub lti_session {
|
} |
} |
|
|
sub linkprot_session { |
sub linkprot_session { |
my ($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype,$dest,$lonhost) = @_; |
my ($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype,$dest,$lonhost,$exiturl) = @_; |
$r->user($uname); |
$r->user($uname); |
if ($ltitype eq 'c') { |
if ($ltitype eq 'c') { |
&Apache::lonnet::logthis("Course Link Protector ($itemid) authorized student: $uname:$cdom, course: $cdom\_$cnum"); |
&Apache::lonnet::logthis("Course Link Protector ($itemid) authorized student: $uname:$cdom, course: $cdom\_$cnum"); |
Line 1074 sub linkprot_session {
|
Line 1085 sub linkprot_session {
|
&Apache::lonauth::success($r,$uname,$cdom,$uhome,'noredirect'); |
&Apache::lonauth::success($r,$uname,$cdom,$uhome,'noredirect'); |
$env{'form.origurl'} = $dest; |
$env{'form.origurl'} = $dest; |
$env{'request.linkprot'} = $itemid.$ltitype.':'.$dest; |
$env{'request.linkprot'} = $itemid.$ltitype.':'.$dest; |
|
$env{'request.linkprotuser'} = $uname.':'.$cdom; |
$env{'request.deeplink.login'} = $dest; |
$env{'request.deeplink.login'} = $dest; |
|
if ($exiturl ne '') { |
|
$env{'request.linkprotexit'} = $exiturl; |
|
} |
my $redirecturl = '/adm/switchserver'; |
my $redirecturl = '/adm/switchserver'; |
if ($otherserver ne '') { |
if ($otherserver ne '') { |
$redirecturl .= '?otherserver='.$otherserver; |
$redirecturl .= '?otherserver='.$otherserver; |
Line 1089 sub linkprot_session {
|
Line 1104 sub linkprot_session {
|
'username' => $uname, |
'username' => $uname, |
'server' => $lonhost, |
'server' => $lonhost, |
'linkprot' => $itemid.$ltitype.':'.$dest, |
'linkprot' => $itemid.$ltitype.':'.$dest, |
|
'linkprotuser' => $uname.':'.$cdom, |
'home' => $uhome, |
'home' => $uhome, |
'origurl' => $dest, |
'origurl' => $dest, |
'deeplink.login' => $dest, |
'deeplink.login' => $dest, |
); |
); |
|
if ($exiturl ne '') { |
|
$info{'linkprotexit'} = $exiturl; |
|
} |
my $token = &Apache::lonnet::tmpput(\%info,$lonhost); |
my $token = &Apache::lonnet::tmpput(\%info,$lonhost); |
$env{'form.token'} = $token; |
$env{'form.token'} = $token; |
$r->internal_redirect('/adm/migrateuser'); |
$r->internal_redirect('/adm/migrateuser'); |
Line 1107 sub check_balancer {
|
Line 1126 sub check_balancer {
|
($is_balancer,$otherserver) = |
($is_balancer,$otherserver) = |
&Apache::lonnet::check_loadbalancing($uname,$udom,'login'); |
&Apache::lonnet::check_loadbalancing($uname,$udom,'login'); |
if ($is_balancer) { |
if ($is_balancer) { |
|
# Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer) |
|
my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r); |
|
if (($found_server) && ($balancer_cookie =~ /^\Q$udom\E_\Q$uname\E_/)) { |
|
$otherserver = $found_server; |
|
} |
if ($otherserver eq '') { |
if ($otherserver eq '') { |
my $lowest_load; |
my $lowest_load; |
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($udom); |
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($udom); |