--- loncom/auth/lonacc.pm 2002/10/25 13:59:40 1.36 +++ 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.36 2002/10/25 13:59:40 www Exp $ +# $Id: lonacc.pm,v 1.37 2002/11/06 22:43:27 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -90,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; @@ -155,7 +154,7 @@ sub handler { # ---------------------------------------------------------------- Check access - if ($requrl!~/^\/adm|public\//) { + 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"; @@ -166,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); @@ -207,8 +214,8 @@ sub handler { } # -------------------------------------------- See if this is a public resource - if (($requrl=~/^\/public\//) || - (&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'; @@ -220,7 +227,8 @@ sub handler { # -------------------------------------------------------------- Not authorized $requrl=~/\.(\w+)$/; if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') || - ($requrl=~/^\/adm\/(roles|logout)/)) { + ($requrl=~/^\/adm\/(roles|logout)/) || + ($requrl=~m|^/prtspool/|)) { # -------------------------- Store where they wanted to go and get login screen $ENV{'request.firsturl'}=$requrl; return FORBIDDEN;