From 1eda0937532acc876e5492a92fa5491930ba2615 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 6 Nov 2019 09:49:33 -0700 Subject: [PATCH] * Admin: Add filemanager (home directory) as an option to move to new user when deleting an account --- admin/inc/class.admin_account.inc.php | 10 ++++++++++ admin/inc/class.admin_cmd_delete_account.inc.php | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/admin/inc/class.admin_account.inc.php b/admin/inc/class.admin_account.inc.php index 4d207a47e4..8a7fb67737 100644 --- a/admin/inc/class.admin_account.inc.php +++ b/admin/inc/class.admin_account.inc.php @@ -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); } diff --git a/admin/inc/class.admin_cmd_delete_account.inc.php b/admin/inc/class.admin_cmd_delete_account.inc.php index 6e192b29ae..ae43367834 100644 --- a/admin/inc/class.admin_cmd_delete_account.inc.php +++ b/admin/inc/class.admin_cmd_delete_account.inc.php @@ -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)