Commit 9aa23b4d authored by Xavier Guimard's avatar Xavier Guimard

Zeroconf + Serializer (#877, #LEMONLDAP-903)

I really don't understand how it has worked before...
parent d2b8f64a
......@@ -85,7 +85,7 @@
},
"authentication" : "Demo",
"cfgAuthor" : "The LemonLDAP::NG team",
"cfgNum" : "1",
"cfgNum" : 1,
"cookieName" : "lemonldap",
"demoExportedVars" : {
"cn" : "cn",
......
......@@ -108,6 +108,7 @@ sub unserialize {
$conf->{$k} = $v;
}
}
return $conf;
}
sub oldUnserialize {
......
......@@ -77,7 +77,7 @@ has QUERY_STRING => (
sub params {
my ( $self, $key, $value ) = @_;
return $self->_params unless ($key);
$self->_params->{$key} = $value if ($value);
$self->_params->{$key} = $value if ( defined $value );
return $self->_params->{$key};
}
......@@ -113,7 +113,7 @@ has CONTENT_LENGTH => (
$self->_psgiInput->read( $self->{body},
$self->{CONTENT_LENGTH}, 0 );
}
utf8::upgrade($self->{body});
utf8::upgrade( $self->{body} );
}
}
);
......
......@@ -340,12 +340,12 @@ sub buildZeroConf {
$jsonEnc->pretty(1);
printf STDERR $format, $self->firstLmConfFile;
open( F, '>', $self->firstLmConfFile ) or die($!);
print F $jsonEnc->encode(
Lemonldap::NG::Manager::Conf::Zero::zeroConf(
my $tmp = Lemonldap::NG::Manager::Conf::Zero::zeroConf(
'__DNSDOMAIN__', '__SESSIONDIR__',
'__PSESSIONDIR__', '__NOTIFICATIONDIR__'
)
);
);
$tmp->{cfgNum} = 1;
print F $jsonEnc->encode($tmp);
close F;
print STDERR "done\n";
}
......
......@@ -116,7 +116,9 @@ sub getConfKey {
sub getConfByNum {
my ( $self, $cfgNum, @args ) = @_;
unless ( $self->currentConf and $cfgNum == $self->currentConf->{cfgNum} ) {
unless ( %{ $self->currentConf }
and $cfgNum == $self->currentConf->{cfgNum} )
{
my $tmp;
if ( $cfgNum == 0 ) {
require Lemonldap::NG::Manager::Conf::Zero;
......
......@@ -97,7 +97,7 @@ sub zeroConf {
}
}
},
'cfgNum' => '1',
'cfgNum' => 0,
'globalStorageOptions' => {
'Directory' => $sessionDir,
'generateModule' =>
......
......@@ -11,7 +11,7 @@ use Lemonldap::NG::Common::PSGI::Constants;
has '_confAcc' => ( is => 'rw', isa => 'Lemonldap::NG::Common::Conf' );
has 'configStorage' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
has 'currentConf' =>
( is => 'rw', required => 1, default => sub { { cfgNum => 0 } } );
( is => 'rw', required => 1, default => sub { {} } );
has 'protection' => ( is => 'rw', isa => 'Str', default => 'manager' );
our $VERSION = '1.9.0';
......
......@@ -47,6 +47,9 @@ sub addRoutes {
}
my $conf = $self->confAcc->getConf();
#
# Return unless configuration is available
return 0 unless ($conf);
foreach my $type (@sessionTypes) {
if ( my $tmp =
$self->{ $type . 'Storage' } || $conf->{ $type . 'Storage' } )
......
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