Commit 28adb04b authored by Clément OUDOT's avatar Clément OUDOT

Extend Manager protection to Sessions Explorer, and add an override...

Extend Manager protection to Sessions Explorer, and add an override possibility for Sessions Explorer only (#264)
parent 7ed205a9
......@@ -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
)
]
......
......@@ -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 );
}
# Configuration from SESSIONSEXPLORER section
if ( my $localconfse = $conf->getLocalConf(SESSIONSEXPLORERSECTION) ) {
$args->{$_} ||= $localconfse->{$_} foreach ( keys %$localconfse );
}
# Load parameters from lemonldap-ng.ini.
my $localconf = $config->getLocalConf(MANAGERSECTION);
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';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment