version 1.89, 2006/07/21 18:52:32
|
version 1.91, 2006/08/04 21:31:53
|
Line 137 sub get_posted_cgi {
|
Line 137 sub get_posted_cgi {
|
$r->headers_in->unset('Content-length'); |
$r->headers_in->unset('Content-length'); |
} |
} |
|
|
sub passphrase_access_checker { |
|
my ($r,$guestkey,$requrl) = @_; |
|
my ($num,$scope,$end,$start) = ($guestkey =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/); |
|
if ($scope eq 'guest') { |
|
if (exists($env{'user.passphrase_access_'.$requrl})) { |
|
if (($env{'user.passphrase_access_'.$requrl} == 0) || |
|
($env{'user.passphrase_access_'.$requrl} > time)) { |
|
$env{'request.publicaccess'} = 1; |
|
return 'ok'; |
|
} |
|
} |
|
} |
|
$r->set_handlers('PerlHandler'=> \&Apache::restrictedaccess::handler); |
|
$r->content_type('perl-script'); |
|
return; |
|
} |
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
my $requrl=$r->uri; |
my $requrl=$r->uri; |
Line 216 sub handler {
|
Line 199 sub handler {
|
|
|
# ---------------------------------------------------------------- Check access |
# ---------------------------------------------------------------- Check access |
my $now = time; |
my $now = time; |
if (&Apache::lonnet::is_portfolio_url($requrl)) { |
|
my $result = &Apache::lonnet::portfolio_access($r,$requrl); |
|
if ($result eq 'ok') { return OK; } |
|
} |
|
if ($requrl!~/^\/adm|public|prtspool\//) { |
if ($requrl!~/^\/adm|public|prtspool\//) { |
my $access=&Apache::lonnet::allowed('bre',$requrl); |
my $access=&Apache::lonnet::allowed('bre',$requrl); |
if ($access eq '1') { |
if ($access eq '1') { |
$env{'user.error.msg'}="$requrl:bre:0:0:Choose Course"; |
$env{'user.error.msg'}="$requrl:bre:0:0:Choose Course"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
if ($access eq 'A') { |
|
&Apache::restrictedaccess::setup_handler($r); |
|
return OK; |
|
} |
if (($access ne '2') && ($access ne 'F')) { |
if (($access ne '2') && ($access ne 'F')) { |
$env{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
$env{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
Line 241 sub handler {
|
Line 224 sub handler {
|
} |
} |
if ($env{'user.name'} eq 'public' && |
if ($env{'user.name'} eq 'public' && |
$env{'user.domain'} eq 'public' && |
$env{'user.domain'} eq 'public' && |
$requrl !~ m{^/+(res|public)/} && |
$requrl !~ m{^/+(res|public|uploaded)/} && |
|
$requrl !~ m{^/adm/[^/]+/[^/]+/aboutme/portfolio$} && |
$requrl !~ m{^/+adm/(help|logout|restrictedaccess|randomlabel\.png)}) { |
$requrl !~ m{^/+adm/(help|logout|restrictedaccess|randomlabel\.png)}) { |
$env{'request.querystring'}=$r->args; |
$env{'request.querystring'}=$r->args; |
$env{'request.firsturl'}=$requrl; |
$env{'request.firsturl'}=$requrl; |
Line 332 sub handler {
|
Line 316 sub handler {
|
if ($requrl=~m|^/+adm/+help/+|) { |
if ($requrl=~m|^/+adm/+help/+|) { |
return OK; |
return OK; |
} |
} |
# ------------------------------------- See if this is a viewable portfolio file |
# ------------------------------------ See if this is a viewable portfolio file |
if (&Apache::lonnet::is_portfolio_url($requrl)) { |
if (&Apache::lonnet::is_portfolio_url($requrl)) { |
my $result = &Apache::lonnet::portfolio_access($r,$requrl); |
my $access=&Apache::lonnet::allowed('bre',$requrl); |
if ($result eq 'ok' ) { return OK; } |
if ($access eq 'A') { |
|
&Apache::restrictedaccess::setup_handler($r); |
|
return OK; |
|
} |
|
if (($access ne '2') && ($access ne 'F')) { |
|
$env{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
|
return HTTP_NOT_ACCEPTABLE; |
|
} |
} |
} |
|
|
# -------------------------------------------------------------- Not authorized |
# -------------------------------------------------------------- Not authorized |