version 1.55, 2004/12/20 20:51:23
|
version 1.69, 2005/11/23 20:46:04
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# YEAR=1999 |
|
# 5/21/99,5/22,5/29,5/31,6/15,16/11,22/11, |
|
# YEAR=2000 |
|
# 01/06,01/13,05/31,06/01,09/06,09/25,09/28,10/30,11/6, |
|
# 12/25,12/26, |
|
# YEAR=2001 |
|
# 01/06/01,05/28,8/11,9/26,11/29 Gerd Kortemeyer |
|
# YEAR=2002 |
|
# 1/4,2/25 Gerd Kortemeyer |
|
# |
|
### |
### |
|
|
package Apache::lonacc; |
package Apache::lonacc; |
Line 71 sub handler {
|
Line 61 sub handler {
|
# -------------------------------------------------------------- Resource State |
# -------------------------------------------------------------- Resource State |
|
|
if ($requrl=~/^\/+(res|uploaded)\//) { |
if ($requrl=~/^\/+(res|uploaded)\//) { |
$ENV{'request.state'} = "published"; |
$env{'request.state'} = "published"; |
} else { |
} else { |
$ENV{'request.state'} = 'unknown'; |
$env{'request.state'} = 'unknown'; |
} |
} |
$ENV{'request.filename'} = $r->filename; |
$env{'request.filename'} = $r->filename; |
$ENV{'request.noversionuri'} = &Apache::lonnet::deversion($requrl); |
$env{'request.noversionuri'} = &Apache::lonnet::deversion($requrl); |
# -------------------------------------------------------- Load POST parameters |
# -------------------------------------------------------- Load POST parameters |
|
|
&Apache::loncommon::get_posted_cgi($r); |
&Apache::loncommon::get_posted_cgi($r); |
Line 86 sub handler {
|
Line 76 sub handler {
|
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 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; |
} |
} |
} |
} |
if ($requrl =~ m|^/prtspool/|) { |
if ($requrl =~ m|^/prtspool/|) { |
my $start='/prtspool/'.$ENV{'user.name'}.'_'. |
my $start='/prtspool/'.$env{'user.name'}.'_'. |
$ENV{'user.domain'}; |
$env{'user.domain'}; |
if ($requrl !~ /^\Q$start\E/) { |
if ($requrl !~ /^\Q$start\E/) { |
$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; |
} |
} |
} |
} |
|
if ($env{'user.name'} eq 'public' && |
|
$env{'user.domain'} eq 'public' && |
|
$requrl !~ m{^/+(res|public)/} && |
|
$requrl !~ m{^/+adm/(help|logout|randomlabel\.png)}) { |
|
$env{'request.querystring'}=$r->args; |
|
$env{'request.firsturl'}=$requrl; |
|
return FORBIDDEN; |
|
} |
# ------------------------------------------------------------- This is allowed |
# ------------------------------------------------------------- This is allowed |
if ($ENV{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
&Apache::lonnet::countacc($requrl); |
&Apache::lonnet::countacc($requrl); |
$requrl=~/\.(\w+)$/; |
$requrl=~/\.(\w+)$/; |
if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
Line 117 sub handler {
|
Line 115 sub handler {
|
if ($query) { |
if ($query) { |
&Apache::loncommon::get_unprocessed_cgi($query,['symb']); |
&Apache::loncommon::get_unprocessed_cgi($query,['symb']); |
} |
} |
if ($ENV{'form.symb'}) { |
if ($env{'form.symb'}) { |
$symb=&Apache::lonnet::symbclean($ENV{'form.symb'}); |
$symb=&Apache::lonnet::symbclean($env{'form.symb'}); |
if ($requrl =~ m|^/adm/wrapper/|) { |
if ($requrl =~ m|^/adm/wrapper/|) { |
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
&Apache::lonnet::symblist($map,$murl => $mid, |
&Apache::lonnet::symblist($map,$murl => [$murl,$mid], |
'last_known' => $murl); |
'last_known' =>[$murl,$mid]); |
} elsif ((&Apache::lonnet::symbverify($symb,$requrl)) || |
} elsif ((&Apache::lonnet::symbverify($symb,$requrl)) || |
(($requrl=~m|(.*)/smpedit$|) && |
(($requrl=~m|(.*)/smpedit$|) && |
&Apache::lonnet::symbverify($symb,$1))) { |
&Apache::lonnet::symbverify($symb,$1))) { |
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
&Apache::lonnet::symblist($map,$murl => $mid, |
&Apache::lonnet::symblist($map,$murl => [$murl,$mid], |
'last_known' => $murl); |
'last_known' =>[$murl,$mid]); |
} else { |
} else { |
$r->log_reason('Invalid symb for '.$requrl.': '. |
$r->log_reason('Invalid symb for '.$requrl.': '. |
$symb); |
$symb); |
$ENV{'user.error.msg'}= |
$env{'user.error.msg'}= |
"$requrl:bre:1:1:Invalid Access"; |
"$requrl:bre:1:1:Invalid Access"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
} else { |
} else { |
$symb=&Apache::lonnet::symbread($requrl); |
$symb=&Apache::lonnet::symbread($requrl); |
if (!&Apache::lonnet::symbverify($symb,$requrl)) { |
if (&Apache::lonnet::is_on_map($requrl) && $symb && |
$r->log_reason('Invalid symb for '.$requrl.': '. |
!&Apache::lonnet::symbverify($symb,$requrl)) { |
$symb); |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
$ENV{'user.error.msg'}= |
$env{'user.error.msg'}= |
"$requrl:bre:1:1:Invalid Access"; |
"$requrl:bre:1:1:Invalid Access"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
my ($map,$mid,$murl)=split(/\_\_\_/,$symb); |
if ($symb) { |
&Apache::lonnet::symblist($map,$murl => $mid, |
my ($map,$mid,$murl)= |
'last_known' => $murl); |
&Apache::lonnet::decode_symb($symb); |
|
&Apache::lonnet::symblist($map,$murl =>[$murl,$mid], |
|
'last_known' =>[$murl,$mid]); |
|
} |
} |
} |
$ENV{'request.symb'}=$symb; |
$env{'request.symb'}=$symb; |
&Apache::lonnet::courseacclog($symb); |
&Apache::lonnet::courseacclog($symb); |
} else { |
} else { |
# ------------------------------------------------------- This is other content |
# ------------------------------------------------------- This is other content |
Line 166 sub handler {
|
Line 167 sub handler {
|
if ($requrl=~m|^/public/| |
if ($requrl=~m|^/public/| |
|| (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) { |
|| (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) { |
&Apache::lonnet::logthis('Granting public access: '.$requrl); |
&Apache::lonnet::logthis('Granting public access: '.$requrl); |
my $buffer; |
my $cookie= |
$r->read($buffer,$r->header_in('Content-length'),0); |
&Apache::lonauth::success($r,'public','public','public'); |
&Apache::loncommon::get_unprocessed_cgi($buffer); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
$ENV{'user.name'}='public'; |
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$cookie); |
$ENV{'user.domain'}='public'; |
&Apache::loncommon::get_posted_cgi($r); |
$ENV{'request.state'} = "published"; |
$env{'request.state'} = "published"; |
$ENV{'request.publicaccess'} = 1; |
$env{'request.publicaccess'} = 1; |
$ENV{'request.filename'} = $r->filename; |
$env{'request.filename'} = $r->filename; |
|
|
|
$r->header_out('Set-cookie',"lonID=$cookie; path=/"); |
return OK; |
return OK; |
} |
} |
|
if ($requrl=~m|^/+adm/+help/+|) { |
|
return OK; |
|
} |
# -------------------------------------------------------------- Not authorized |
# -------------------------------------------------------------- Not authorized |
$requrl=~/\.(\w+)$/; |
$requrl=~/\.(\w+)$/; |
if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
# if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
($requrl=~/^\/adm\/(roles|logout|email|menu|remote)/) || |
# ($requrl=~/^\/adm\/(roles|logout|email|menu|remote)/) || |
($requrl=~m|^/prtspool/|)) { |
# ($requrl=~m|^/prtspool/|)) { |
# -------------------------- Store where they wanted to go and get login screen |
# -------------------------- Store where they wanted to go and get login screen |
$ENV{'request.querystring'}=$r->args; |
$env{'request.querystring'}=$r->args; |
$ENV{'request.firsturl'}=$requrl; |
$env{'request.firsturl'}=$requrl; |
return FORBIDDEN; |
return FORBIDDEN; |
} else { |
# } else { |
# --------------------------------------------------------------------- Goodbye |
# --------------------------------------------------------------------- Goodbye |
return HTTP_BAD_REQUEST; |
# return HTTP_BAD_REQUEST; |
} |
# } |
} |
} |
|
|
1; |
1; |