merging some of the 6.6.4 changes

This commit is contained in:
JT Smith 2005-07-13 02:10:16 +00:00
parent 88d751b64e
commit 85f8ef7f43
8 changed files with 38 additions and 34 deletions

View file

@ -13,15 +13,18 @@ package WebGUI::UploadsAccessHandler;
our $webguiRoot;
BEGIN {
use Apache::ServerUtil;
my $s = Apache->server;
my $s;
if ($mod_perl::VERSION >= 1.999023) {
$s = Apache2::ServerUtil->server;
} else {
$s = Apache->server;
}
$webguiRoot = $s->dir_config('WebguiRoot');
unshift (@INC, $webguiRoot."/lib");
}
print "Starting WebGUI Uploads Access Handler\n";
use Apache::RequestUtil;
use strict;
use CGI::Util qw/escape/;
use WebGUI::Grouping;
@ -29,7 +32,18 @@ use WebGUI::Session;
use WebGUI::URL;
sub handler {
my $r = Apache->request;
my $r;
my $ok;
my $notfound;
if ($mod_perl::VERSION >= 1.999023) {
$r = Apache2::RequestUtil->request;
$ok = Apache2::Const::OK();
$notfound = Apache2::Const::NOT_FOUND();
} else {
$r = Apache->request;
$ok = Apache::OK();
$notfound = Apache::NOT_FOUND();
}
if (-e $r->filename) {
my $path = $r->filename;
$path =~ s/^(\/.*\/).*$/$1/;
@ -47,14 +61,14 @@ sub handler {
$cookie =~ s/wgSession\=(.*)/$1/;
$cookie = WebGUI::URL::unescape($cookie);
WebGUI::Session::refreshSessionVars($cookie);
return Apache::OK if ($session{user}{userId} eq $privs[0] || WebGUI::Grouping::isInGroup($privs[1]) || WebGUI::Grouping::isInGroup($privs[2]));
return $ok if ($session{user}{userId} eq $privs[0] || WebGUI::Grouping::isInGroup($privs[1]) || WebGUI::Grouping::isInGroup($privs[2]));
WebGUI::Session::close();
return 401;
}
}
return Apache::OK;
return $ok;
} else {
return Apache::NOT_FOUND;
return $notfound;
}
}