IMAP initial folder support
This commit is contained in:
parent
3bcb22a70b
commit
93a87c8f6f
|
@ -2,6 +2,9 @@ December 2015 5.2
|
||||||
- Windows: support for additional attributes
|
- Windows: support for additional attributes
|
||||||
- SSH public key: added possibility to add/remove SSH extension
|
- SSH public key: added possibility to add/remove SSH extension
|
||||||
- MIT Kerberos: set krbExtraData for new accounts
|
- MIT Kerberos: set krbExtraData for new accounts
|
||||||
|
- IMAP: allow to specify initial folders to create
|
||||||
|
- LAM Pro:
|
||||||
|
-> Users: allow to manage IP addresses with ipHost module
|
||||||
|
|
||||||
|
|
||||||
31.08.2015 5.1
|
31.08.2015 5.1
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ Have fun!
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Open LAM (Pro) login page on new server and verify
|
<para>Open LAM (Pro) login page on new server and verify
|
||||||
installation. </para>
|
installation.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -3819,6 +3819,9 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
|
||||||
"user/myUser"). Select the values depending on your IMAP server
|
"user/myUser"). Select the values depending on your IMAP server
|
||||||
settings.</para>
|
settings.</para>
|
||||||
|
|
||||||
|
<para>You can specify a list of initial folder names to create for new
|
||||||
|
mailboxes. LAM will then create them with each new mailbox.</para>
|
||||||
|
|
||||||
<screenshot>
|
<screenshot>
|
||||||
<mediaobject>
|
<mediaobject>
|
||||||
<imageobject>
|
<imageobject>
|
||||||
|
@ -3840,6 +3843,33 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
|
||||||
</screenshot>
|
</screenshot>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<title>IP addresses (LAM Pro)</title>
|
||||||
|
|
||||||
|
<para>You can manage the IP addresses of user accounts (e.g. assigned
|
||||||
|
by DHCP) with the ipHost module.</para>
|
||||||
|
|
||||||
|
<para><emphasis role="bold">Configuration</emphasis></para>
|
||||||
|
|
||||||
|
<screenshot>
|
||||||
|
<mediaobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata fileref="images/ipHostUser.png" />
|
||||||
|
</imageobject>
|
||||||
|
</mediaobject>
|
||||||
|
</screenshot>
|
||||||
|
|
||||||
|
<para><emphasis role="bold">User editing</emphasis></para>
|
||||||
|
|
||||||
|
<screenshot>
|
||||||
|
<mediaobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata fileref="images/ipHostUser1.png" />
|
||||||
|
</imageobject>
|
||||||
|
</mediaobject>
|
||||||
|
</screenshot>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section id="s_account">
|
<section id="s_account">
|
||||||
<title>Account</title>
|
<title>Account</title>
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
|
@ -116,41 +116,10 @@ class imapAccess extends baseModule {
|
||||||
'pathSeparator' => array(
|
'pathSeparator' => array(
|
||||||
"Headline" => _("Path separator"),
|
"Headline" => _("Path separator"),
|
||||||
"Text" => _("This is the separator for the mailbox path. Usually, this is \".\" but e.g. Cyrus with \"unixhierarchysep\" will require \"/\".")),
|
"Text" => _("This is the separator for the mailbox path. Usually, this is \".\" but e.g. Cyrus with \"unixhierarchysep\" will require \"/\".")),
|
||||||
|
'initialFolders' => array(
|
||||||
|
"Headline" => _("Initial folders"),
|
||||||
|
"Text" => _("Use this to provide a list of folders (e.g. Trash) to add for new accounts.")),
|
||||||
);
|
);
|
||||||
// configuration settings
|
|
||||||
$configContainer = new htmlTable();
|
|
||||||
$configServer = new htmlTableExtendedInputField(_('Server address'), 'ImapAccess_ImapServerAddress', '', 'ImapServerAddress');
|
|
||||||
$configServer->setRequired(true);
|
|
||||||
$configContainer->addElement($configServer, true);
|
|
||||||
$configContainer->addElement(new htmlTableExtendedSelect('ImapAccess_ImapServerEncriptionProtocol', array('TLS', 'SSL'), array('TLS'), _("Encryption protocol"), 'ImapServerEncryptionProtocol'), true);
|
|
||||||
$configCertValidate = new htmlTableExtendedSelect('ImapAccess_ImapValidateServerCert', array(_('Yes') => 'validate-cert', _('No') => 'novalidate-cert'), array('validate-cert'), _("Validate server certificate"), 'ImapValidateServerCert');
|
|
||||||
$configCertValidate->setHasDescriptiveElements(true);
|
|
||||||
$configContainer->addElement($configCertValidate, true);
|
|
||||||
$configUser = new htmlTableExtendedInputField(_('IMAP admin user'), 'ImapAccess_ImapAdmin', '', 'ImapAdmin');
|
|
||||||
$configUser->setRequired(true);
|
|
||||||
$configContainer->addElement($configUser, true);
|
|
||||||
$pwdSelectOptions = array(
|
|
||||||
_('LAM user password') => 'lam_user_pass',
|
|
||||||
_('Ask') => 'ask_pass',
|
|
||||||
_('Server profile') => 'config');
|
|
||||||
$configPasswordType = new htmlTableExtendedSelect('ImapAccess_ImapAdminPasswordSelect', $pwdSelectOptions, array('ask_pass'), _("IMAP password input"), 'ImapAdminPasswordSelect');
|
|
||||||
$configPasswordType->setHasDescriptiveElements(true);
|
|
||||||
$configPasswordType->setTableRowsToShow(array('config' => array('ImapAccess_ImapAdminPassword')));
|
|
||||||
$configPasswordType->setTableRowsToHide(array('lam_user_pass' => array('ImapAccess_ImapAdminPassword'), 'ask_pass' => array('ImapAccess_ImapAdminPassword')));
|
|
||||||
$configContainer->addElement($configPasswordType, true);
|
|
||||||
$adminPwdInput = new htmlTableExtendedInputField(_('Admin password'), 'ImapAccess_ImapAdminPassword', null, 'ImapAdminPasswordSelect');
|
|
||||||
$adminPwdInput->setIsPassword(true);
|
|
||||||
$adminPwdInput->setObfuscate(true);
|
|
||||||
$configContainer->addElement($adminPwdInput, true);
|
|
||||||
$mailDomainsInput = new htmlTableExtendedInputField(_('Mail domains'), 'ImapAccess_ImapDomain', '', 'ImapMailDomain');
|
|
||||||
$mailDomainsInput->setRequired(true);
|
|
||||||
$configContainer->addElement($mailDomainsInput, true);
|
|
||||||
$configContainer->addElement(new htmlTableExtendedInputField(_('Prefix for mailboxes'), 'ImapAccess_ImapUserPrefix', '', 'ImapUserPrefix'), true);
|
|
||||||
$configUserName = new htmlTableExtendedSelect('ImapAccess_UserNameAttribute', array('mail', 'uid', 'userPrincipalName'), array('mail'), _("User name attribute"), 'ImapUserNameAttr');
|
|
||||||
$configContainer->addElement($configUserName, true);
|
|
||||||
$configPathSeparator = new htmlTableExtendedSelect('ImapAccess_pathSeparator', array('.', '/'), array('.'), _("Path separator"), 'pathSeparator');
|
|
||||||
$configContainer->addElement($configPathSeparator, true);
|
|
||||||
$return['config_options']['all'] = $configContainer;
|
|
||||||
// configuration checks
|
// configuration checks
|
||||||
$return['config_checks']['all']['ImapAccess_ImapServerAddress'] = array (
|
$return['config_checks']['all']['ImapAccess_ImapServerAddress'] = array (
|
||||||
'type' => 'ext_preg',
|
'type' => 'ext_preg',
|
||||||
|
@ -418,12 +387,18 @@ class imapAccess extends baseModule {
|
||||||
$create_mailbox_arg = "{" . $imap_server_address . "}" . $prefix . $this->getSep() . $this->user;
|
$create_mailbox_arg = "{" . $imap_server_address . "}" . $prefix . $this->getSep() . $this->user;
|
||||||
if (imap_createmailbox($mbox, imap_utf7_encode($create_mailbox_arg))) {
|
if (imap_createmailbox($mbox, imap_utf7_encode($create_mailbox_arg))) {
|
||||||
$list = imap_list($mbox, "{" . $imap_server_address . "}", $prefix . $this->getSep() . $this->user);
|
$list = imap_list($mbox, "{" . $imap_server_address . "}", $prefix . $this->getSep() . $this->user);
|
||||||
if (is_array($list) && sizeof($list) == 1) {
|
if (!is_array($list) || (sizeof($list) != 1)) {
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$errors[] = $this->messages['managemailbox'][3];
|
$errors[] = $this->messages['managemailbox'][3];
|
||||||
}
|
}
|
||||||
|
// create initial folders
|
||||||
|
foreach ($this->getInitialFolders() as $folder) {
|
||||||
|
$created = imap_createmailbox($mbox, imap_utf7_encode($create_mailbox_arg . $this->getSep() . $folder));
|
||||||
|
if (!$created) {
|
||||||
|
$error = $this->messages['managemailbox'][2];
|
||||||
|
$error[] = htmlspecialchars($folder);
|
||||||
|
$errors[] = $error;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$errors[] = $this->messages['managemailbox'][2];
|
$errors[] = $this->messages['managemailbox'][2];
|
||||||
|
@ -474,6 +449,57 @@ class imapAccess extends baseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of configuration options.
|
||||||
|
*
|
||||||
|
* @param array $scopes account types (user, group, host)
|
||||||
|
* @param array $allScopes list of all active account modules and their scopes (module => array(scopes))
|
||||||
|
* @return mixed htmlElement or array of htmlElement
|
||||||
|
*
|
||||||
|
* @see htmlElement
|
||||||
|
*/
|
||||||
|
public function get_configOptions($scopes, $allScopes) {
|
||||||
|
// configuration settings
|
||||||
|
$configContainer = new htmlTable();
|
||||||
|
$configServer = new htmlTableExtendedInputField(_('Server address'), 'ImapAccess_ImapServerAddress', '', 'ImapServerAddress');
|
||||||
|
$configServer->setRequired(true);
|
||||||
|
$configContainer->addElement($configServer, true);
|
||||||
|
$configContainer->addElement(new htmlTableExtendedSelect('ImapAccess_ImapServerEncriptionProtocol', array('TLS', 'SSL'), array('TLS'), _("Encryption protocol"), 'ImapServerEncryptionProtocol'), true);
|
||||||
|
$configCertValidate = new htmlTableExtendedSelect('ImapAccess_ImapValidateServerCert', array(_('Yes') => 'validate-cert', _('No') => 'novalidate-cert'), array('validate-cert'), _("Validate server certificate"), 'ImapValidateServerCert');
|
||||||
|
$configCertValidate->setHasDescriptiveElements(true);
|
||||||
|
$configContainer->addElement($configCertValidate, true);
|
||||||
|
$configUser = new htmlTableExtendedInputField(_('IMAP admin user'), 'ImapAccess_ImapAdmin', '', 'ImapAdmin');
|
||||||
|
$configUser->setRequired(true);
|
||||||
|
$configContainer->addElement($configUser, true);
|
||||||
|
$pwdSelectOptions = array(
|
||||||
|
_('LAM user password') => 'lam_user_pass',
|
||||||
|
_('Ask') => 'ask_pass',
|
||||||
|
_('Server profile') => 'config');
|
||||||
|
$configPasswordType = new htmlTableExtendedSelect('ImapAccess_ImapAdminPasswordSelect', $pwdSelectOptions, array('ask_pass'), _("IMAP password input"), 'ImapAdminPasswordSelect');
|
||||||
|
$configPasswordType->setHasDescriptiveElements(true);
|
||||||
|
$configPasswordType->setTableRowsToShow(array('config' => array('ImapAccess_ImapAdminPassword')));
|
||||||
|
$configPasswordType->setTableRowsToHide(array('lam_user_pass' => array('ImapAccess_ImapAdminPassword'), 'ask_pass' => array('ImapAccess_ImapAdminPassword')));
|
||||||
|
$configContainer->addElement($configPasswordType, true);
|
||||||
|
$adminPwdInput = new htmlTableExtendedInputField(_('Admin password'), 'ImapAccess_ImapAdminPassword', null, 'ImapAdminPasswordSelect');
|
||||||
|
$adminPwdInput->setIsPassword(true);
|
||||||
|
$adminPwdInput->setObfuscate(true);
|
||||||
|
$configContainer->addElement($adminPwdInput, true);
|
||||||
|
$mailDomainsInput = new htmlTableExtendedInputField(_('Mail domains'), 'ImapAccess_ImapDomain', '', 'ImapMailDomain');
|
||||||
|
$mailDomainsInput->setRequired(true);
|
||||||
|
$configContainer->addElement($mailDomainsInput, true);
|
||||||
|
$configContainer->addElement(new htmlTableExtendedInputField(_('Prefix for mailboxes'), 'ImapAccess_ImapUserPrefix', '', 'ImapUserPrefix'), true);
|
||||||
|
$configContainer->addElement(new htmlTableExtendedInputTextarea('ImapAccess_initialFolders', '', 10, 3, _('Initial folders'), 'initialFolders'), true);
|
||||||
|
$configUserName = new htmlTableExtendedSelect('ImapAccess_UserNameAttribute', array('mail', 'uid', 'userPrincipalName'), array('mail'), _("User name attribute"), 'ImapUserNameAttr');
|
||||||
|
$configContainer->addElement($configUserName, true);
|
||||||
|
$configPathSeparator = new htmlTableExtendedSelect('ImapAccess_pathSeparator', array('.', '/'), array('.'), _("Path separator"), 'pathSeparator');
|
||||||
|
$configContainer->addElement($configPathSeparator, true);
|
||||||
|
$configContainer->addElement(new htmlEqualWidth(array('ImapAccess_ImapServerAddress', 'ImapAccess_initialFolders', 'ImapAccess_UserNameAttribute',
|
||||||
|
'ImapAccess_ImapServerEncriptionProtocol', 'ImapAccess_ImapValidateServerCert', 'ImapAccess_ImapAdminPasswordSelect',
|
||||||
|
'ImapAccess_pathSeparator'
|
||||||
|
)));
|
||||||
|
return $configContainer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks input values of module settings.
|
* Checks input values of module settings.
|
||||||
*
|
*
|
||||||
|
@ -673,6 +699,24 @@ class imapAccess extends baseModule {
|
||||||
return '.'; // default
|
return '.'; // default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of initial folders to create for a new mailbox.
|
||||||
|
*
|
||||||
|
* @return array list of folders
|
||||||
|
*/
|
||||||
|
private function getInitialFolders() {
|
||||||
|
$list = array();
|
||||||
|
if (!empty($this->moduleSettings['ImapAccess_initialFolders'])) {
|
||||||
|
foreach ($this->moduleSettings['ImapAccess_initialFolders'] as $folder) {
|
||||||
|
$folder = trim($folder);
|
||||||
|
if (!empty($folder)) {
|
||||||
|
$list[] = $folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue