* Admin: Add filemanager (home directory) as an option to move to new user when deleting an account

This commit is contained in:
nathangray 2019-11-06 09:49:33 -07:00
parent fb20fe69dd
commit 1eda093753
2 changed files with 14 additions and 0 deletions

View File

@ -319,6 +319,16 @@ class admin_account
);
}
}
// Add filemanager home directory in as special case, hook is in the API
if(Api\Vfs::file_exists('/home/'.$GLOBALS['egw']->accounts->id2name($content['account_id'])))
{
$app = 'filemanager';
$sel_options['delete_apps'][] = array(
'value' => $app,
'label' => lang($app) . ': ' . lang('home directory')
);
$content['delete_apps'][] = $app;
}
$tpl = new Etemplate('admin.account.delete');
$tpl->exec('admin_account::delete', $content, $sel_options, array(), $preserve, 2);
}

View File

@ -206,6 +206,10 @@ class admin_cmd_delete_account extends admin_cmd
$skip_apps[] = $app;
Api\Hooks::single(array_merge($GLOBALS['hook_values'], array('new_owner' => 0)), $app, true);
}
// Filemanager is a special case, since the hook is in API not filemanager
$vfs_new_owner = in_array('filemanager', $this->change_apps) ? $new_user : 0;
Api\Vfs\Hooks::deleteAccount(array_merge($GLOBALS['hook_values'], array('new_owner' => $vfs_new_owner)));
// first all other apps, then preferences, admin & api
foreach(array_merge($this->change_apps,$do_last) as $app)