mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 16:33:17 +01:00
use default account selection box for acl-management if functionality is supported by imap server (determined by class-name and capability)
This commit is contained in:
parent
9d8e8bbd56
commit
d828e81632
@ -82,6 +82,32 @@ class ajaxfelamimail
|
||||
function addACL($_accountName, $_aclData, $_recursive=false)
|
||||
{
|
||||
if($this->_debug) error_log("ajaxfelamimail::addACL for ".$_accountName."->".array2string($_aclData));
|
||||
if (is_numeric($_accountName) && ($account=$GLOBALS['egw']->accounts->read($_accountName)))
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($account));
|
||||
$imapClassName = get_class($this->bofelamimail->icServer);
|
||||
$alllowercase = false;
|
||||
if (!empty($imapClassName) && stripos(constant($imapClassName.'::CAPABILITIES'),'lowercaseloginname') !== false) $alllowercase=true;
|
||||
if ($alllowercase) $account['account_lid']=strtolower($account['account_lid']);
|
||||
$isgroup=$account['account_id']<0?constant("$imapClassName::ACL_GROUP_PREFIX"):'';
|
||||
$domainName = $this->bofelamimail->icServer->domainName;
|
||||
if ($this->bofelamimail->icServer->loginType=='standard') // means username
|
||||
{
|
||||
$_accountName = $isgroup.$account['account_lid'];
|
||||
}
|
||||
elseif ($this->bofelamimail->icServer->loginType=='email')
|
||||
{
|
||||
if (!empty($account['account_email'])) $_accountName = $isgroup.$account['account_email'];
|
||||
}
|
||||
elseif ($this->bofelamimail->icServer->loginType=='vmailmgr') // means username + domainname
|
||||
{
|
||||
$_accountName = $isgroup.trim($account['account_lid'].'@'.$domainName);
|
||||
}
|
||||
elseif ($this->bofelamimail->icServer->loginType=='uidNumber') // userid + domain
|
||||
{
|
||||
$_accountName = $isgroup.trim($account['account_id'].'@'.$domainName);
|
||||
}
|
||||
}
|
||||
$response = new xajaxResponse();
|
||||
//$_recursive=false;
|
||||
if(!empty($_accountName)) {
|
||||
|
@ -102,65 +102,10 @@
|
||||
}
|
||||
if (!($imapClassName == 'defaultimap' || $imapClassName == 'emailadmin_imap'))
|
||||
{
|
||||
//$smtpClass='emailadmin_smtp_sql';
|
||||
$accounts = $GLOBALS['egw']->accounts->search(array('type'=>'accounts'));
|
||||
$groups = array();
|
||||
if ($imapClassName=='managementserver_imap') $groups = $GLOBALS['egw']->accounts->search(array('type'=>'groups'));
|
||||
$domainName = $bofelamimail->icServer->domainName;
|
||||
if ($alllowercase)
|
||||
{
|
||||
$domainName = strtolower($domainName);
|
||||
//error_log(__METHOD__.__LINE__.$imapClassName);
|
||||
$accountSelection = $GLOBALS['egw']->uiaccountsel->selection('accountName','accountName',array(),'felamimail'.($imapClassName=='managementserver_imap'?'+':''),0,False,
|
||||
' title="'.lang('select a %1',lang('user')).'"','',lang('Select one'),false,null);
|
||||
}
|
||||
foreach ($accounts as $k => $v)
|
||||
{
|
||||
if ($alllowercase) $v['account_lid']=strtolower($v['account_lid']);
|
||||
$isgroup=$v['account_id']<0?constant("$imapClassName::ACL_GROUP_PREFIX"):'';
|
||||
$dfn = common::display_fullname($v['account_lid']);
|
||||
if ($bofelamimail->icServer->loginType=='standard') // means username
|
||||
{
|
||||
$accountList[$isgroup.$v['account_lid']] = $dfn;
|
||||
}
|
||||
elseif ($bofelamimail->icServer->loginType=='email')
|
||||
{
|
||||
if (!empty($v['account_email'])) $accountList[$isgroup.$v['account_email']] = $dfn;
|
||||
}
|
||||
elseif ($bofelamimail->icServer->loginType=='vmailmgr') // means username + domainname
|
||||
{
|
||||
$accountList[$isgroup.trim($v['account_lid'].'@'.$domainName)] = $dfn;
|
||||
}
|
||||
elseif ($bofelamimail->icServer->loginType=='uidNumber') // userid + domain
|
||||
{
|
||||
$accountList[$isgroup.trim($v['account_id'].'@'.$domainName)] = $dfn;
|
||||
}
|
||||
}
|
||||
natcasesort($accountList);
|
||||
foreach ($groups as $k => $v)
|
||||
{
|
||||
if ($alllowercase) $v['account_lid']=strtolower($v['account_lid']);
|
||||
$isgroup=$v['account_id']<0?constant("$imapClassName::ACL_GROUP_PREFIX"):'';
|
||||
$dfn = common::display_fullname($v['account_lid']);
|
||||
if ($bofelamimail->icServer->loginType=='standard') // means username
|
||||
{
|
||||
$groupList[$isgroup.$v['account_lid']] = $dfn;
|
||||
}
|
||||
elseif ($bofelamimail->icServer->loginType=='email')
|
||||
{
|
||||
if (!empty($v['account_email'])) $groupList[$isgroup.$v['account_email']] = $dfn;
|
||||
}
|
||||
elseif ($bofelamimail->icServer->loginType=='vmailmgr') // means username + domainname
|
||||
{
|
||||
$groupList[$isgroup.trim($v['account_lid'].'@'.$domainName)] = $dfn;
|
||||
}
|
||||
elseif ($bofelamimail->icServer->loginType=='uidNumber') // userid + domain
|
||||
{
|
||||
$groupList[$isgroup.trim($v['account_id'].'@'.$domainName)] = $dfn;
|
||||
}
|
||||
}
|
||||
natcasesort($groupList);
|
||||
|
||||
if (count($accountList)>=1) $accountList = array(''=>lang('Select one'))+$accountList+$groupList;
|
||||
}
|
||||
if (!empty($accountList)) $accountSelection = html::select('accountName','',$accountList,true, "id=\"accountName\"");
|
||||
}
|
||||
|
||||
$this->t->set_file(array("body" => "preferences_manage_folder.tpl"));
|
||||
@ -171,7 +116,7 @@
|
||||
unset($aclShortCuts['custom']);
|
||||
$this->t->set_var('aclSelection',html::select('aclSelection',0,$aclShortCuts,false,'id="aclSelection" style="width:100%"'));
|
||||
$this->translate();
|
||||
if (isset($lprofileID)) $this->bofelamimail = felamimail_bo::getInstance(true, $lprofileID);
|
||||
if (isset($lprofileID)) $this->bofelamimail = felamimail_bo::getInstance(false, $lprofileID);
|
||||
$this->t->pparse("out","add_acl");
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user