version 1.164, 2021/08/07 20:49:10
|
version 1.166, 2021/08/10 15:28:13
|
Line 386 sub handler {
|
Line 386 sub handler {
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
|
&Apache::loncommon::content_type($r,'text/html');
|
&Apache::loncommon::content_type($r,'text/html');
|
$r->send_http_header;
|
$r->send_http_header;
|
my $start_page =
|
my $start_page =
|
&Apache::loncommon::start_page('Already logged in');
|
&Apache::loncommon::start_page('Already logged in');
|
my $end_page =
|
my $end_page =
|
&Apache::loncommon::end_page();
|
&Apache::loncommon::end_page();
|
my $dest = '/adm/roles';
|
my $dest = '/adm/roles';
|
if ($env{'form.firsturl'} ne '') {
|
if ($env{'form.firsturl'} ne '') {
|
$dest = $env{'form.firsturl'};
|
$dest = $env{'form.firsturl'};
|
if (($env{'form.firsturl'} =~ m{^/tiny/$match_domain/\w+$}) &&
|
if (($dest =~ m{^/tiny/$match_domain/\w+$}) && ($env{'request.course.id'})) {
|
($env{'request.course.id'})) {
|
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
|
my $symb = &Apache::loncommon::symb_from_tinyurl($env{'form.firsturl'},$cnum,$cdom);
|
my $symb = &Apache::loncommon::symb_from_tinyurl($dest,$cnum,$cdom);
|
if ($symb) {
|
if ($symb) {
|
my $buffer;
|
my $buffer;
|
if ($r->header_in('Content-length') > 0) {
|
if ($r->header_in('Content-length') > 0) {
|
Line 801 sub handler {
|
Line 800 sub handler {
|
'user.linkproturi' => $uri};
|
'user.linkproturi' => $uri};
|
}
|
}
|
} elsif ($form{'linkkey'}) {
|
} elsif ($form{'linkkey'}) {
|
$extra_env = {'user.deeplinkkey' => $form{'linkkey'},
|
$extra_env = {'user.deeplinkkey' => $form{'linkkey'},
|
'user.keyedlinkuri' => $form{'firsturl'}};
|
'user.keyedlinkuri' => $form{'firsturl'}};
|
}
|
}
|
if ($form{'firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
|
if ($form{'firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
|
&set_deeplink_login(%form);
|
&set_deeplink_login(%form);
|
|
if ($form{'linkprot'}) {
|
|
if (ref($extra_env) eq 'HASH') {
|
|
%{$extra_env} = ( %{$extra_env}, 'request.linkprot' => $form{'linkprot'} );
|
|
} else {
|
|
$extra_env = {'request.linkprot' => $form{'linkprot'}};
|
|
}
|
|
} elsif ($form{'linkkey'}) {
|
|
if (ref($extra_env) eq 'HASH') {
|
|
%{$extra_env} = ( %{$extra_env}, 'request.linkkey' => $form{'linkkey'} );
|
|
} else {
|
|
$extra_env = {'request.linkkey' => $form{'linkkey'}};
|
|
}
|
|
}
|
if ($env{'request.deeplink.login'}) {
|
if ($env{'request.deeplink.login'}) {
|
if (ref($extra_env) eq 'HASH') {
|
if (ref($extra_env) eq 'HASH') {
|
%{$extra_env} = ( %{$extra_env}, 'request.deeplink.login' => $form{'firsturl'} );
|
%{$extra_env} = ( %{$extra_env}, 'request.deeplink.login' => $form{'firsturl'} );
|
Line 826 sub set_deeplink_login {
|
Line 838 sub set_deeplink_login {
|
my $cdom = $1;
|
my $cdom = $1;
|
my ($cnum,$symb) = &Apache::loncommon::symb_from_tinyurl($form{'firsturl'},'',$cdom);
|
my ($cnum,$symb) = &Apache::loncommon::symb_from_tinyurl($form{'firsturl'},'',$cdom);
|
if ($symb) {
|
if ($symb) {
|
my $disallow;
|
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) {
|
my $deeplink = &Apache::lonnet::EXT("resource.0.deeplink",$symb);
|
my ($disallow,$deeplink);
|
if ($deeplink ne '') {
|
if ($symb =~ /\.(page|sequence)$/) {
|
my ($state,$others,$listed,$scope,$protect) = split(/,/,$deeplink);
|
my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($symb))[2]);
|
if (($protect ne 'none') && ($protect ne '')) {
|
my $navmap = Apache::lonnavmaps::navmap->new();
|
my ($acctype,$item) = split(/:/,$protect);
|
if (ref($navmap)) {
|
if (($acctype eq 'ltic') || ($acctype eq 'ltid')) {
|
$deeplink = $navmap->get_mapparam(undef,$mapname,'0.deeplink');
|
unless ($form{'linkprot'} eq $protect) {
|
}
|
$disallow = 1;
|
} else {
|
}
|
$deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$symb);
|
} elsif ($acctype eq 'key') {
|
}
|
unless (form{'linkkey'} eq $item) {
|
if ($deeplink ne '') {
|
$disallow = 1;
|
my ($state,$others,$listed,$scope,$protect) = split(/,/,$deeplink);
|
|
if (($protect ne 'none') && ($protect ne '')) {
|
|
my ($acctype,$item) = split(/:/,$protect);
|
|
if ($acctype =~ /lti(c|d)$/) {
|
|
unless ($form{'linkprot'} eq $item.$1.':'.$env{'request.deeplink.login'}) {
|
|
$disallow = 1;
|
|
}
|
|
} elsif ($acctype eq 'key') {
|
|
unless ($form{'linkkey'} eq $item) {
|
|
$disallow = 1;
|
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
unless ($disallow) {
|
unless ($disallow) {
|
$env{'request.deeplink.login'} = $form{'firsturl'};
|
|
}
|
|
} else {
|
$env{'request.deeplink.login'} = $form{'firsturl'};
|
$env{'request.deeplink.login'} = $form{'firsturl'};
|
}
|
}
|
}
|
}
|