version 1.39, 2005/06/19 00:41:32
|
version 1.45, 2007/02/01 07:13:59
|
Line 31 package Apache::loncacc;
|
Line 31 package Apache::loncacc;
|
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http :methods REDIRECT); |
use Apache::Constants qw(:common :http :methods REDIRECT); |
use Apache::File; |
|
use CGI::Cookie(); |
use CGI::Cookie(); |
use Fcntl qw(:flock); |
use Fcntl qw(:flock); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::lonacc; |
|
use LONCAPA qw(:DEFAULT :match); |
|
|
sub constructaccess { |
sub constructaccess { |
my ($url,$ownerdomain)=@_; |
my ($url,$ownerdomain)=@_; |
my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)(\w+)\//); |
my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)($match_username)\//); |
unless (($ownername) && ($ownerdomain)) { return ''; } |
unless (($ownername) && ($ownerdomain)) { return ''; } |
# We do not allow editing of previous versions of files. |
# We do not allow editing of previous versions of files. |
if ($url=~/\.(\d+)\.(\w+)$/) { return ''; } |
if ($url=~/\.(\d+)\.(\w+)$/) { return ''; } |
Line 54 sub constructaccess {
|
Line 54 sub constructaccess {
|
} |
} |
|
|
foreach my $domain (@possibledomains) { |
foreach my $domain (@possibledomains) { |
my $capriv='user.priv.ca./'.$domain.'/'.$ownername.'./'; |
if (exists($env{'user.priv.ca./'.$domain.'/'.$ownername.'./'}) || |
foreach (keys %env) { |
exists($env{'user.priv.aa./'.$domain.'/'.$ownername.'./'}) ) { |
if ($_ eq $capriv) { |
return ($ownername,$domain); |
return ($ownername,$domain); |
|
} |
|
} |
|
my $aapriv='user.priv.aa./'.$domain.'/'.$ownername.'./'; |
|
foreach (keys %env) { |
|
if ($_ eq $aapriv) { |
|
return ($ownername,$domain); |
|
} |
|
} |
} |
} |
} |
return ''; |
return ''; |
Line 78 sub handler {
|
Line 70 sub handler {
|
my $lonid=$cookies{'lonID'}; |
my $lonid=$cookies{'lonID'}; |
my $cookie; |
my $cookie; |
if ($lonid) { |
if ($lonid) { |
my $handle=$lonid->value; |
my $handle=&LONCAPA::clean_handle($lonid->value); |
$handle=~s/\W//g; |
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { |
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { |
|
|
Line 103 sub handler {
|
Line 94 sub handler {
|
|
|
# -------------------------------------------------------- Load POST parameters |
# -------------------------------------------------------- Load POST parameters |
|
|
&Apache::loncommon::get_posted_cgi($r); |
&Apache::lonacc::get_posted_cgi($r); |
|
|
return OK; |
return OK; |
} else { |
} else { |