--- loncom/auth/lonacc.pm 2002/06/15 19:20:14 1.32 +++ loncom/auth/lonacc.pm 2002/11/06 22:43:27 1.37 @@ -1,7 +1,7 @@ # The LearningOnline Network # Cookie Based Access Handler # -# $Id: lonacc.pm,v 1.32 2002/06/15 19:20:14 www Exp $ +# $Id: lonacc.pm,v 1.37 2002/11/06 22:43:27 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -83,9 +83,6 @@ sub handler { } $ENV{'request.filename'} = $r->filename; - $ENV{'request.copyright'} = - &Apache::lonnet::metadata($requrl,'copyright'); - # -------------------------------------------------------- Load POST parameters @@ -93,7 +90,6 @@ sub handler { my $buffer; $r->read($buffer,$r->header_in('Content-length')); - unless ($buffer=~/^(\-+\w+)\s+Content\-Disposition\:\s*form\-data/si) { my @pairs=split(/&/,$buffer); my $pair; @@ -158,7 +154,7 @@ sub handler { # ---------------------------------------------------------------- Check access - if ($requrl!~/^\/adm\//) { + if ($requrl!~/^\/adm|public|prtspool\//) { my $access=&Apache::lonnet::allowed('bre',$requrl); if ($access eq '1') { $ENV{'user.error.msg'}="$requrl:bre:0:0:Choose Course"; @@ -169,6 +165,14 @@ sub handler { return HTTP_NOT_ACCEPTABLE; } } + if ($requrl =~ m|^/prtspool/|) { + my $start='/prtspool/'.$ENV{'user.name'}.'_'. + $ENV{'user.domain'}; + if ($requrl !~ /^\Q$start\E/) { + $ENV{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; + return HTTP_NOT_ACCEPTABLE; + } + } # ------------------------------------------------------------- This is allowed if ($ENV{'request.course.id'}) { &Apache::lonnet::countacc($requrl); @@ -210,7 +214,8 @@ sub handler { } # -------------------------------------------- See if this is a public resource - if (&Apache::lonnet::metadata($requrl,'copyright') eq 'public') { + if ($requrl=~m|^/public/| + || (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) { &Apache::lonnet::logthis('Granting public access: '.$requrl); $ENV{'user.name'}='public'; $ENV{'user.domain'}='public'; @@ -219,10 +224,18 @@ sub handler { $ENV{'request.filename'} = $r->filename; return OK; } -# ----------------------------------------------- Store where they wanted to go - - $ENV{'request.firsturl'}=$requrl; - return FORBIDDEN; +# -------------------------------------------------------------- Not authorized + $requrl=~/\.(\w+)$/; + if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || + ($requrl=~/^\/adm\/(roles|logout)/) || + ($requrl=~m|^/prtspool/|)) { +# -------------------------- Store where they wanted to go and get login screen + $ENV{'request.firsturl'}=$requrl; + return FORBIDDEN; + } else { +# --------------------------------------------------------------------- Goodbye + return HTTP_BAD_REQUEST; + } } 1;