Merge branch 'ent-9557-14267-eliminar-dashboards-privados-cuando-se-borra-el-usuario-asignado' into 'develop'

Ent 9557 14267 eliminar dashboards privados cuando se borra el usuario asignado

See merge request artica/pandorafms!5258
This commit is contained in:
Rafael Ameijeiras 2022-12-12 08:21:16 +00:00
commit cedee1a3fa
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']) { if ($id_user != $config['id_user']) {
$user_row = users_get_user_by_id($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); $result = delete_user($id_user);
if ($result) { if ($result) {
@ -335,12 +346,16 @@ if ($delete_user === true) {
); );
// Delete the user in all the consoles. // Delete the user in all the consoles.
if (is_metaconsole() === true && isset($_GET['delete_all'])) { if (is_metaconsole() === true) {
$servers = metaconsole_get_servers(); $servers = metaconsole_get_servers();
foreach ($servers as $server) { foreach ($servers as $server) {
// Connect to the remote console. // Connect to the remote console.
if (metaconsole_connect($server) === NOERR) { if (metaconsole_connect($server) === NOERR) {
// Delete the user. // Delete the user.
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
}
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
db_pandora_audit( 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'])) __('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
); );
} }
header('Refresh:1');
} }
} else { } else {
ui_print_error_message(__('There was a problem deleting the user')); ui_print_error_message(__('There was a problem deleting the user'));