allow to call getAllIdentities for other users; used for Admin Calling eSync Prefs on Mail for other users

This commit is contained in:
Klaus Leithoff 2014-07-22 11:17:13 +00:00
parent a357da3ea2
commit a66066fbc5
2 changed files with 6 additions and 4 deletions

View File

@ -644,13 +644,14 @@ class emailadmin_imapbase
/** /**
* getAllIdentities - function to gather the identities connected to the current user * 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) * @return array - array(email=>realname)
*/ */
static function getAllIdentities() { static function getAllIdentities($_accountToSearch=null) {
$userEMailAdresses = array(); $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']); $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); $identities = $acc->identities($acc_id);

View File

@ -157,7 +157,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
*/ */
function getAvailableProfiles($params = null) function getAvailableProfiles($params = null)
{ {
$allIdentities = mail_bo::getAllIdentities(); $allIdentities = mail_bo::getAllIdentities(($params['account_id']?$params['account_id']:null));
$identities = array(); $identities = array();
if (!isset($params['setup'])) if (!isset($params['setup']))
{ {
@ -191,6 +191,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
*/ */
function settings($hook_data) function settings($hook_data)
{ {
//error_log(__METHOD__.__LINE__.array2string($hook_data));
$identities = array(); $identities = array();
if (!isset($hook_data['setup'])) if (!isset($hook_data['setup']))
{ {