version 1.15, 2018/06/30 23:58:14
|
version 1.17, 2018/12/26 20:10:29
|
Line 205 sub handler {
|
Line 205 sub handler {
|
$mapurl = $tail; |
$mapurl = $tail; |
} else { |
} else { |
$symb = $tail; |
$symb = $tail; |
$symb =~ s{^/+}{}; |
$symb =~ s{^/}{}; |
} |
} |
} elsif ($tail =~ m{^/res/(?:$match_domain)/(?:$match_username)/.+\.(?:sequence|page)(|___\d+___.+)$}) { |
} elsif ($tail =~ m{^/res/(?:$match_domain)/(?:$match_username)/.+\.(?:sequence|page)(|___\d+___.+)$}) { |
if ($1 eq '') { |
if ($1 eq '') { |
$mapurl = $tail; |
$mapurl = $tail; |
} else { |
} else { |
$symb = $tail; |
$symb = $tail; |
$symb =~ s{^/+}{}; |
$symb =~ s{^/res/}{}; |
} |
} |
} elsif ($tail =~ m{^/($match_domain)/($match_courseid)$}) { |
} elsif ($tail =~ m{^/($match_domain)/($match_courseid)$}) { |
($urlcdom,$urlcnum) = ($1,$2); |
($urlcdom,$urlcnum) = ($1,$2); |
Line 339 sub handler {
|
Line 339 sub handler {
|
} |
} |
|
|
# |
# |
|
# Determine if a username is required from the domain |
|
# configuration for the specific LTI Consumer |
|
# |
|
|
|
if (!$lti{$itemid}{'requser'}) { |
|
if ($tail =~ m{^/tiny/($match_domain)/(\w+)$}) { |
|
foreach my $key (%{$params}) { |
|
delete($env{'form.'.$key}); |
|
} |
|
my $ltoken = &Apache::lonnet::tmpput({'linkprot' => $itemid.':'.$tail}, |
|
$lonhost); |
|
if ($ltoken) { |
|
$r->internal_redirect($tail.'?ltoken='.$ltoken); |
|
$r->set_handlers('PerlHandler'=> undef); |
|
} else { |
|
&invalid_request($r,9); |
|
} |
|
} else { |
|
&invalid_request($r,10); |
|
} |
|
return OK; |
|
} |
|
|
|
# |
# Determine if source of username matches requirement from the |
# Determine if source of username matches requirement from the |
# domain configuration for the specific LTI Consumer. |
# domain configuration for the specific LTI Consumer. |
# |
# |
Line 394 sub handler {
|
Line 418 sub handler {
|
if ($consumers{$sourcecrs} =~ /^$match_courseid$/) { |
if ($consumers{$sourcecrs} =~ /^$match_courseid$/) { |
my $crshome = &Apache::lonnet::homeserver($consumers{$sourcecrs},$cdom); |
my $crshome = &Apache::lonnet::homeserver($consumers{$sourcecrs},$cdom); |
if ($crshome =~ /(con_lost|no_host|no_such_host)/) { |
if ($crshome =~ /(con_lost|no_host|no_such_host)/) { |
&invalid_request($r,9); |
&invalid_request($r,11); |
return OK; |
return OK; |
} else { |
} else { |
$posscnum = $consumers{$sourcecrs}; |
$posscnum = $consumers{$sourcecrs}; |
Line 406 sub handler {
|
Line 430 sub handler {
|
if ($urlcnum ne '') { |
if ($urlcnum ne '') { |
if ($posscnum ne '') { |
if ($posscnum ne '') { |
if ($posscnum ne $urlcnum) { |
if ($posscnum ne $urlcnum) { |
&invalid_request($r,10); |
&invalid_request($r,12); |
return OK; |
return OK; |
} else { |
} else { |
$cnum = $posscnum; |
$cnum = $posscnum; |
Line 414 sub handler {
|
Line 438 sub handler {
|
} else { |
} else { |
my $crshome = &Apache::lonnet::homeserver($urlcnum,$cdom); |
my $crshome = &Apache::lonnet::homeserver($urlcnum,$cdom); |
if ($crshome =~ /(con_lost|no_host|no_such_host)/) { |
if ($crshome =~ /(con_lost|no_host|no_such_host)/) { |
&invalid_request($r,11); |
&invalid_request($r,13); |
return OK; |
return OK; |
} else { |
} else { |
$cnum = $urlcnum; |
$cnum = $urlcnum; |
Line 479 sub handler {
|
Line 503 sub handler {
|
$domdesc,\%data,\%alerts,\%rulematch, |
$domdesc,\%data,\%alerts,\%rulematch, |
\%inst_results,\%curr_rules,%got_rules); |
\%inst_results,\%curr_rules,%got_rules); |
if ($result eq 'notallowed') { |
if ($result eq 'notallowed') { |
&invalid_request($r,12); |
&invalid_request($r,14); |
} elsif ($result eq 'ok') { |
} elsif ($result eq 'ok') { |
if (($ltiroles[0] eq 'Instructor') && ($lcroles[0] eq 'cc') && ($lti{$itemid}{'mapcrs'}) && |
if (($ltiroles[0] eq 'Instructor') && ($lcroles[0] eq 'cc') && ($lti{$itemid}{'mapcrs'}) && |
($lti{$itemid}{'makecrs'})) { |
($lti{$itemid}{'makecrs'})) { |
Line 488 sub handler {
|
Line 512 sub handler {
|
} |
} |
} |
} |
} else { |
} else { |
&invalid_request($r,13); |
&invalid_request($r,15); |
return OK; |
return OK; |
} |
} |
} else { |
} else { |
&invalid_request($r,14); |
&invalid_request($r,16); |
return OK; |
return OK; |
} |
} |
} |
} |
} else { |
} else { |
&invalid_request($r,15); |
&invalid_request($r,17); |
return OK; |
return OK; |
} |
} |
|
|
Line 519 sub handler {
|
Line 543 sub handler {
|
$symb,$cdom,$cnum,$params,\@ltiroles,$lti{$itemid},\@lcroles, |
$symb,$cdom,$cnum,$params,\@ltiroles,$lti{$itemid},\@lcroles, |
$reqcrs,$sourcecrs); |
$reqcrs,$sourcecrs); |
} else { |
} else { |
&invalid_request($r,16); |
&invalid_request($r,18); |
} |
} |
} else { |
} else { |
&invalid_request($r,17); |
&invalid_request($r,19); |
} |
} |
return OK; |
return OK; |
} |
} |
Line 608 sub handler {
|
Line 632 sub handler {
|
} |
} |
} |
} |
if ($reqrole eq '') { |
if ($reqrole eq '') { |
&invalid_request($r,18); |
&invalid_request($r,20); |
return OK; |
return OK; |
} else { |
} else { |
unless (%crsenv) { |
unless (%crsenv) { |
Line 618 sub handler {
|
Line 642 sub handler {
|
my $default_enrollment_end_date = $crsenv{'default_enrollment_end_date'}; |
my $default_enrollment_end_date = $crsenv{'default_enrollment_end_date'}; |
my $now = time; |
my $now = time; |
if ($default_enrollment_end_date && $default_enrollment_end_date <= $now) { |
if ($default_enrollment_end_date && $default_enrollment_end_date <= $now) { |
&invalid_request($r,19); |
&invalid_request($r,21); |
return OK; |
return OK; |
} elsif ($default_enrollment_start_date && $default_enrollment_start_date >$now) { |
} elsif ($default_enrollment_start_date && $default_enrollment_start_date >$now) { |
&invalid_request($r,20); |
&invalid_request($r,22); |
return OK; |
return OK; |
} else { |
} else { |
$selfenrollrole = $reqrole.'./'.$cdom.'/'.$cnum; |
$selfenrollrole = $reqrole.'./'.$cdom.'/'.$cnum; |
Line 730 sub lti_session {
|
Line 754 sub lti_session {
|
&Apache::lonauth::success($r,$uname,$udom,$uhome,'noredirect'); |
&Apache::lonauth::success($r,$uname,$udom,$uhome,'noredirect'); |
if ($symb) { |
if ($symb) { |
$env{'form.symb'} = $symb; |
$env{'form.symb'} = $symb; |
$env{'request.lti.uri'} = $symb; |
$env{'request.lti.uri'} = $tail; |
} else { |
} else { |
if ($mapurl) { |
if ($mapurl) { |
$env{'form.origurl'} = $mapurl; |
$env{'form.origurl'} = $mapurl; |