version 1.28, 2003/05/13 00:52:46
|
version 1.37, 2004/10/29 20:44:30
|
Line 42 use Apache::Constants qw(:common :http :
|
Line 42 use Apache::Constants qw(:common :http :
|
use Apache::File; |
use Apache::File; |
use CGI::Cookie(); |
use CGI::Cookie(); |
use Fcntl qw(:flock); |
use Fcntl qw(:flock); |
|
use Apache::lonlocal; |
|
use Apache::lonnet(); |
|
|
|
|
sub constructaccess { |
sub constructaccess { |
my ($url,$ownerdomain)=@_; |
my ($url,$ownerdomain)=@_; |
my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)(\w+)/); |
my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)(\w+)\//); |
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 ''; } |
if (($ownername eq $ENV{'user.name'}) && |
my @possibledomains = &Apache::lonnet::current_machine_domains(); |
($ownerdomain eq $ENV{'user.domain'})) { |
if ($ownername eq $ENV{'user.name'}) { |
return ($ownername,$ownerdomain); |
foreach my $domain (@possibledomains) { |
|
if ($domain eq $ENV{'user.domain'}) { |
|
return ($ownername,$domain); |
|
} |
|
} |
} |
} |
|
|
my $capriv='user.priv.ca./'. |
foreach my $domain (@possibledomains) { |
$ownerdomain.'/'.$ownername.'./'. |
my $capriv='user.priv.ca./'.$domain.'/'.$ownername.'./'; |
$ownerdomain.'/'.$ownername; |
foreach (keys %ENV) { |
foreach (keys %ENV) { |
if ($_ eq $capriv) { |
if ($_ eq $capriv) { |
return ($ownername,$domain); |
return ($ownername,$ownerdomain); |
} |
} |
} |
} |
} |
|
|
return ''; |
return ''; |
} |
} |
|
|
Line 83 sub handler {
|
Line 89 sub handler {
|
|
|
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); |
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); |
|
|
|
# --------------------------------------------------------- Initialize Language |
|
|
|
&Apache::lonlocal::get_language_handle($r); |
|
|
# -------------------------------------------------------------- Resource State |
# -------------------------------------------------------------- Resource State |
|
|
$ENV{'request.state'} = "construct"; |
$ENV{'request.state'} = "construct"; |
Line 92 sub handler {
|
Line 102 sub handler {
|
$r->log_reason("Unauthorized $requrl", $r->filename); |
$r->log_reason("Unauthorized $requrl", $r->filename); |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
# Construction space needs Remote to work |
|
if ($ENV{'environment.remote'} eq 'off') { |
|
$r->content_type('text/html'); |
|
$r->header_out(Location => |
|
'http://'.$r->server->server_hostname. |
|
'/adm/remote?action=launch&url='. |
|
&Apache::lonnet::escape($requrl)); |
|
return REDIRECT; |
|
} |
|
|
|
# -------------------------------------------------------- Load POST parameters |
# -------------------------------------------------------- Load POST parameters |
|
|