--- loncom/auth/loncacc.pm 2006/11/27 16:47:16 1.43 +++ loncom/auth/loncacc.pm 2007/02/01 07:13:04 1.44 @@ -2,7 +2,7 @@ # Cookie Based Access Handler for Construction Area # (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer) # -# $Id: loncacc.pm,v 1.43 2006/11/27 16:47:16 albertel Exp $ +# $Id: loncacc.pm,v 1.44 2007/02/01 07:13:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,15 +32,14 @@ package Apache::loncacc; use strict; use Apache::Constants qw(:common :http :methods REDIRECT); use CGI::Cookie(); -use Fcntl qw(:flock); use Apache::lonlocal; use Apache::lonnet; -use Apache::lonacc; +use Apache::lonacc(); use LONCAPA qw(:DEFAULT :match); sub constructaccess { my ($url,$ownerdomain)=@_; - my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)($match_username)\//); + my ($ownername)=($url=~m{/(?:\~|priv/|home/)($match_username)/}); unless (($ownername) && ($ownerdomain)) { return ''; } # We do not allow editing of previous versions of files. if ($url=~/\.(\d+)\.(\w+)$/) { return ''; } @@ -48,22 +47,25 @@ sub constructaccess { if ($ownername eq $env{'user.name'}) { foreach my $domain (@possibledomains) { if ($domain eq $env{'user.domain'}) { + &Apache::lonnet::logthis("good1!"); return ($ownername,$domain); } } } - foreach my $domain (@possibledomains) { if (exists($env{'user.priv.ca./'.$domain.'/'.$ownername.'./'}) || exists($env{'user.priv.aa./'.$domain.'/'.$ownername.'./'}) ) { + &Apache::lonnet::logthis("good2!"); return ($ownername,$domain); } } + &Apache::lonnet::logthis("boo! hiss!"); return ''; } sub handler { my $r = shift; + my $requrl=$r->uri; $env{'request.editurl'}=$requrl; my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));