version 1.83, 2006/06/30 04:23:33
|
version 1.85, 2006/07/10 03:58:45
|
Line 37 use Apache::loncommon();
|
Line 37 use Apache::loncommon();
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use CGI::Cookie(); |
use CGI::Cookie(); |
use Fcntl qw(:flock); |
use Fcntl qw(:flock); |
|
use LONCAPA; |
|
|
sub cleanup { |
sub cleanup { |
my ($r)=@_; |
my ($r)=@_; |
Line 172 sub portfolio_access {
|
Line 173 sub portfolio_access {
|
} |
} |
if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') { |
if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') { |
if ($guest) { |
if ($guest) { |
return 'guest:'.$guest; |
return $guest; |
} |
} |
} else { |
} else { |
if (@domains > 0) { |
if (@domains > 0) { |
Line 247 sub portfolio_access {
|
Line 248 sub portfolio_access {
|
return 'ok'; |
return 'ok'; |
} else { |
} else { |
if (grep/^$sec$/,@sections) { |
if (grep/^$sec$/,@sections) { |
return 'ok' |
return 'ok'; |
} |
} |
} |
} |
} |
} |
Line 272 sub portfolio_access {
|
Line 273 sub portfolio_access {
|
} |
} |
} |
} |
if ($guest) { |
if ($guest) { |
return 'guest:'.$guest; |
return $guest; |
} |
} |
} |
} |
} |
} |
return; |
return; |
} |
} |
|
|
|
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'; |
|
} |
|
} |
|
} |
|
my $login = $r->dir_config('Login'); |
|
$login .= '?origurl='.&escape($requrl); |
|
$r->custom_response(FORBIDDEN,$login); |
|
return; |
|
} |
|
|
sub course_group_datechecker { |
sub course_group_datechecker { |
my ($dates,$now,$status) = @_; |
my ($dates,$now,$status) = @_; |
my ($start,$end) = split(/\./,$dates); |
my ($start,$end) = split(/\./,$dates); |
Line 369 sub handler {
|
Line 388 sub handler {
|
my $result = &portfolio_access($1,$2,$3); |
my $result = &portfolio_access($1,$2,$3); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
return OK; |
return OK; |
} elsif ($result =~ /^guest:(\w+)$/) { |
} elsif ($result =~ /^[^:]+:guest_/) { |
my $guestkey = $1; |
if (&passphrase_access_checker($r,$result,$requrl) eq 'ok') { |
#FIXME need to cause generation of an intermediate page |
return OK; |
|
} else { |
|
return FORBIDDEN; |
|
} |
} |
} |
} elsif ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/groups/([^/]+)/portfolio/(.+)$|) { |
} elsif ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/groups/([^/]+)/portfolio/(.+)$|) { |
my $result = &portfolio_access($1,$2,$3.'/'.$4,$3); |
my $result = &portfolio_access($1,$2,$3.'/'.$4,$3); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
return OK; |
return OK; |
} elsif ($result =~ /^guest:(\w+)$/) { |
} elsif ($result =~ /^[^:]+:guest_/) { |
my $guestkey = $1; |
if (&passphrase_access_checker($r,$result,$requrl) eq 'ok') { |
#FIXME need to cause generation of an intermediate page |
return OK; |
} |
} else { |
|
return FORBIDDEN; |
|
} |
|
} |
} |
} |
if ($requrl!~/^\/adm|public|prtspool\//) { |
if ($requrl!~/^\/adm|public|prtspool\//) { |
my $access=&Apache::lonnet::allowed('bre',$requrl); |
my $access=&Apache::lonnet::allowed('bre',$requrl); |
Line 414 sub handler {
|
Line 439 sub handler {
|
&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') || |
($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|grppg|bulletinboard)(\?|$)/) || |
($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$)/) || |
($requrl=~/^\/adm\/wrapper\//) || |
($requrl=~/^\/adm\/wrapper\//) || |
($requrl=~m|^/adm/coursedocs/showdoc/|) || |
($requrl=~m|^/adm/coursedocs/showdoc/|) || |
($requrl=~m|\.problem/smpedit$|) || |
($requrl=~m|\.problem/smpedit$|) || |
Line 499 sub handler {
|
Line 524 sub handler {
|
my $result = &portfolio_access($1,$2,$3); |
my $result = &portfolio_access($1,$2,$3); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
return OK; |
return OK; |
} elsif ($result =~ /^guest:(\w+)$/) { |
} elsif ($result =~ /^[^:]+:guest_/) { |
my $guestkey = $1; |
if (&passphrase_access_checker($r,$result,$requrl) eq 'ok') { |
#FIXME need to cause generation of an intermediate page |
return OK; |
|
} else { |
|
return FORBIDDEN; |
|
} |
} |
} |
} elsif ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/groups/([^/]+)/portfolio/(.+)$|) { |
} elsif ($requrl =~ m|/+uploaded/([^/]+)/([^/]+)/groups/([^/]+)/portfolio/(.+)$|) { |
my $result = &portfolio_access($1,$2,$3.'/'.$4,$3); |
my $result = &portfolio_access($1,$2,$3.'/'.$4,$3); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
return OK; |
return OK; |
} elsif ($result =~ /^guest:(\w+)$/) { |
} elsif ($result =~ /^[^:]+:guest_/) { |
my $guestkey = $1; |
if (&passphrase_access_checker($r,$result,$requrl) eq 'ok') { |
#FIXME need to cause generation of an intermediate page |
return OK; |
|
} else { |
|
return FORBIDDEN; |
|
} |
} |
} |
} |
} |
# -------------------------------------------------------------- Not authorized |
# -------------------------------------------------------------- Not authorized |