« blib/lib/Lemonldap/NG/Common/Conf/Backends/MongoDB.pm
↑ Summary
blib/lib/Lemonldap/NG/Common/JWT.pm »
| 1 | package Lemonldap::NG::Common::Conf::AccessLib; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use utf8; | ||
| 5 | use Mouse; | ||
| 6 | |||
| 7 | use Lemonldap::NG::Common::Conf; | ||
| 8 | |||
| 9 | has _confAcc => ( is => 'rw', isa => 'Lemonldap::NG::Common::Conf' ); | ||
| 10 | has configStorage => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); | ||
| 11 | has currentConf => ( is => 'rw', required => 1, default => sub { {} } ); | ||
| 12 | has protection => ( is => 'rw', isa => 'Str', default => 'manager' ); | ||
| 13 | |||
| 14 | our $VERSION = '2.0.11'; | ||
| 15 | |||
| 16 | ## @method Lemonldap::NG::Common::Conf confAcc() | ||
| 17 | # Configuration access object | ||
| 18 | # | ||
| 19 | # Return _confAcc property if exists or create it. | ||
| 20 | # | ||
| 21 | #@return Lemonldap::NG::Common::Conf object | ||
| 22 | sub confAcc { | ||
| 23 | my $self = shift; | ||
| 24 | return $self->_confAcc if ( $self->_confAcc ); | ||
| 25 | |||
| 26 | # TODO: pass args and remove this | ||
| 27 | my $d = `pwd`; | ||
| 28 | chomp $d; | ||
| 29 | my $tmp; | ||
| 30 | unless ( $tmp = Lemonldap::NG::Common::Conf->new( $self->configStorage ) ) { | ||
| 31 | die "Unable to build Lemonldap::NG::Common::Conf " | ||
| 32 | . $Lemonldap::NG::Common::Conf::msg; | ||
| 33 | } | ||
| 34 | return $self->_confAcc($tmp); | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; |