version 1.13, 2012/04/18 18:55:06
|
version 1.21, 2018/12/24 14:29:48
|
Line 1
|
Line 1
|
# The LearningOnline Network |
# The LearningOnline Network |
# checks for a cokkie to authenticate a user |
# checks for a cookie to authenticate a user |
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 36 use Apache::lonnet;
|
Line 36 use Apache::lonnet;
|
sub handler { |
sub handler { |
my ($r) = @_; |
my ($r) = @_; |
|
|
|
if ($r->uri() =~ m{^/res/adm/pages/[^/]+\.(gif|png)$}) { |
|
if ($r->user() eq '') { |
|
$r->user('public:public'); |
|
} |
|
return OK; |
|
} |
|
|
if (&Apache::lonnet::is_domainimage($r->uri)) { |
if (&Apache::lonnet::is_domainimage($r->uri)) { |
|
if ($r->user() eq '') { |
|
$r->user('public:public'); |
|
} |
return OK; |
return OK; |
} |
} |
|
|
Line 55 sub handler {
|
Line 65 sub handler {
|
if ($env{'user.name'} eq 'public' |
if ($env{'user.name'} eq 'public' |
&& $env{'user.domain'} eq 'public') { |
&& $env{'user.domain'} eq 'public') { |
if ($env{'request.publicaccess'} ) { |
if ($env{'request.publicaccess'} ) { |
|
if ($r->user() eq '') { |
|
$r->user('public:public'); |
|
} |
return OK; |
return OK; |
} else { |
} else { |
return $fail; |
return $fail; |
} |
} |
} |
} |
|
|
my $handle = &Apache::lonnet::check_for_valid_session($r); |
my %user; |
|
my $handle = &Apache::lonnet::check_for_valid_session($r,undef,\%user); |
if ($handle eq '') { |
if ($handle eq '') { |
$handle = $env{'user.environment'}; |
$handle = $env{'user.environment'}; |
|
if (($handle ne '') && ($r->user() eq '')) { |
|
if ($env{'user.domain'} eq $r->dir_config('lonDefDomain')) { |
|
$r->user($env{'user.name'}); |
|
} else { |
|
$r->user($env{'user.name'}.':'.$env{'user.domain'}); |
|
} |
|
} |
} |
} |
|
|
if ($handle ne '') { |
if ($handle ne '') { |
|
if ($r->user() eq '') { |
|
if ($user{'domain'} eq $r->dir_config('lonDefDomain')) { |
|
$r->user($user{'name'}); |
|
} else { |
|
$r->user($user{'name'}.':'.$user{'domain'}); |
|
} |
|
} |
return OK; |
return OK; |
} |
} |
if (($fail == FORBIDDEN) && ($r->uri eq '/adm/email')) { |
if (($fail == FORBIDDEN) && |
|
(($r->uri eq '/adm/email') || ($r->uri eq '/adm/preferences') || |
|
($r->uri eq '/adm/requestcourse') || |
|
(($r->is_initial_req()) && ($r->uri =~ m{^/tiny/[\w\-.]+/\w+$})))) { |
$env{'form.firsturl'} = $r->uri; |
$env{'form.firsturl'} = $r->uri; |
} |
} |
return $fail; |
return $fail; |