mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
rest to implement support for different mailbox names types / mail_login_types
This commit is contained in:
parent
2ebd10efba
commit
bfc3b262b3
@ -141,6 +141,7 @@ class setup_cmd_config extends setup_cmd
|
||||
'username (standard)' => 'standard',
|
||||
'username@domain (virtual mail manager)' => 'vmailmgr',
|
||||
'Username/Password defined by admin' => 'admin',
|
||||
'userId@domain eg. u123@domain' => 'uidNumber',
|
||||
'email (Standard Maildomain should be set)' => 'email',
|
||||
),'default'=>'standard'),
|
||||
),
|
||||
|
@ -512,7 +512,7 @@ class setup_cmd_ldap extends setup_cmd
|
||||
*
|
||||
* @param string $this->object_class='qmailUser'
|
||||
* @param string $this->mbox_attr='mailmessagestore' lowercase!!!
|
||||
* @param string $this->mail_login_format='email' 'email', 'vmailmgr', 'standard' or 'uidNumber'
|
||||
* @param string $this->mail_login_type='email' 'email', 'vmailmgr', 'standard' or 'uidNumber'
|
||||
* @return string with success message N entries modified
|
||||
* @throws egw_exception if dn not found, not listable or delete fails
|
||||
*/
|
||||
@ -532,17 +532,7 @@ class setup_cmd_ldap extends setup_cmd
|
||||
}
|
||||
$object_class = $this->object_class ? $this->object_class : 'qmailUser';
|
||||
$mbox_attr = $this->mbox_attr ? $this->mbox_attr : 'mailmessagestore';
|
||||
$mail_login_format = $this->mail_login_format ? $this->mail_login_format : 'email';
|
||||
|
||||
// translate EGroupware mail_login_format into ldap attribute names
|
||||
switch($mail_login_format)
|
||||
{
|
||||
case 'email': $mbox_format = 'mail'; break;
|
||||
case 'vmailmgr': $mbox_format = 'uid@domain'; break;
|
||||
case 'standard': $mbox_format = 'uid'; break;
|
||||
case 'uidNumber': $mbox_format = 'uuidnumber@domain'; break; // uu to get u123
|
||||
default: throw new egw_exception('Unknown mail_login_format "%1"!',$mail_login_format);
|
||||
}
|
||||
$mail_login_type = $this->mail_login_type ? $this->mail_login_type : 'email';
|
||||
|
||||
if (!($sr = ldap_search($this->test_ldap->ds,$this->ldap_base,
|
||||
'objectClass='.$object_class,array('mail','uidNumber','uid',$mbox_attr))) ||
|
||||
@ -555,13 +545,12 @@ class setup_cmd_ldap extends setup_cmd
|
||||
{
|
||||
if ($n === 'count') continue;
|
||||
|
||||
$replace = array(
|
||||
'mail' => $entry['mail'][0],
|
||||
'uidnumber' => $entry['uidnumber'][0],
|
||||
'uid' => $entry['uid'][0],
|
||||
'domain' => $this->domain,
|
||||
);
|
||||
$mbox = strtolower(str_replace(array_keys($replace),$replace,$mbox_format));
|
||||
$mbox = emailadmin_smtp_ldap::mailbox_addr(array(
|
||||
'account_id' => $entry['uidnumber'][0],
|
||||
'account_lid' => $entry['uid'][0],
|
||||
'account_email' => $entry['mail'][0],
|
||||
),$mail_login_type,$this->domain);
|
||||
|
||||
if ($mbox === $entry[$mbox_attr][0]) continue; // nothing to change
|
||||
|
||||
if (!$this->test && !ldap_modify($this->test_ldap->ds,$entry['dn'],array(
|
||||
|
@ -230,3 +230,29 @@ function sql_passwdhashes($config)
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make mail-login-types from emailadmin available to config template
|
||||
*
|
||||
* @param array $config
|
||||
* @return string
|
||||
*/
|
||||
function mail_login_type($config)
|
||||
{
|
||||
$types = emailadmin_ui::getIMAPLoginTypes('cyrusimap');
|
||||
unset($types['admin']);
|
||||
|
||||
foreach($types as $value => $label)
|
||||
{
|
||||
if($config['mail_login_type'] == $value)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected = '';
|
||||
}
|
||||
$out .= '<option value="' . $value . '"' . $selected . '>' . $label . '</option>' . "\n";
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
@ -176,11 +176,7 @@
|
||||
<tr class="row_on"">
|
||||
<td>{lang_Mail_server_login_type}:</td>
|
||||
<td>
|
||||
<select name="newsettings[mail_login_type]">
|
||||
<option value="standard" {selected_mail_login_type_standard}>{lang_standard (login-name_identical_to_eGroupWare_user-name)}</option>
|
||||
<option value="vmailmgr" {selected_mail_login_type_vmailmgr}>{lang_Virtual_mail_manager_(login-name_includes_domain)}</option>
|
||||
<option value="email" {selected_mail_login_type_email}>{lang_email_(Standard_Maildomain_should_be_set)}</option>
|
||||
</select>
|
||||
<select name="newsettings[mail_login_type]">{hook_mail_login_type}</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row_off"">
|
||||
|
Loading…
Reference in New Issue
Block a user