Extend Manager protection to Sessions Explorer, and add an override possibility for Sessions Explorer only (#264)

This commit is contained in:
Clément Oudot 2011-01-21 16:45:53 +00:00
parent 7ed205a995
commit 28adb04b4b
2 changed files with 20 additions and 15 deletions

View File

@ -4,7 +4,7 @@ use strict;
use Exporter 'import';
use base qw(Exporter);
our $VERSION = '1.0.0';
our $VERSION = '1.0.2';
# CONSTANTS
@ -20,6 +20,7 @@ use constant CONFSECTION => "configuration";
use constant PORTALSECTION => "portal";
use constant HANDLERSECTION => "handler";
use constant MANAGERSECTION => "manager";
use constant SESSIONSEXPLORERSECTION => "sessionsExplorer";
use constant APPLYSECTION => "apply";
our %EXPORT_TAGS = (
@ -37,6 +38,7 @@ our %EXPORT_TAGS = (
PORTALSECTION
HANDLERSECTION
MANAGERSECTION
SESSIONSEXPLORERSECTION
APPLYSECTION
)
]

View File

@ -24,7 +24,7 @@ use utf8;
our $whatToTrace;
*whatToTrace = \$Lemonldap::NG::Handler::_CGI::whatToTrace;
our $VERSION = '1.0.0';
our $VERSION = '1.0.2';
our @ISA = qw(
Lemonldap::NG::Handler::CGI
@ -37,28 +37,31 @@ our @ISA = qw(
# @return New Lemonldap::NG::Manager::Sessions object
sub new {
my ( $class, $args ) = @_;
my $self = $class->SUPER::new($args)
or $class->abort( 'Unable to start ' . __PACKAGE__,
'See Apache logs for more' );
# Output UTF-8
binmode( STDOUT, ':utf8' );
# Try to get configuration values from global configuration
my $config = Lemonldap::NG::Common::Conf->new( $self->{configStorage} );
unless ($config) {
$self->abort( "Unable to start",
"Configuration not loaded\n" . $Lemonldap::NG::Common::Conf::msg );
my $conf = Lemonldap::NG::Common::Conf->new( $args->{configStorage} )
or Lemonldap::NG::Handler::CGI->abort( 'Unable to get configuration',
$Lemonldap::NG::Common::Conf::msg );
# Configuration from MANAGER section
if ( my $localconf = $conf->getLocalConf(MANAGERSECTION) ) {
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf );
}
# Load parameters from lemonldap-ng.ini.
my $localconf = $config->getLocalConf(MANAGERSECTION);
# Configuration from SESSIONSEXPLORER section
if ( my $localconfse = $conf->getLocalConf(SESSIONSEXPLORERSECTION) ) {
$args->{$_} ||= $localconfse->{$_} foreach ( keys %$localconfse );
}
my $self = $class->SUPER::new($args)
or $class->abort( 'Unable to start ' . __PACKAGE__,
'See Apache logs for more' );
# Local args prepends global args
if ($localconf) {
$self->{$_} = $args->{$_} || $localconf->{$_}
foreach ( keys %$localconf );
}
$self->{$_} = $args->{$_} foreach ( keys %$args );
# Load default skin if no other specified
$self->{managerSkin} ||= 'default';