version 1.78, 2006/06/02 19:38:21
|
version 1.80, 2006/06/16 22:54:30
|
Line 135 sub get_posted_cgi {
|
Line 135 sub get_posted_cgi {
|
$r->headers_in->unset('Content-length'); |
$r->headers_in->unset('Content-length'); |
} |
} |
|
|
|
sub portfolio_access { |
|
my ($udom,$unum,$file_name,$group) = @_; |
|
my $current_perms = &Apache::lonnet::get_portfile_permissions($udom,$unum); |
|
my %access_controls = &Apache::lonnet::get_access_controls( |
|
$current_perms,$group,$file_name); |
|
my ($public); |
|
my $now = time; |
|
my $access_hash = $access_controls{$file_name}; |
|
if (ref($access_hash) eq 'HASH') { |
|
foreach my $key (keys(%{$access_hash})) { |
|
my ($num,$scope,$end,$start) = ($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/); |
|
if ($start > $now) { |
|
next; |
|
} |
|
if ($end && $end<$now) { |
|
next; |
|
} |
|
if ($scope eq 'public') { |
|
$public = $key; |
|
last; |
|
} |
|
} |
|
if ($public) { |
|
return 'ok'; |
|
} |
|
} |
|
return; |
|
} |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
Line 197 sub handler {
|
Line 225 sub handler {
|
&Apache::lonacc::get_posted_cgi($r); |
&Apache::lonacc::get_posted_cgi($r); |
|
|
# ---------------------------------------------------------------- Check access |
# ---------------------------------------------------------------- Check access |
|
my $now = time; |
|
if ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/portfolio(/.+)$|) { |
|
my $result = &portfolio_access($1,$2,$3); |
|
if ($result eq 'ok') { |
|
return OK; |
|
} |
|
} elsif ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/groups/([^/]+)/portfolio/(.+)$|) { |
|
my $result = &portfolio_access($1,$2,$4.'/'.$3,$3); |
|
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') { |
Line 310 sub handler {
|
Line 349 sub handler {
|
if ($requrl=~m|^/+adm/+help/+|) { |
if ($requrl=~m|^/+adm/+help/+|) { |
return OK; |
return OK; |
} |
} |
|
# ------------------------------------- See if this is a viewable portfolio file |
|
if ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/portfolio(/.+)$|) { |
|
my $result = &portfolio_access($1,$2,$3); |
|
if ($result eq 'ok') { |
|
return OK; |
|
} |
|
} elsif ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/groups/([^/]+)/portfolio/(.+)$|) { |
|
my $result = &portfolio_access($1,$2,$4.'/'.$3,$3); |
|
if ($result eq 'ok') { |
|
return OK; |
|
} |
|
} |
# -------------------------------------------------------------- Not authorized |
# -------------------------------------------------------------- Not authorized |
$requrl=~/\.(\w+)$/; |
$requrl=~/\.(\w+)$/; |
# if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |
# if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || |