When configuration is not correct, Manager must even be launched

This commit is contained in:
Xavier Guimard 2010-09-24 08:41:45 +00:00
parent 6b81b4ab3f
commit 3831981423
2 changed files with 17 additions and 9 deletions

View File

@ -57,7 +57,7 @@ BEGIN {
}
sub Apache::Session::get_key_from_all_sessions {
return 0;
die "This Apache module is not supported by Lemonldap::NG";
}
sub Apache::Session::MySQL::get_key_from_all_sessions {
@ -225,12 +225,6 @@ BEGIN {
}
return \%res;
}
sub Apache::Session::Memcached::get_key_from_all_sessions {
# TODO
die('Apache::Session::Memcached is not supported by Lemonldap::NG');
}
}
1;

View File

@ -31,8 +31,14 @@ sub new {
Lemonldap::NG::Handler::_CGI->init(@_);
Lemonldap::NG::Handler::_CGI->initLocalStorage(@_);
}
$class->abort("Unable to get configuration")
unless Lemonldap::NG::Handler::_CGI->testConf() == OK;
unless ( eval { Lemonldap::NG::Handler::_CGI->testConf() } == OK ) {
if ( $_[0]->{noAbort} ) {
$self->{noConf} = $@;
}
else {
$class->abort( "Unable to get configuration", $@ );
}
}
# Arguments
my @args = splice @_;
@ -83,6 +89,10 @@ sub new {
# @return boolean : true if authentication is good. Exit before else
sub authenticate {
my $self = shift;
$self->abort(
"Can't authenticate because configuration has not been loaded",
$self->{noConf} )
if ( $self->{noConf} );
my %cookies = fetch CGI::Cookie;
my $id;
unless ( $cookies{$cookieName} and $id = $cookies{$cookieName}->value ) {
@ -126,6 +136,10 @@ sub authorize {
# 0 if user isn't granted
sub testUri {
my $self = shift;
$self->abort(
"Can't test URI because configuration has not been loaded",
$self->{noConf} )
if ( $self->{noConf} );
my $uri = shift;
my $host =
( $uri =~ s#^(?:https?://)?([^/]*)/#/# ) ? $1 : $ENV{SERVER_NAME};