lemonldap-ng/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/AccessLib.pm

38 lines
1.0 KiB
Perl
Raw Normal View History

2017-01-06 13:40:56 +01:00
package Lemonldap::NG::Common::Conf::AccessLib;
2021-01-23 18:57:24 +01:00
use strict;
2016-01-07 13:34:34 +01:00
use utf8;
use Mouse;
use Lemonldap::NG::Common::Conf;
2019-07-02 20:03:40 +02:00
has '_confAcc' => ( is => 'rw', isa => 'Lemonldap::NG::Common::Conf' );
has 'configStorage' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
2016-01-22 17:53:41 +01:00
has 'currentConf' => ( is => 'rw', required => 1, default => sub { {} } );
2019-07-02 20:03:40 +02:00
has 'protection' => ( is => 'rw', isa => 'Str', default => 'manager' );
2019-02-12 18:21:38 +01:00
our $VERSION = '2.1.0';
## @method Lemonldap::NG::Common::Conf confAcc()
# Configuration access object
#
# Return _confAcc property if exists or create it.
#
#@return Lemonldap::NG::Common::Conf object
sub confAcc {
my $self = shift;
return $self->_confAcc if ( $self->_confAcc );
# TODO: pass args and remove this
my $d = `pwd`;
chomp $d;
my $tmp;
unless ( $tmp = Lemonldap::NG::Common::Conf->new( $self->configStorage ) ) {
die "Unable to build Lemonldap::NG::Common::Conf "
. $Lemonldap::NG::Common::Conf::msg;
}
return $self->_confAcc($tmp);
}
1;