diff --git a/lam/HISTORY b/lam/HISTORY index fd9c8e66..bffd4cf9 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -1,5 +1,6 @@ December 2016 5.6 - Windows: added support for pager, otherPager, mobile, otherMobile, company and proxyAddresses (disabled by default in server profile) + - Mail routing: enable for groups and allow to add/remove the extension - LAM Pro: -> 389ds: new wildcards for custom scripts: $INFO.389lockingStatusChange$ and $INFO.389deactivationStatusChange$ diff --git a/lam/docs/manual-sources/howto.xml b/lam/docs/manual-sources/howto.xml index 96af3570..ecd0ed85 100644 --- a/lam/docs/manual-sources/howto.xml +++ b/lam/docs/manual-sources/howto.xml @@ -1000,6 +1000,13 @@ Have fun!
Version specific upgrade instructions +
+ 5.5 -> 5.6 + + Mail routing: No longer added by default. Use profile editor + to activate by default for new users/groups. +
+
5.4 -> 5.5 @@ -4447,11 +4454,28 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
Mail routing - LAM supports to manage mail routing for user accounts. You can - specify a routing address, the mail server and a number of local - addresses to route. This feature can be activated by adding the "Mail - routing" module to the user account type in your server - profile. + LAM supports to manage mail routing for user accounts. + + Module activation: + + This feature can be activated by adding the "Mail routing" + module to the user account type in your server profile. + + + + + + + + + + Usage: + + You can specify a routing address, the mail server and a number + of local addresses to route. + + In case you want to add this extension by default for new users + there is an option in profile editor. @@ -4986,6 +5010,41 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
+
+ Mail routing + + LAM supports to manage mail routing for group accounts. + + Module activation: + + This feature can be activated by adding the "Mail routing" + module to the group account type in your server profile. + + + + + + + + + + Usage: + + You can specify a routing address, the mail server and a number + of local addresses to route. + + In case you want to add this extension by default for new groups + there is an option in profile editor. + + + + + + + + +
+
Quota diff --git a/lam/docs/manual-sources/images/mailRouting.png b/lam/docs/manual-sources/images/mailRouting.png index d146abdd..3461218a 100644 Binary files a/lam/docs/manual-sources/images/mailRouting.png and b/lam/docs/manual-sources/images/mailRouting.png differ diff --git a/lam/docs/manual-sources/images/mailRoutingConfig.png b/lam/docs/manual-sources/images/mailRoutingConfig.png new file mode 100644 index 00000000..6156bd64 Binary files /dev/null and b/lam/docs/manual-sources/images/mailRoutingConfig.png differ diff --git a/lam/docs/manual-sources/images/mailRoutingConfigGroup.png b/lam/docs/manual-sources/images/mailRoutingConfigGroup.png new file mode 100644 index 00000000..2b6d1ffe Binary files /dev/null and b/lam/docs/manual-sources/images/mailRoutingConfigGroup.png differ diff --git a/lam/docs/manual-sources/images/mailRoutingGroup.png b/lam/docs/manual-sources/images/mailRoutingGroup.png new file mode 100644 index 00000000..48d97e95 Binary files /dev/null and b/lam/docs/manual-sources/images/mailRoutingGroup.png differ diff --git a/lam/lib/modules/inetLocalMailRecipient.inc b/lam/lib/modules/inetLocalMailRecipient.inc index dfff213b..73ccb47c 100644 --- a/lam/lib/modules/inetLocalMailRecipient.inc +++ b/lam/lib/modules/inetLocalMailRecipient.inc @@ -34,13 +34,24 @@ $Id$ */ class inetLocalMailRecipient extends baseModule { + /** + * Creates a new mitKerberos object. + * + * @param string $scope account type (user, group, host) + */ + function __construct($scope) { + // call parent constructor + parent::__construct($scope); + $this->autoAddObjectClasses = false; + } + /** * Returns true if this module can manage accounts of the current type, otherwise false. * * @return boolean true if module fits */ public function can_manage() { - return in_array($this->get_scope(), array('user')); + return in_array($this->get_scope(), array('user', 'group')); } /** @@ -82,6 +93,7 @@ class inetLocalMailRecipient extends baseModule { )); // profile options $profileContainer = new htmlTable(); + $profileContainer->addElement(new htmlTableExtendedInputCheckbox('inetLocalMailRecipient_addExt', false, _('Automatically add this extension'), 'autoAdd'), true); $profileContainer->addElement(new htmlTableExtendedInputField(_('Mail server'), 'inetLocalMailRecipient_host', null, 'mailHost')); $return['profile_options'] = $profileContainer; // profile checks @@ -135,6 +147,22 @@ class inetLocalMailRecipient extends baseModule { $this->messages['mailHost'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_server', 'Mail server is invalid!'); } + /** + * Loads the values of an account profile into internal variables. + * + * @param array $profile hash array with profile values (identifier => value) + */ + function load_profile($profile) { + // profile mappings in meta data + parent::load_profile($profile); + // add extension + if (isset($profile['inetLocalMailRecipient_addExt'][0]) && ($profile['inetLocalMailRecipient_addExt'][0] == "true")) { + if (!in_array('inetLocalMailRecipient', $this->attributes['objectClass'])) { + $this->attributes['objectClass'][] = 'inetLocalMailRecipient'; + } + } + } + /** * Returns the HTML meta data for the main account page. * @@ -142,33 +170,43 @@ class inetLocalMailRecipient extends baseModule { */ function display_html_attributes() { $return = new htmlTable(); - // mail routing address - $this->addSimpleInputTextField($return, 'mailRoutingAddress', _('Routing address')); - // mail server - $this->addSimpleInputTextField($return, 'mailHost', _('Mail server')); - // list current local addresses - $localAdresses = array(); - if (isset($this->attributes['mailLocalAddress'])) $localAdresses = $this->attributes['mailLocalAddress']; - for ($i = 0; $i < sizeof($localAdresses); $i++) { - if ($i == 0) { - $return->addElement(new htmlOutputText(_('Local address'))); + if (in_array('inetLocalMailRecipient', $this->attributes['objectClass'])) { + // mail routing address + $this->addSimpleInputTextField($return, 'mailRoutingAddress', _('Routing address')); + // mail server + $this->addSimpleInputTextField($return, 'mailHost', _('Mail server')); + // list current local addresses + $localAdresses = array(); + if (isset($this->attributes['mailLocalAddress'])) $localAdresses = $this->attributes['mailLocalAddress']; + for ($i = 0; $i < sizeof($localAdresses); $i++) { + if ($i == 0) { + $return->addElement(new htmlOutputText(_('Local address'))); + } + else { + $return->addElement(new htmlOutputText('')); + } + $return->addElement(new htmlInputField('localAdr' . $i, $localAdresses[$i])); + $return->addElement(new htmlButton('delAdr' . $i, 'del.png', true)); + if ($i == 0) { + $return->addElement(new htmlHelpLink('localAdr')); + } + $return->addNewLine(); } - else { - $return->addElement(new htmlOutputText('')); - } - $return->addElement(new htmlInputField('localAdr' . $i, $localAdresses[$i])); - $return->addElement(new htmlButton('delAdr' . $i, 'del.png', true)); - if ($i == 0) { - $return->addElement(new htmlHelpLink('localAdr')); - } - $return->addNewLine(); + // input box for new local addresses + $return->addElement(new htmlOutputText(_('New local address'))); + $return->addElement(new htmlInputField('localAdr', '')); + $return->addElement(new htmlButton('addAdr', 'add.png', true)); + $return->addElement(new htmlHelpLink('localAdr')); + $return->addElement(new htmlHiddenInput('adr_number', sizeof($localAdresses))); + + $return->addElement(new htmlSpacer(null, '10px'), true); + $deleteButton = new htmlButton('remObjectClass', _('Remove mail routing extension')); + $deleteButton->colspan = 3; + $return->addElement($deleteButton); + } + else { + $return->addElement(new htmlButton('addObjectClass', _('Add mail routing extension'))); } - // input box for new local addresses - $return->addElement(new htmlOutputText(_('New local address'))); - $return->addElement(new htmlInputField('localAdr', '')); - $return->addElement(new htmlButton('addAdr', 'add.png', true)); - $return->addElement(new htmlHelpLink('localAdr')); - $return->addElement(new htmlHiddenInput('adr_number', sizeof($localAdresses))); return $return; } @@ -179,6 +217,22 @@ class inetLocalMailRecipient extends baseModule { * @return array list of info/error messages */ function process_attributes() { + if (isset($_POST['addObjectClass'])) { + $this->attributes['objectClass'][] = 'inetLocalMailRecipient'; + return array(); + } + elseif (isset($_POST['remObjectClass'])) { + $this->attributes['objectClass'] = array_delete(array('inetLocalMailRecipient'), $this->attributes['objectClass']); + for ($i = 0; $i < sizeof($this->meta['attributes']); $i++) { + if (isset($this->attributes[$this->meta['attributes'][$i]])) { + unset($this->attributes[$this->meta['attributes'][$i]]); + } + } + return array(); + } + if (!in_array('inetLocalMailRecipient', $this->attributes['objectClass'])) { + return array(); + } $errors = array(); $this->attributes['mailRoutingAddress'] = array(); $this->attributes['mailLocalAddress'] = array(); @@ -243,6 +297,26 @@ class inetLocalMailRecipient extends baseModule { return $errors; } + /** + * Returns a list of modifications which have to be made to the LDAP account. + * + * @return array list of modifications + *
This function returns an array with 3 entries: + *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) + *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) + *
"add" are attributes which have to be added to LDAP entry + *
"remove" are attributes which have to be removed from LDAP entry + *
"modify" are attributes which have to been modified in LDAP entry + *
"info" are values with informational value (e.g. to be used later by pre/postModify actions) + */ + function save_attributes() { + if (!in_array('inetLocalMailRecipient', $this->attributes['objectClass']) && !in_array('inetLocalMailRecipient', $this->orig['objectClass'])) { + // skip saving if the extension was not added/modified + return array(); + } + return parent::save_attributes(); + } + /** * In this function the LDAP account is built up. *