diff options
author | Angelo Naselli <anaselli@linux.it> | 2015-03-16 18:16:50 +0100 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2015-03-16 18:16:50 +0100 |
commit | fc9772f1f03684e8dab50ff77d2c46c5e0309c7b (patch) | |
tree | 375b76cf80e5d816eb48a4badf3bb949199ef220 /lib/AdminPanel/Shared | |
parent | 825922057a21a9b09c60edf4b44535d7fd49926d (diff) | |
download | manatools-fc9772f1f03684e8dab50ff77d2c46c5e0309c7b.tar manatools-fc9772f1f03684e8dab50ff77d2c46c5e0309c7b.tar.gz manatools-fc9772f1f03684e8dab50ff77d2c46c5e0309c7b.tar.bz2 manatools-fc9772f1f03684e8dab50ff77d2c46c5e0309c7b.tar.xz manatools-fc9772f1f03684e8dab50ff77d2c46c5e0309c7b.zip |
Moved to namespace to ManaTools
Diffstat (limited to 'lib/AdminPanel/Shared')
-rw-r--r-- | lib/AdminPanel/Shared/Firewall.pm | 2 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/GUI.pm | 22 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/Hosts.pm | 2 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/JournalCtl.pm | 10 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/Locales.pm | 40 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/Proxy.pm | 12 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/RunProgram.pm | 16 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/Services.pm | 36 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/Shorewall.pm | 42 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/TimeZone.pm | 20 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/Users.pm | 38 |
11 files changed, 120 insertions, 120 deletions
diff --git a/lib/AdminPanel/Shared/Firewall.pm b/lib/AdminPanel/Shared/Firewall.pm index 50e8a4f7..f5a6c45c 100644 --- a/lib/AdminPanel/Shared/Firewall.pm +++ b/lib/AdminPanel/Shared/Firewall.pm @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #***************************************************************************** -package AdminPanel::Shared::Firewall; +package ManaTools::Shared::Firewall; use Moose; use diagnostics; diff --git a/lib/AdminPanel/Shared/GUI.pm b/lib/AdminPanel/Shared/GUI.pm index 9a67231b..6c6144d5 100644 --- a/lib/AdminPanel/Shared/GUI.pm +++ b/lib/AdminPanel/Shared/GUI.pm @@ -1,5 +1,5 @@ # vim: set et ts=4 sw=4: -package AdminPanel::Shared::GUI; +package ManaTools::Shared::GUI; #============================================================= -*-perl-*- =head1 NAME @@ -8,7 +8,7 @@ Shared::GUI - Shared graphic routines =head1 SYNOPSIS - my $gui = AdminPanel::Shared::GUI->new(); + my $gui = ManaTools::Shared::GUI->new(); my $yesPressed = $gui->ask_YesOrNo($title, $text); =head1 DESCRIPTION @@ -59,9 +59,9 @@ use Moose; use diagnostics; use yui; -use AdminPanel::Shared qw(pathList2hash); +use ManaTools::Shared qw(pathList2hash); -use AdminPanel::Shared::Locales; +use ManaTools::Shared::Locales; has 'loc' => ( is => 'rw', @@ -73,7 +73,7 @@ sub _localeInitialize { my $self = shift(); # TODO fix domain binding for translation - $self->loc(AdminPanel::Shared::Locales->new(domain_name => 'libDrakX-standalone') ); + $self->loc(ManaTools::Shared::Locales->new(domain_name => 'libDrakX-standalone') ); # TODO if we want to give the opportunity to test locally add dir_name => 'path' } @@ -548,8 +548,8 @@ list is an array of hashes like this text => "descriptive text" val => reference to the boolean value } - - + + =head3 OUTPUT undef: if Cancel button has been pressed @@ -587,11 +587,11 @@ sub ask_multiple_fromList { my $layout = $factory->createVBox($dlg); my @ckbox_array = (); - + for my $item(@{$info->{list}}) { my $ckbox = $factory->createCheckBox( - $factory->createLeft($factory->createHBox($layout)), + $factory->createLeft($factory->createHBox($layout)), $item->{text}, ${$item->{val}} ); @@ -648,7 +648,7 @@ sub ask_multiple_fromList { #restore old application title yui::YUI::app()->setApplicationTitle($appTitle); - + return $selections; } @@ -905,7 +905,7 @@ sub ask_fromTreeList { my $list2Convert; $list2Convert->{paths} = $info->{list}; $list2Convert->{separator} = $info->{item_separator} if $info->{item_separator}; - $treeInfo->{hash_tree} = AdminPanel::Shared::pathList2hash($list2Convert); + $treeInfo->{hash_tree} = ManaTools::Shared::pathList2hash($list2Convert); $self->hashTreeToYItemCollection($treeInfo); $treeWidget->addItems($treeInfo->{collection}); diff --git a/lib/AdminPanel/Shared/Hosts.pm b/lib/AdminPanel/Shared/Hosts.pm index def2b7c9..d3b7fc9c 100644 --- a/lib/AdminPanel/Shared/Hosts.pm +++ b/lib/AdminPanel/Shared/Hosts.pm @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #***************************************************************************** -package AdminPanel::Shared::Hosts; +package ManaTools::Shared::Hosts; use Moose; use diagnostics; diff --git a/lib/AdminPanel/Shared/JournalCtl.pm b/lib/AdminPanel/Shared/JournalCtl.pm index 5d11bcf7..11945384 100644 --- a/lib/AdminPanel/Shared/JournalCtl.pm +++ b/lib/AdminPanel/Shared/JournalCtl.pm @@ -1,27 +1,27 @@ # vim: set et ts=4 sw=4: -package AdminPanel::Shared::JournalCtl; +package ManaTools::Shared::JournalCtl; #============================================================= -*-perl-*- =head1 NAME -AdminPanel::Shared::JournalCtl - journalctl perl wrapper +ManaTools::Shared::JournalCtl - journalctl perl wrapper =head1 SYNOPSIS - my $log = AdminPanel::Shared::JournalCtl->new(); + my $log = ManaTools::Shared::JournalCtl->new(); my @log_content = $log->getLog(); =head1 DESCRIPTION -This module wraps journalctl allowing some running options and provides the +This module wraps journalctl allowing some running options and provides the output log content. =head1 SUPPORT You can find documentation for this module with the perldoc command: -perldoc AdminPanel::Shared::JournalCtl +perldoc ManaTools::Shared::JournalCtl =head1 AUTHOR diff --git a/lib/AdminPanel/Shared/Locales.pm b/lib/AdminPanel/Shared/Locales.pm index a1186add..ec546141 100644 --- a/lib/AdminPanel/Shared/Locales.pm +++ b/lib/AdminPanel/Shared/Locales.pm @@ -1,16 +1,16 @@ # vim: set et ts=4 sw=4: -package AdminPanel::Shared::Locales; +package ManaTools::Shared::Locales; #============================================================= -*-perl-*- =head1 NAME -AdminPanel::Shared::Locales - Class to manage locales +ManaTools::Shared::Locales - Class to manage locales =head1 SYNOPSIS -use AdminPanel::Shared::Locales; +use ManaTools::Shared::Locales; -my $obj = AdminPanel::Shared::Locales->new(domain_name => 'this_domain'); +my $obj = ManaTools::Shared::Locales->new(domain_name => 'this_domain'); print $obj->N("test string %d", 1) . "\n"; @@ -23,7 +23,7 @@ This class wraps Locale::gettext to manage localization You can find documentation for this module with the perldoc command: -perldoc AdminPanel::Shared::Locales +perldoc ManaTools::Shared::Locales =head1 SEE ALSO @@ -68,7 +68,7 @@ use Text::Iconv; =head3 INPUT - hash ref containing + hash ref containing domain_name: gettext domain name (default mpan) dir_name: gettext optional catalog directory (default undef) codeset: gettext codeset (default UTF8) @@ -88,16 +88,16 @@ has 'domain_name' => ( has 'dir_name' => ( is => 'rw', - default => undef, + default => undef, ); has 'codeset' => ( is => 'rw', - default => 'UTF8', + default => 'UTF8', ); has 'domain' => ( - is => 'rw', + is => 'rw', init_arg => undef, ); @@ -153,9 +153,9 @@ sub BUILD { =cut #============================================================= -sub P { +sub P { my ($self, $s_singular, $s_plural, $nb, @para) = @_; - + sprintf($self->domain->nget($s_singular, $s_plural, $nb), @para); } @@ -167,7 +167,7 @@ sub P { $self : this object $s: msg id - + =head3 OUTPUT locale string @@ -180,8 +180,8 @@ sub P { #============================================================= sub N { - my ($self, $s, @para) = @_; - + my ($self, $s, @para) = @_; + sprintf($self->domain->get($s), @para); } @@ -193,7 +193,7 @@ sub N { $self : this object $s: msg id - + =head3 OUTPUT msg id @@ -207,8 +207,8 @@ sub N { #============================================================= sub N_ { my $self = shift; - - $_[0]; + + $_[0]; } @@ -238,7 +238,7 @@ sub from_utf8 { my $converter = Text::Iconv->new("utf-8", undef); my $converted = $converter->convert($s); - return $converted; + return $converted; } @@ -262,13 +262,13 @@ sub from_utf8 { =cut #============================================================= -sub to_utf8 { +sub to_utf8 { my ($self, $s) = @_; my $converter = Text::Iconv->new(undef, "utf-8"); my $converted = $converter->convert($s); - return $converted; + return $converted; } diff --git a/lib/AdminPanel/Shared/Proxy.pm b/lib/AdminPanel/Shared/Proxy.pm index 18360c80..6accbb77 100644 --- a/lib/AdminPanel/Shared/Proxy.pm +++ b/lib/AdminPanel/Shared/Proxy.pm @@ -1,23 +1,23 @@ # vim: set et ts=4 sw=4: #***************************************************************************** -# +# # Copyright (c) 2013-2015 Matteo Pasotti <matteo.pasotti@gmail.com> -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2, as # published by the Free Software Foundation. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# +# #***************************************************************************** -package AdminPanel::Shared::Proxy; +package ManaTools::Shared::Proxy; use Moose; use diagnostics; diff --git a/lib/AdminPanel/Shared/RunProgram.pm b/lib/AdminPanel/Shared/RunProgram.pm index 4355fb9f..042f5594 100644 --- a/lib/AdminPanel/Shared/RunProgram.pm +++ b/lib/AdminPanel/Shared/RunProgram.pm @@ -1,4 +1,4 @@ -package AdminPanel::Shared::RunProgram; +package ManaTools::Shared::RunProgram; use strict; use MDK::Common; @@ -21,7 +21,7 @@ our @EXPORT_OK = qw( =head1 SYNOPSYS -B<rAdminPanel::Shared::RunProgram> enables to: +B<rManaTools::Shared::RunProgram> enables to: =over 4 @@ -192,9 +192,9 @@ eg: =over 4 -=item * C<< AdminPanel::Shared::RunProgram::raw({ root => $::prefix, sensitive_arguments => 1 }, "echo -e $user->{password} | cryptsetup luksFormat $device"); >> +=item * C<< ManaTools::Shared::RunProgram::raw({ root => $::prefix, sensitive_arguments => 1 }, "echo -e $user->{password} | cryptsetup luksFormat $device"); >> -=item * C<< AdminPanel::Shared::RunProgram::raw({ detach => 1 }, '/etc/rc.d/init.d/dm', '>', '/dev/null', '2>', '/dev/null', 'restart'); >> +=item * C<< ManaTools::Shared::RunProgram::raw({ detach => 1 }, '/etc/rc.d/init.d/dm', '>', '/dev/null', '2>', '/dev/null', 'restart'); >> =back @@ -308,15 +308,15 @@ sub raw { if ($stderr && $stderr eq 'STDERR') { } elsif ($stderr) { $stderr_mode =~ s/2//; - open STDERR, "$stderr_mode $stderr" or _die_exit("AdminPanel::Shared::RunProgram cannot output in $stderr (mode `$stderr_mode')"); + open STDERR, "$stderr_mode $stderr" or _die_exit("ManaTools::Shared::RunProgram cannot output in $stderr (mode `$stderr_mode')"); } elsif ($::isInstall) { - open STDERR, ">> /tmp/ddebug.log" or open STDOUT, ">> /dev/tty7" or _die_exit("AdminPanel::Shared::RunProgram cannot log, give me access to /tmp/ddebug.log"); + open STDERR, ">> /tmp/ddebug.log" or open STDOUT, ">> /dev/tty7" or _die_exit("ManaTools::Shared::RunProgram cannot log, give me access to /tmp/ddebug.log"); } if ($stdout && $stdout eq 'STDOUT') { } elsif ($stdout) { - open STDOUT, "$stdout_mode $stdout" or _die_exit("AdminPanel::Shared::RunProgram cannot output in $stdout (mode `$stdout_mode')"); + open STDOUT, "$stdout_mode $stdout" or _die_exit("ManaTools::Shared::RunProgram cannot output in $stdout (mode `$stdout_mode')"); } elsif ($::isInstall) { - open STDOUT, ">> /tmp/ddebug.log" or open STDOUT, ">> /dev/tty7" or _die_exit("AdminPanel::Shared::RunProgram cannot log, give me access to /tmp/ddebug.log"); + open STDOUT, ">> /tmp/ddebug.log" or open STDOUT, ">> /dev/tty7" or _die_exit("ManaTools::Shared::RunProgram cannot log, give me access to /tmp/ddebug.log"); } $root and chroot $root; diff --git a/lib/AdminPanel/Shared/Services.pm b/lib/AdminPanel/Shared/Services.pm index b53ad925..abef8c31 100644 --- a/lib/AdminPanel/Shared/Services.pm +++ b/lib/AdminPanel/Shared/Services.pm @@ -1,16 +1,16 @@ # vim: set et ts=4 sw=4: -package AdminPanel::Shared::Services; +package ManaTools::Shared::Services; #============================================================= -*-perl-*- =head1 NAME -AdminPanel::Shared::Services - shares the API to manage services +ManaTools::Shared::Services - shares the API to manage services =head1 SYNOPSIS -use AdminPanel::Shared::Services; +use ManaTools::Shared::Services; -my $serv = AdminPanel::Shared::Services->new(); +my $serv = ManaTools::Shared::Services->new(); my ($l, $on_services) = $serv->services(); @@ -25,11 +25,11 @@ my ($l, $on_services) = $serv->services(); You can find documentation for this module with the perldoc command: -perldoc AdminPanel::Shared::Services +perldoc ManaTools::Shared::Services =head1 SEE ALSO -AdminPanel::Shared +ManaTools::Shared =head1 AUTHOR @@ -64,11 +64,11 @@ use Net::DBus; use Net::DBus::Annotation qw(:auth); use File::Basename; -use AdminPanel::Shared::Locales; +use ManaTools::Shared::Locales; use MDK::Common::Func qw(find); use MDK::Common::File; use MDK::Common::DataStructure qw(member); -use AdminPanel::Shared::RunProgram qw(rooted); +use ManaTools::Shared::RunProgram qw(rooted); has 'loc' => ( is => 'rw', @@ -81,7 +81,7 @@ sub _localeInitialize { my $self = shift(); # TODO fix domain binding for translation - $self->loc(AdminPanel::Shared::Locales->new(domain_name => 'libDrakX') ); + $self->loc(ManaTools::Shared::Locales->new(domain_name => 'libDrakX') ); # TODO if we want to give the opportunity to test locally add dir_name => 'path' } @@ -374,7 +374,7 @@ sub set_service { if (MDK::Common::DataStructure::member($service, @xinetd_services)) { $ENV{PATH} = "/usr/bin:/usr/sbin"; - AdminPanel::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service); + ManaTools::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service); } elsif ($self->_running_systemd() || $self->_has_systemd()) { $service = $service . ".service"; my $dbus_object = $self->dbus_systemd1_object; @@ -389,11 +389,11 @@ sub set_service { } else { my $script = "/etc/rc.d/init.d/$service"; $ENV{PATH} = "/usr/bin:/usr/sbin"; - AdminPanel::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service); + ManaTools::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service); #- FIXME: handle services with no chkconfig line and with no Default-Start levels in LSB header if ($enable && MDK::Common::File::cat_("$script") =~ /^#\s+chkconfig:\s+-/m) { $ENV{PATH} = "/usr/bin:/usr/sbin"; - AdminPanel::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", "--level", "35", $service, "on"); + ManaTools::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", "--level", "35", $service, "on"); } } } @@ -415,7 +415,7 @@ sub _run_action { $self->_systemd_services(1); } else { $ENV{PATH} = "/usr/bin:/usr/sbin:/etc/rc.d/init.d/"; - AdminPanel::Shared::RunProgram::rooted("", "/etc/rc.d/init.d/$service", $action); + ManaTools::Shared::RunProgram::rooted("", "/etc/rc.d/init.d/$service", $action); } } @@ -423,14 +423,14 @@ sub _running_systemd { my $self = shift; $ENV{PATH} = "/usr/bin:/usr/sbin"; - AdminPanel::Shared::RunProgram::rooted("", '/usr/bin/mountpoint', '-q', '/sys/fs/cgroup/systemd'); + ManaTools::Shared::RunProgram::rooted("", '/usr/bin/mountpoint', '-q', '/sys/fs/cgroup/systemd'); } sub _has_systemd { my $self = shift; $ENV{PATH} = "/usr/bin:/usr/sbin"; - AdminPanel::Shared::RunProgram::rooted("", '/usr/bin/rpm', '-q', 'systemd'); + ManaTools::Shared::RunProgram::rooted("", '/usr/bin/rpm', '-q', 'systemd'); } #============================================================= @@ -459,7 +459,7 @@ sub xinetd_services { if ($ser_info && $ser_info->{enabled} eq "1") { local $ENV{LANGUAGE} = 'C'; $ENV{PATH} = "/usr/bin:/usr/sbin"; - foreach (AdminPanel::Shared::RunProgram::rooted_get_stdout("", '/usr/sbin/chkconfig', '--list', '--type', 'xinetd')) { + foreach (ManaTools::Shared::RunProgram::rooted_get_stdout("", '/usr/sbin/chkconfig', '--list', '--type', 'xinetd')) { if (my ($xinetd_name, $on_off) = m!^\t(\S+):\s*(on|off)!) { push @xinetd_services, [ $xinetd_name, $on_off eq 'on' ]; } @@ -530,7 +530,7 @@ sub _legacy_services { if (!$::isInstall) { $runlevel = (split " ", `/sbin/runlevel`)[1]; } - foreach (AdminPanel::Shared::RunProgram::rooted_get_stdout("", '/sbin/chkconfig', '--list', '--type', 'sysv')) { + foreach (ManaTools::Shared::RunProgram::rooted_get_stdout("", '/sbin/chkconfig', '--list', '--type', 'sysv')) { if (my ($name, $l) = m!^(\S+)\s+(0:(on|off).*)!) { # If we expect to use systemd (i.e. installer) only show those # sysvinit scripts which are not masked by a native systemd unit. @@ -767,7 +767,7 @@ sub is_service_running { $out = $ser_info->{active_state} eq 'active' if $ser_info->{active_state}; } else { $ENV{PATH} = "/usr/bin:/usr/sbin"; - $out = AdminPanel::Shared::RunProgram::rooted("", '/usr/sbin/service', $service, 'status'); + $out = ManaTools::Shared::RunProgram::rooted("", '/usr/sbin/service', $service, 'status'); } return $out; } diff --git a/lib/AdminPanel/Shared/Shorewall.pm b/lib/AdminPanel/Shared/Shorewall.pm index 0cd8ce23..f82c542c 100644 --- a/lib/AdminPanel/Shared/Shorewall.pm +++ b/lib/AdminPanel/Shared/Shorewall.pm @@ -1,9 +1,9 @@ -package AdminPanel::Shared::Shorewall; # $Id: shorewall.pm 254244 2009-03-18 22:54:32Z eugeni $ +package ManaTools::Shared::Shorewall; # $Id: shorewall.pm 254244 2009-03-18 22:54:32Z eugeni $ use detect_devices; use network::network; -use AdminPanel::Shared::RunProgram; -use AdminPanel::Shared::Services; +use ManaTools::Shared::RunProgram; +use ManaTools::Shared::Services; use MDK::Common::Func qw(if_ partition map_each); use MDK::Common::File qw(cat_ substInFile output_with_perm); use MDK::Common::Various qw(to_bool); @@ -96,7 +96,7 @@ sub read_ { $ver = $o_ver if $o_ver; #- read old rules file if config is not moved to rules.drakx yet my @rules = get_config_file(-f "$::prefix${shorewall_root}${ver}/rules.drakx" ? 'rules.drakx' : 'rules', $ver); - my $services = AdminPanel::Shared::Services->new(); + my $services = ManaTools::Shared::Services->new(); my %conf = (disabled => !$services->starts_on_boot("shorewall${ver}"), version => $ver, ports => join(' ', map { @@ -113,18 +113,18 @@ sub read_ { my @policy = get_config_file('policy', $ver); $conf{log_net_drop} = @policy ? (any { $_->[0] eq 'net' && $_->[1] eq 'all' && $_->[2] eq 'DROP' && $_->[3] } @policy) : 1; - + return \%conf; - - # get_zones has been moved to AdminPanel::Module::Firewall cause it requires + + # get_zones has been moved to ManaTools::Module::Firewall cause it requires # user interaction thus it should be logically separated by shorewall # get_zones(\%conf); # get_config_file('zones', $ver) && \%conf; # consequently, to read shorewall conf # you have to do something like this now (within Module::Firewall) - # my $conf = AdminPanel::Shared::Shorewall::read_(); + # my $conf = ManaTools::Shared::Shorewall::read_(); # OPTIONAL: my $self->get_zones(\$conf) - # my $shorewall = AdminPanel::Shared::Shorewall::get_config_file('zones', '') && $conf; + # my $shorewall = ManaTools::Shared::Shorewall::get_config_file('zones', '') && $conf; } sub ports_by_proto { @@ -144,7 +144,7 @@ sub ports_by_proto { =head3 INPUT $conf: HASH, contains the configuration to write - + $action: Str, possible values are "keep" or "drop" =head3 OUTPUT @@ -159,12 +159,12 @@ the proper files. =head3 NOTES -if write_ is called without the $action parameter it can return 0 -(i.e. user interaction requested) when the firewall configuration +if write_ is called without the $action parameter it can return 0 +(i.e. user interaction requested) when the firewall configuration has been manually changed. -In that case the developer will have to handle this request by providing -two choices within the domain (keep | drop) and then recall write_ with +In that case the developer will have to handle this request by providing +two choices within the domain (keep | drop) and then recall write_ with the choosen behaviour. =cut @@ -181,7 +181,7 @@ sub write_ { my ($include_drakx, $other_rules) = partition { $_ eq "INCLUDE\trules.drakx\n" } grep { !/^(#|SECTION)/ } cat_("$::prefix${shorewall_root}${ver}/rules"); #- warn if the config is already in rules.drakx and additionnal rules are configured if (!is_empty_array_ref($include_drakx) && !is_empty_array_ref($other_rules)) { - if(!defined($action) || AdminPanel::Shared::trim($action) eq "") + if(!defined($action) || ManaTools::Shared::trim($action) eq "") { return 0; # user interaction requested } @@ -197,7 +197,7 @@ sub write_ { my ($zone, $interface) = @_; [ $zone, $interface, 'detect', if_(detect_devices::is_bridge_interface($interface), 'bridge') ]; }; - + set_config_file('zones', $ver, if_($has_loc_zone, [ 'loc', 'ipv' . ($ver || '4') ]), [ 'net', 'ipv' . ($ver || '4') ], @@ -235,7 +235,7 @@ sub write_ { )); set_config_file('masq', $ver, if_(exists $conf->{masq}, [ $conf->{masq}{net_interface}, $conf->{masq}{subnet} ])); - my $services = AdminPanel::Shared::Services->new(); + my $services = ManaTools::Shared::Services->new(); if ($conf->{disabled}) { $services->disable('shorewall', $::isInstall); run_program::rooted($::prefix, '/sbin/shorewall', 'clear') unless $::isInstall; @@ -259,12 +259,12 @@ sub set_redirected_ports { sub update_interfaces_list { my ($o_intf) = @_; if (!$o_intf || !member($o_intf, map { $_->[1] } get_config_file('interfaces'))) { - my $shorewall = AdminPanel::Shared::Shorewall::read_(); - $shorewall && !$shorewall->{disabled} and AdminPanel::Shared::Shorewall::write_($shorewall); + my $shorewall = ManaTools::Shared::Shorewall::read_(); + $shorewall && !$shorewall->{disabled} and ManaTools::Shared::Shorewall::write_($shorewall); } if (!$o_intf || !member($o_intf, map { $_->[1] } get_config_file('interfaces', 6))) { - my $shorewall6 = AdminPanel::Shared::Shorewall::read_(undef, 6); - $shorewall6 && !$shorewall6->{disabled} and AdminPanel::Shared::Shorewall::write_($shorewall6); + my $shorewall6 = ManaTools::Shared::Shorewall::read_(undef, 6); + $shorewall6 && !$shorewall6->{disabled} and ManaTools::Shared::Shorewall::write_($shorewall6); } } diff --git a/lib/AdminPanel/Shared/TimeZone.pm b/lib/AdminPanel/Shared/TimeZone.pm index 47a29af1..efb49a29 100644 --- a/lib/AdminPanel/Shared/TimeZone.pm +++ b/lib/AdminPanel/Shared/TimeZone.pm @@ -1,15 +1,15 @@ # vim: set et ts=4 sw=4: -package AdminPanel::Shared::TimeZone; +package ManaTools::Shared::TimeZone; #============================================================= -*-perl-*- =head1 NAME -AdminPanel::Shared::TimeZone - module to manage TimeZone settings +ManaTools::Shared::TimeZone - module to manage TimeZone settings =head1 SYNOPSIS - my $tz = AdminPanel::Shared::TimeZone->new(); + my $tz = ManaTools::Shared::TimeZone->new(); =head1 DESCRIPTION @@ -20,7 +20,7 @@ This module allows to manage time zone settings. You can find documentation for this module with the perldoc command: -perldoc AdminPanel::Shared::TimeZone +perldoc ManaTools::Shared::TimeZone =head1 AUTHOR @@ -57,8 +57,8 @@ use Moose; use DateTime::TimeZone; use Net::DBus; -use AdminPanel::Shared::Locales; -use AdminPanel::Shared::Services; +use ManaTools::Shared::Locales; +use ManaTools::Shared::Services; use MDK::Common::File qw(cat_ output_p substInFile); use MDK::Common::Func qw(find if_); @@ -191,7 +191,7 @@ has 'sh_services' => ( sub _SharedServicesInitialize { my $self = shift(); - $self->sh_services(AdminPanel::Shared::Services->new() ); + $self->sh_services(ManaTools::Shared::Services->new() ); } @@ -250,7 +250,7 @@ sub _localeInitialize { my $self = shift; # TODO fix domain binding for translation - $self->loc(AdminPanel::Shared::Locales->new(domain_name => 'libDrakX') ); + $self->loc(ManaTools::Shared::Locales->new(domain_name => 'libDrakX') ); # TODO if we want to give the opportunity to test locally add dir_name => 'path' } @@ -732,7 +732,7 @@ sub setNTPServer { # TODO is that valid for any ntp program? adding ntp_service_name parameter my $ntpd = $self->ntp_program . 'd'; - AdminPanel::Shared::disable_x_screensaver(); + ManaTools::Shared::disable_x_screensaver(); if ($self->isNTPRunning()) { $self->sh_services->stopService($ntpd); } @@ -766,7 +766,7 @@ sub setNTPServer { $self->sh_services->startService($ntpd); } - AdminPanel::Shared::enable_x_screensaver(); + ManaTools::Shared::enable_x_screensaver(); } #============================================================= diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm index dd759eee..83c6061c 100644 --- a/lib/AdminPanel/Shared/Users.pm +++ b/lib/AdminPanel/Shared/Users.pm @@ -1,14 +1,14 @@ # vim: set et ts=4 sw=4: -package AdminPanel::Shared::Users; +package ManaTools::Shared::Users; #============================================================= -*-perl-*- =head1 NAME -AdminPanel::Shared::Users - backend to manage users +ManaTools::Shared::Users - backend to manage users =head1 SYNOPSIS - my $userBackEnd = AdminPanel::Shared::Users->new(); + my $userBackEnd = ManaTools::Shared::Users->new(); my $userInfo = $userManager->getUserInfo('username'); =head1 DESCRIPTION @@ -20,7 +20,7 @@ This module gives a low level access to the system user management it uses libUS You can find documentation for this module with the perldoc command: -perldoc AdminPanel::Shared::Users +perldoc ManaTools::Shared::Users =head1 SEE ALSO @@ -66,8 +66,8 @@ use USER; use English; use POSIX qw/ceil/; -use AdminPanel::Shared::Locales; -use AdminPanel::Shared; +use ManaTools::Shared::Locales; +use ManaTools::Shared; #============================================================= @@ -119,7 +119,7 @@ sub _localeInitialize { my $self = shift(); # TODO fix domain binding for translation - $self->loc(AdminPanel::Shared::Locales->new(domain_name => 'userdrake') ); + $self->loc(ManaTools::Shared::Locales->new(domain_name => 'userdrake') ); # TODO if we want to give the opportunity to test locally add dir_name => 'path' } @@ -275,7 +275,7 @@ sub face2png { =head3 DESCRIPTION - Retrieves the list of icon name from facesdir() + Retrieves the list of icon name from facesdir() =cut @@ -304,7 +304,7 @@ sub facenames { =head3 DESCRIPTION - Add a $user named icon to $self->user_face_dir. It just copies + Add a $user named icon to $self->user_face_dir. It just copies $icon to $self->user_face_dir, naming it as $user =cut @@ -461,7 +461,7 @@ sub updateOrDelUserInGroup { my $groups = $self->ctx->GroupsEnumerateFull; foreach my $g (@$groups) { my $members = $g->MemberName(1, 0); - if (AdminPanel::Shared::inArray($name, $members)) { + if (ManaTools::Shared::inArray($name, $members)) { eval { $g->MemberName($name, 2) }; eval { $self->ctx->GroupModify($g) }; } @@ -801,14 +801,14 @@ sub modifyGroup { my $ugid = $uEnt->Gid($self->USER_GetValue); my $m = $self->ctx->EnumerateUsersByGroup($orig_groupname); if (MDK::Common::DataStructure::member($user, @{$members})) { - if (!AdminPanel::Shared::inArray($user, $m)) { + if (!ManaTools::Shared::inArray($user, $m)) { if ($ugid != $gid) { eval { $groupEnt->MemberName($user, 1) }; } } } else { - if (AdminPanel::Shared::inArray($user, $m)) { + if (ManaTools::Shared::inArray($user, $m)) { if ($ugid == $gid) { return { status => 0, @@ -1302,13 +1302,13 @@ sub modifyUser { my $ugid = $gEnt->Gid($self->USER_GetValue); my $m = $gEnt->MemberName(1,0); if (MDK::Common::DataStructure::member($group, @$members)) { - if (!AdminPanel::Shared::inArray($username, $m) && $userInfo->{gid} != $ugid) { + if (!ManaTools::Shared::inArray($username, $m) && $userInfo->{gid} != $ugid) { eval { $gEnt->MemberName($username, 1) }; $self->ctx->GroupModify($gEnt); } } else { - if (AdminPanel::Shared::inArray($username, $m)) { + if (ManaTools::Shared::inArray($username, $m)) { eval { $gEnt->MemberName($username, 2) }; $self->ctx->GroupModify($gEnt); } @@ -1463,16 +1463,16 @@ sub GetFaceIcon { my $i; my $current_icon; # remove shortcut "&" from label - $name =~ s/&// if ($name); + $name =~ s/&// if ($name); my $user_icon = $self->user_face_dir . $name . ".png" if ($name); if ($name) { $user_icon = $self->face2png($name) unless(-e $user_icon); } if ($name && -e $user_icon) { - my $current_md5 = AdminPanel::Shared::md5sum($user_icon); + my $current_md5 = ManaTools::Shared::md5sum($user_icon); my $found = 0; for ($i = 0; $i < scalar(@$icons); $i++) { - if (AdminPanel::Shared::md5sum($self->face2png($icons->[$i])) eq $current_md5) { + if (ManaTools::Shared::md5sum($self->face2png($icons->[$i])) eq $current_md5) { $found = 1; last; } @@ -1518,9 +1518,9 @@ sub GetFaceIcon { #============================================================= sub strongPassword { my ($self, $passwd, $threshold) = @_; - + return 0 if !$passwd; - + my $pwdm = $threshold ? Data::Password::Meter->new($threshold) : Data::Password::Meter->new(); # Check a password |