Commit 2250202f authored by Yadd's avatar Yadd

Manage Zero only in manager (#970)

parent 2118a424
......@@ -71,17 +71,9 @@ sub getConfByNum {
unless ( %{ $self->currentConf }
and $cfgNum == $self->currentConf->{cfgNum} )
{
my $tmp;
if ( $cfgNum == 0 ) {
require Lemonldap::NG::Manager::Conf::Zero;
$tmp = Lemonldap::NG::Manager::Conf::Zero::zeroConf();
}
else {
$tmp =
$self->confAcc->getConf(
{ cfgNum => $cfgNum, raw => 1, noCache => 1, @args } );
return undef unless ( $tmp and ref($tmp) and %$tmp );
}
my $tmp = $self->confAcc->getConf(
{ cfgNum => $cfgNum, raw => 1, noCache => 1, @args } );
return undef unless ( $tmp and ref($tmp) and %$tmp );
$self->currentConf($tmp);
}
return $cfgNum;
......
......@@ -146,12 +146,32 @@ sub prx {
# IV. Upload methods #
######################
# In this section, 3 methods:
# In this section, 4 methods:
# - getConfByNum: override SUPER method to be able to use Zero
# - newConf()
# - newRawConf(): restore a saved conf
# - applyConf(): called by the 2 previous to prevent other servers that a new
# configuration is available
sub getConfByNum {
my ( $self, $cfgNum, @args ) = @_;
unless ( %{ $self->currentConf }
and $cfgNum == $self->currentConf->{cfgNum} )
{
my $tmp;
if ( $cfgNum == 0 ) {
require Lemonldap::NG::Manager::Conf::Zero;
$tmp = Lemonldap::NG::Manager::Conf::Zero::zeroConf();
$self->currentConf($tmp);
}
else {
$tmp = $self->SUPER::getConfByNum( $cfgNum, @args );
return undef unless (defined $tmp);
}
}
return $cfgNum;
}
## @method PSGI-JSON-response newConf($req)
# Call Lemonldap::NG::Manager::Conf::Parser to parse new configuration and store
# it
......
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