From a66066fbc55be62d3de3a70a4f980ba30728c009 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 22 Jul 2014 11:17:13 +0000 Subject: [PATCH] allow to call getAllIdentities for other users; used for Admin Calling eSync Prefs on Mail for other users --- emailadmin/inc/class.emailadmin_imapbase.inc.php | 7 ++++--- mail/inc/class.mail_activesync.inc.php | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/emailadmin/inc/class.emailadmin_imapbase.inc.php b/emailadmin/inc/class.emailadmin_imapbase.inc.php index dfb0bab450..3b3299815e 100644 --- a/emailadmin/inc/class.emailadmin_imapbase.inc.php +++ b/emailadmin/inc/class.emailadmin_imapbase.inc.php @@ -644,13 +644,14 @@ class emailadmin_imapbase /** * getAllIdentities - function to gather the identities connected to the current user + * @param string/int $_accountToSearch; null; if set search accounts for user specified * @return array - array(email=>realname) */ - static function getAllIdentities() { + static function getAllIdentities($_accountToSearch=null) { $userEMailAdresses = array(); - foreach(emailadmin_account::search($only_current_user=true, $just_name=true) as $acc_id => $identity_name) + foreach(emailadmin_account::search($only_current_user=($_accountToSearch?$_accountToSearch:true), $just_name=true) as $acc_id => $identity_name) { - $acc = emailadmin_account::read($acc_id); + $acc = emailadmin_account::read($acc_id,($_accountToSearch?$_accountToSearch:null)); $userEMailAdresses[$acc['ident_id']] = array('acc_id'=>$acc_id,'ident_id'=>$acc['ident_id'],'ident_email'=>$acc['ident_email'],'ident_org'=>$acc['ident_org'],'ident_realname'=>$acc['ident_realname'],'ident_signature'=>$acc['ident_signature'],'ident_name'=>$acc['ident_name']); $identities = $acc->identities($acc_id); diff --git a/mail/inc/class.mail_activesync.inc.php b/mail/inc/class.mail_activesync.inc.php index 95b6c82f5c..b1fbab710e 100644 --- a/mail/inc/class.mail_activesync.inc.php +++ b/mail/inc/class.mail_activesync.inc.php @@ -157,7 +157,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send */ function getAvailableProfiles($params = null) { - $allIdentities = mail_bo::getAllIdentities(); + $allIdentities = mail_bo::getAllIdentities(($params['account_id']?$params['account_id']:null)); $identities = array(); if (!isset($params['setup'])) { @@ -191,6 +191,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send */ function settings($hook_data) { + //error_log(__METHOD__.__LINE__.array2string($hook_data)); $identities = array(); if (!isset($hook_data['setup'])) {