From d8bd6e7b2dffa039db0b1f712945fc4a3e8d428c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 15 Aug 2014 18:19:02 +0000 Subject: [PATCH] * EMailAdmin/Admin/Cyrus: fixed mailbox creation for new users incl. Sent,Trash,Drafts,Templates,Spam subfolders, if defined in account --- .../inc/class.emailadmin_imap_cyrus.inc.php | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php b/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php index 7f28865cff..f652b0abb8 100644 --- a/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php +++ b/emailadmin/inc/class.emailadmin_imap_cyrus.inc.php @@ -40,7 +40,7 @@ class emailadmin_imap_cyrus extends emailadmin_imap /** * Updates an account * - * @param array $_hookValues only value for key 'account_lid' and 'new_passwd' is used + * @param array $_hookValues only value for key 'account_lid' and 'account_passwd' is used */ function addAccount($_hookValues) { @@ -160,7 +160,7 @@ class emailadmin_imap_cyrus extends emailadmin_imap /** * Updates an account * - * @param array $_hookValues only value for key 'account_lid' and 'new_passwd' is used + * @param array $_hookValues only value for key 'account_lid' and 'account_passwd' is used */ function updateAccount($_hookValues) { @@ -181,7 +181,25 @@ class emailadmin_imap_cyrus extends emailadmin_imap { try { $this->createMailbox($mailboxName); - $this->setACL($mailboxName, $username, "lrswipcda"); + $this->setACL($mailboxName, $username, array('rights' => 'aeiklprstwx')); + // create defined folders and subscribe them (have to use user-credentials to subscribe!) + $userimap = null; + foreach($this->params as $name => $value) + { + if (substr($name, 0, 11) == 'acc_folder_' && !empty($value)) + { + if (!isset($userimap)) + { + $params = $this->params; + $params['acc_imap_username'] = $username; + $params['acc_imap_password'] = $_hookValues['account_passwd']; + $userimap = new emailadmin_imap_cyrus($params); + } + $userimap->createMailbox($value); + $userimap->subscribeMailbox($value); + } + } + if (isset($userimap)) $userimap->logout(); } catch(Horde_Imap_Client_Exception $e) { _egw_log_exception($e);