ent 9557 delete private dashboards when deleting user

This commit is contained in:
edu.corral 2022-11-10 12:14:44 +01:00
parent 240bab48ec
commit 47596dd300
1 changed files with 18 additions and 1 deletions

View File

@ -319,6 +319,17 @@ if ($delete_user === true) {
if ($id_user != $config['id_user']) {
$user_row = users_get_user_by_id($id_user);
$private_dashboards = db_get_all_rows_filter(
'tdashboard',
['id_user' => $id_user],
'id'
);
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
header('Refresh:1');
}
$result = delete_user($id_user);
if ($result) {
@ -335,12 +346,16 @@ if ($delete_user === true) {
);
// Delete the user in all the consoles.
if (is_metaconsole() === true && isset($_GET['delete_all'])) {
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
// Connect to the remote console.
if (metaconsole_connect($server) === NOERR) {
// Delete the user.
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
}
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
@ -367,6 +382,8 @@ if ($delete_user === true) {
__('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
);
}
header('Refresh:1');
}
} else {
ui_print_error_message(__('There was a problem deleting the user'));