mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 04:31:06 +01:00
* EMailAdmin/Admin/Cyrus: deleting of users did not delete mailbox on managed Cyrus server
This commit is contained in:
parent
d8bd6e7b2d
commit
6a6aaa7b6a
@ -64,6 +64,8 @@ class emailadmin_hooks
|
|||||||
*/
|
*/
|
||||||
static function deleteaccount(array $data)
|
static function deleteaccount(array $data)
|
||||||
{
|
{
|
||||||
|
self::run_plugin_hooks('deleteAccount', $data);
|
||||||
|
|
||||||
// as mail accounts contain credentials, we do NOT assign them to user users
|
// as mail accounts contain credentials, we do NOT assign them to user users
|
||||||
emailadmin_account::delete(0, $data['account_id']);
|
emailadmin_account::delete(0, $data['account_id']);
|
||||||
}
|
}
|
||||||
@ -91,7 +93,17 @@ class emailadmin_hooks
|
|||||||
static function addaccount(array $data)
|
static function addaccount(array $data)
|
||||||
{
|
{
|
||||||
$method = $data['location'] == 'addaccount' ? 'addAccount' : 'updateAccount';
|
$method = $data['location'] == 'addaccount' ? 'addAccount' : 'updateAccount';
|
||||||
|
self::run_plugin_hooks($method, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run hook on plugins of all mail-accounts of given account_id
|
||||||
|
*
|
||||||
|
* @param string $method plugin method to run
|
||||||
|
* @param array $data hook-data incl. value for key account_id
|
||||||
|
*/
|
||||||
|
protected static function run_plugin_hooks($method, array $data)
|
||||||
|
{
|
||||||
foreach(emailadmin_account::search((int)$data['account_id'], 'params') as $params)
|
foreach(emailadmin_account::search((int)$data['account_id'], 'params') as $params)
|
||||||
{
|
{
|
||||||
if (!emailadmin_account::is_multiple($params)) continue; // no need to waste time on personal accounts
|
if (!emailadmin_account::is_multiple($params)) continue; // no need to waste time on personal accounts
|
||||||
|
@ -82,16 +82,15 @@ class emailadmin_imap_cyrus extends emailadmin_imap
|
|||||||
$this->adminConnection();
|
$this->adminConnection();
|
||||||
|
|
||||||
$mailboxName = $this->getUserMailboxString($username);
|
$mailboxName = $this->getUserMailboxString($username);
|
||||||
list($reference,$restriction) = explode($username,$mailboxName,2);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$mboxes = $this->getMailboxes($reference,$username.$restriction);
|
$mboxes = (array)$this->getMailboxes($mailboxName, 1);
|
||||||
//error_log(__METHOD__."('$username') getMailboxes('$reference','$username$restriction') = ".array2string($mboxes));
|
//error_log(__METHOD__."('$username') getMailboxes('$reference','$username$restriction') = ".array2string($mboxes));
|
||||||
|
|
||||||
foreach($mboxes as $mbox)
|
foreach(array_keys($mboxes) as $mbox)
|
||||||
{
|
{
|
||||||
// give the admin account the rights to delete this mailbox
|
// give the admin account the rights to delete this mailbox
|
||||||
$this->setACL($mbox, $this->adminUsername, 'lrswipcda');
|
$this->setACL($mbox, $this->acc_imap_admin_username, array('rights' => 'aeiklprstwx'));
|
||||||
$this->deleteMailbox($mbox);
|
$this->deleteMailbox($mbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user