From 5f7348b098482f5574990c0fb746250b8bcb4723 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Fri, 1 Jan 2016 22:14:27 +0100 Subject: Added config dir management --- lib/ManaTools/Module/Users.pm | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'lib/ManaTools') diff --git a/lib/ManaTools/Module/Users.pm b/lib/ManaTools/Module/Users.pm index 81b6108c..9e04a2a5 100644 --- a/lib/ManaTools/Module/Users.pm +++ b/lib/ManaTools/Module/Users.pm @@ -83,8 +83,17 @@ with 'ManaTools::LoggingRole'; has 'configDir' => ( is => 'ro', isa => 'Str', + lazy => 1, + builder => '_configDirBuilder', ); +sub _configDirBuilder { + my $self = shift(); + my $confDir = $self->commandline()->conf_dir() || $self->defaultConfigDir(); + + return $confDir; +} + with 'ManaTools::ConfigDirRole'; has 'moduleName' => ( @@ -180,25 +189,22 @@ sub _SharedUGUIInitialize { } -#============================================================= - -=head1 METHODS - -=cut - -=head2 new - additional parameters - -=head3 config_file +# configuration file name +has 'config_file' => ( + is => 'ro', + isa => 'Str', + lazy => 1, + init_arg => undef, + builder => '_config_fileBuilder', +); - optional parameter to set the configuration file name +sub _config_fileBuilder { + my $self = shift(); + my $confDir = $self->configPathName(); -=cut + return $confDir . "/manauser"; +} -has 'config_file' => ( - is => 'rw', - isa => 'Str', - default => '/etc/sysconfig/manauser', -); #============================================================= @@ -2519,7 +2525,7 @@ sub _manageUsersDialog { my $sysfilter = 1; if (-e $self->config_file) { my $prefs = Config::Auto::parse($self->config_file); - $sysfilter = ($prefs->{FILTER} eq 'true' or $prefs->{FILTER} eq 'true' or $prefs->{FILTER} eq '1'); + $sysfilter = ($prefs->{FILTER} eq 'true' or $prefs->{FILTER} eq 'TRUE' or $prefs->{FILTER} eq '1'); } $self->set_widget(filter_system => $factory->createCheckBox($head_align_left, $self->loc->N("Filter system users"), $sysfilter)); -- cgit v1.2.1