version 1.39, 2022/06/30 21:04:14
|
version 1.42, 2023/06/02 01:20:28
|
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 183 sub handler {
|
Line 183 sub handler {
|
$exiturl = $params->{'custom_'.$lti_in_use{'returnurl'}}; |
$exiturl = $params->{'custom_'.$lti_in_use{'returnurl'}}; |
} |
} |
} |
} |
|
my ($pbid,$pburl); |
|
if ($params->{'lis_result_sourcedid'}) { |
|
$pbid = $params->{'lis_result_sourcedid'}; |
|
} |
|
if ($params->{'lis_outcome_service_url'}) { |
|
$pburl = $params->{'lis_outcome_service_url'}; |
|
} |
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 233 sub handler {
|
Line 240 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,$exiturl); |
&linkprot_session($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype, |
|
$tail,$lonhost,$exiturl,$pbid,$pburl); |
return OK; |
return OK; |
} |
} |
} |
} |
Line 259 sub handler {
|
Line 267 sub handler {
|
if ($exiturl ne '') { |
if ($exiturl ne '') { |
$info{'linkprotexit'} = $exiturl; |
$info{'linkprotexit'} = $exiturl; |
} |
} |
|
if ($pbid ne '') { |
|
$info{'linkprotpbid'} = $pbid; |
|
} |
|
if ($pburl ne '') { |
|
$info{'linkprotpburl'} = $pburl; |
|
} |
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 442 sub handler {
|
Line 456 sub handler {
|
# |
# |
|
|
my %lti; |
my %lti; |
my $itemid = &get_lti_itemid($requri,$hostname,$params,$cdom); |
my $itemid = &get_lti_itemid($requri,$hostname,$params,$cdom,'','provider'); |
if ($itemid) { |
if ($itemid) { |
%lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
%lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
} |
} |
Line 923 sub lti_session {
|
Line 937 sub lti_session {
|
# login but immediately go to switch server. |
# login but immediately go to switch server. |
&Apache::lonauth::success($r,$uname,$udom,$uhome,'noredirect'); |
&Apache::lonauth::success($r,$uname,$udom,$uhome,'noredirect'); |
if (($ltihash->{'callback'}) && ($params->{$ltihash->{'callback'}})) { |
if (($ltihash->{'callback'}) && ($params->{$ltihash->{'callback'}})) { |
&LONCAPA::ltiutils::setup_logout_callback($uname,$udom,$otherserver, |
&LONCAPA::ltiutils::setup_logout_callback($cdom,$cnum,'',$itemid,$ltihash->{'cipher'}, |
$ltihash->{'key'}, |
$uname,$udom,$otherserver, |
$ltihash->{'secret'}, |
|
$params->{$ltihash->{'callback'}}, |
$params->{$ltihash->{'callback'}}, |
$r->dir_config('ltiIDsDir'), |
$r->dir_config('ltiIDsDir'), |
$protocol,$r->hostname); |
$protocol,$r->hostname); |
Line 998 sub lti_session {
|
Line 1011 sub lti_session {
|
delete($env{'form.'.$key}); |
delete($env{'form.'.$key}); |
} |
} |
if (($ltihash->{'callback'}) && ($params->{$ltihash->{'callback'}})) { |
if (($ltihash->{'callback'}) && ($params->{$ltihash->{'callback'}})) { |
&LONCAPA::ltiutils::setup_logout_callback($uname,$udom,$lonhost, |
&LONCAPA::ltiutils::setup_logout_callback($cdom,$cnum,'',$itemid,$ltihash->{'cipher'}, |
$ltihash->{'key'}, |
$uname,$udom,$lonhost, |
$ltihash->{'secret'}, |
|
$params->{$ltihash->{'callback'}}, |
$params->{$ltihash->{'callback'}}, |
$r->dir_config('ltiIDsDir'), |
$r->dir_config('ltiIDsDir'), |
$protocol,$r->hostname); |
$protocol,$r->hostname); |
Line 1072 sub lti_session {
|
Line 1084 sub lti_session {
|
} |
} |
|
|
sub linkprot_session { |
sub linkprot_session { |
my ($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype,$dest,$lonhost,$exiturl) = @_; |
my ($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype,$dest,$lonhost,$exiturl,$pbid,$pburl) = @_; |
$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 1090 sub linkprot_session {
|
Line 1102 sub linkprot_session {
|
if ($exiturl ne '') { |
if ($exiturl ne '') { |
$env{'request.linkprotexit'} = $exiturl; |
$env{'request.linkprotexit'} = $exiturl; |
} |
} |
|
if ($pbid ne '') { |
|
$env{'request.linkprotpbid'} = $pbid; |
|
} |
|
if ($pburl ne '') { |
|
$env{'request.linkprotpburl'} = $pburl; |
|
} |
my $redirecturl = '/adm/switchserver'; |
my $redirecturl = '/adm/switchserver'; |
if ($otherserver ne '') { |
if ($otherserver ne '') { |
$redirecturl .= '?otherserver='.$otherserver; |
$redirecturl .= '?otherserver='.$otherserver; |
Line 1109 sub linkprot_session {
|
Line 1127 sub linkprot_session {
|
'origurl' => $dest, |
'origurl' => $dest, |
'deeplink.login' => $dest, |
'deeplink.login' => $dest, |
); |
); |
|
if ($pbid ne '') { |
|
$info{'linkprotpbid'} = $pbid; |
|
} |
|
if ($pburl ne '') { |
|
$info{'linkprotpburl'} = $pburl; |
|
} |
if ($exiturl ne '') { |
if ($exiturl ne '') { |
$info{'linkprotexit'} = $exiturl; |
$info{'linkprotexit'} = $exiturl; |
} |
} |
Line 1126 sub check_balancer {
|
Line 1150 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); |