synch cli with nodes pandora_enterprise#9500

This commit is contained in:
Daniel Barbero 2022-10-18 16:14:35 +02:00
parent 4b3376057c
commit e79394c235
1 changed files with 22 additions and 7 deletions

View File

@ -6385,8 +6385,10 @@ sub cli_disable_double_auth () {
sub cli_user_enable () { sub cli_user_enable () {
my $user_id = @ARGV[2]; my $user_id = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { my $centralized = 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";
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; exit;
} }
@ -6403,7 +6405,13 @@ sub cli_user_enable () {
$user_id = safe_input($user_id); $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; exit;
} }
@ -6414,8 +6422,10 @@ sub cli_user_enable () {
sub cli_user_disable () { sub cli_user_disable () {
my $user_id = @ARGV[2]; my $user_id = @ARGV[2];
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) { my $centralized = 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";
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; exit;
} }
@ -6432,7 +6442,12 @@ sub cli_user_disable () {
$user_id = safe_input($user_id); $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;
} }