forked from extern/egroupware
Admin: Extend Vfs::deleteAccount hook to all the files it can find, not just home dir.
This commit is contained in:
parent
99032ef15c
commit
d8faef3503
admin
api/src
@ -302,7 +302,10 @@ class admin_account
|
||||
{
|
||||
$entry = lang('Entries');
|
||||
}
|
||||
if($counts['total'] && Api\Hooks::exists('deleteaccount', $app))
|
||||
if($counts['total'] && (
|
||||
// Filemanager is a special case, since the hook is in API
|
||||
Api\Hooks::exists('deleteaccount', $app) || in_array($app, array('filemanager'))
|
||||
))
|
||||
{
|
||||
$content['delete_apps'][] = $app;
|
||||
$sel_options['delete_apps'][] = array(
|
||||
@ -319,16 +322,7 @@ 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);
|
||||
}
|
||||
|
@ -201,6 +201,7 @@ change config settings admin en Change config settings
|
||||
change domain of email address and aliases admin en change domain of email address and aliases
|
||||
change login screen message admin en Change login screen message
|
||||
change owner admin en Change owner
|
||||
change owner of found files to the new user, and move the home folder to /home/new-user/old-home-username. admin en Found files will have owner changed to the new user. The home folder will be moved to /home/new-user/old-home-username.
|
||||
change password for %1 admin en Change password for %1
|
||||
change password hash to admin en Change password hash to
|
||||
changed password hash for %1 to %2. admin en Changed password hash for %1 to %2.
|
||||
@ -706,7 +707,6 @@ phpinfo admin en PHP information
|
||||
phrase admin en Phrase
|
||||
phrase deleted admin en Phrase deleted
|
||||
please check email. it gets automatically deleted if email integration is used. admin en Please check email. It gets automatically deleted if email integration is used.
|
||||
please check home folder. all files and folders of the user will be unusable by other users. admin en Please check home folder. All files and folders of the user will be unusable by other users.
|
||||
please enter a name admin en Enter a name
|
||||
please enter a name for that server ! admin en Enter a name for that server!
|
||||
please manually deal with entries owned by the user: admin en Please manually deal with entries owned by the user:
|
||||
|
@ -29,7 +29,7 @@
|
||||
<rows>
|
||||
<row>
|
||||
<select-app value="filemanager" readonly="true"/>
|
||||
<description value="Please check home folder. All files and folders of the user will be unusable by other users."/>
|
||||
<description value="Change owner of found files to the new user, and move the home folder to /home/new-user/old-home-username."/>
|
||||
</row>
|
||||
<row>
|
||||
<select-app value="mail" readonly="true"/>
|
||||
|
@ -1089,6 +1089,10 @@ class Accounts
|
||||
}
|
||||
}
|
||||
|
||||
// Add filemanager as special case, since most of it is in Api
|
||||
$files = Vfs::find('/', array('uid' => (int)$account_id, 'limit' => 50));
|
||||
$counts['filemanager']['total'] = Vfs::$find_total;
|
||||
|
||||
return $counts;
|
||||
}
|
||||
protected function get_owner_columns()
|
||||
|
@ -87,6 +87,8 @@ class Hooks
|
||||
{
|
||||
if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($data).')');
|
||||
Api\Vfs::$is_root = true;
|
||||
|
||||
// Home directory
|
||||
if ($data['new_owner'] && ($new_lid = $GLOBALS['egw']->accounts->id2name($data['new_owner'])))
|
||||
{
|
||||
// copy content of user-dir to new owner's user-dir as old-home-$name
|
||||
@ -107,6 +109,14 @@ class Hooks
|
||||
{
|
||||
throw new Api\Exception\AssertionFailed(__METHOD__.'('.array2string($data).') account_lid NOT set!');
|
||||
}
|
||||
|
||||
// Other files
|
||||
Api\Vfs::find(
|
||||
'/',
|
||||
array('user' => $data['account_lid']),
|
||||
$data['new_owner'] ? 'EGroupware\Api\Vfs::chown' : 'EGroupware\Api\Vfs::remove', $data['new_owner']
|
||||
);
|
||||
|
||||
Api\Vfs::$is_root = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user