2018-10-03 21:48:57 +02:00
|
|
|
package Lemonldap::NG::Portal::Lib::OverConf;
|
|
|
|
|
2021-01-23 18:57:24 +01:00
|
|
|
use strict;
|
2018-10-03 21:48:57 +02:00
|
|
|
use Mouse::Role;
|
|
|
|
|
|
|
|
# To avoid "tied" destroy, tied configurations are kept here
|
|
|
|
our @overC;
|
|
|
|
|
|
|
|
# Override portal loadPlugin() to use a wrapped configuration
|
|
|
|
sub loadPlugin {
|
2022-10-10 16:16:54 +02:00
|
|
|
my ( $self, $plugin, $over, %args ) = @_;
|
|
|
|
my $obj = $self->loadModule( $plugin, $over, %args );
|
2018-10-03 22:31:28 +02:00
|
|
|
return 0
|
|
|
|
unless ( $obj and $obj = $self->p->findEP( $plugin, $obj ) );
|
|
|
|
return $obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub loadModule {
|
2022-10-10 16:16:54 +02:00
|
|
|
my ( $self, $plugin, $over, %args ) = @_;
|
2018-10-03 21:48:57 +02:00
|
|
|
my $obj;
|
|
|
|
my $nc;
|
|
|
|
if ($over) {
|
|
|
|
require Lemonldap::NG::Common::Conf::Wrapper;
|
|
|
|
tie %$nc, 'Lemonldap::NG::Common::Conf::Wrapper', $self->conf, $over;
|
|
|
|
push @overC, $nc;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$nc = $self->conf;
|
|
|
|
}
|
|
|
|
return 0
|
2022-10-10 16:16:54 +02:00
|
|
|
unless ( $obj = $self->p->loadModule( "$plugin", $nc, %args ) );
|
2018-10-03 21:48:57 +02:00
|
|
|
return $obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|