From e79394c2354a94566f1e524a7cd2ccd07a62b860 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Tue, 18 Oct 2022 16:14:35 +0200 Subject: [PATCH] synch cli with nodes pandora_enterprise#9500 --- pandora_server/util/pandora_manage.pl | 29 ++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 11beac6d33..c5147faa78 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -6385,8 +6385,10 @@ sub cli_disable_double_auth () { sub cli_user_enable () { my $user_id = @ARGV[2]; - if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { - print_log "[ERROR] This node is configured with centralized mode. To enable a user go to metaconsole. \n\n"; + my $centralized = pandora_get_tconfig_token ($dbh, 'centralized_management', ''); + + if(is_metaconsole($conf) != 1 && $centralized) { + print_log "[ERROR] This node is configured with centralized mode. To create a user go to metaconsole. \n\n"; exit; } @@ -6403,7 +6405,13 @@ sub cli_user_enable () { $user_id = safe_input($user_id); - db_do ($dbh, "UPDATE tusuario SET disabled = '0' WHERE id_user = '$user_id'"); + my $result = db_do ($dbh, "UPDATE tusuario SET disabled = '0' WHERE id_user = '$user_id'"); + + if(is_metaconsole($conf) == 1 && $centralized) { + my @values; + db_synch_update($dbh, $conf, 'tusuario', $dbh->{Statement}, $result, @values); + } + exit; } @@ -6414,8 +6422,10 @@ sub cli_user_enable () { sub cli_user_disable () { my $user_id = @ARGV[2]; - if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { - print_log "[ERROR] This node is configured with centralized mode. To disable a user go to metaconsole. \n\n"; + my $centralized = pandora_get_tconfig_token ($dbh, 'centralized_management', ''); + + if(is_metaconsole($conf) != 1 && $centralized) { + print_log "[ERROR] This node is configured with centralized mode. To create a user go to metaconsole. \n\n"; exit; } @@ -6432,9 +6442,14 @@ sub cli_user_disable () { $user_id = safe_input($user_id); - db_do ($dbh, "UPDATE tusuario SET disabled = '1' WHERE id_user = '$user_id'"); + my $result = db_do ($dbh, "UPDATE tusuario SET disabled = '1' WHERE id_user = '$user_id'"); + + if(is_metaconsole($conf) == 1 && $centralized) { + my @values; + db_synch_update($dbh, $conf, 'tusuario', $dbh->{Statement}, $result, @values); + } - exit; + exit; } ###############################################################################