mail routing for groups

This commit is contained in:
Roland Gruber 2016-11-12 09:48:34 +01:00
parent 9f9cb353b1
commit 4373c1b040
7 changed files with 165 additions and 31 deletions

View File

@ -1,5 +1,6 @@
December 2016 5.6 December 2016 5.6
- Windows: added support for pager, otherPager, mobile, otherMobile, company and proxyAddresses (disabled by default in server profile) - 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: - LAM Pro:
-> 389ds: new wildcards for custom scripts: $INFO.389lockingStatusChange$ and $INFO.389deactivationStatusChange$ -> 389ds: new wildcards for custom scripts: $INFO.389lockingStatusChange$ and $INFO.389deactivationStatusChange$

View File

@ -1000,6 +1000,13 @@ Have fun!
<section id="a_versUpgrade"> <section id="a_versUpgrade">
<title>Version specific upgrade instructions</title> <title>Version specific upgrade instructions</title>
<section>
<title>5.5 -&gt; 5.6</title>
<para>Mail routing: No longer added by default. Use profile editor
to activate by default for new users/groups.</para>
</section>
<section> <section>
<title>5.4 -&gt; 5.5</title> <title>5.4 -&gt; 5.5</title>
@ -4447,11 +4454,28 @@ mysql&gt; GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
<section> <section>
<title>Mail routing</title> <title>Mail routing</title>
<para>LAM supports to manage mail routing for user accounts. You can <para>LAM supports to manage mail routing for user accounts.</para>
specify a routing address, the mail server and a number of local
addresses to route. This feature can be activated by adding the "Mail <para>Module activation:</para>
routing" module to the user account type in your server
profile.</para> <para>This feature can be activated by adding the "Mail routing"
module to the user account type in your server profile.</para>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="images/mailRoutingConfig.png" />
</imageobject>
</mediaobject>
</screenshot>
<para>Usage:</para>
<para>You can specify a routing address, the mail server and a number
of local addresses to route.</para>
<para>In case you want to add this extension by default for new users
there is an option in profile editor.</para>
<screenshot> <screenshot>
<mediaobject> <mediaobject>
@ -4986,6 +5010,41 @@ mysql&gt; GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
</screenshot> </screenshot>
</section> </section>
<section>
<title>Mail routing</title>
<para>LAM supports to manage mail routing for group accounts.</para>
<para>Module activation:</para>
<para>This feature can be activated by adding the "Mail routing"
module to the group account type in your server profile.</para>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="images/mailRoutingConfigGroup.png" />
</imageobject>
</mediaobject>
</screenshot>
<para>Usage:</para>
<para>You can specify a routing address, the mail server and a number
of local addresses to route.</para>
<para>In case you want to add this extension by default for new groups
there is an option in profile editor.</para>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="images/mailRoutingGroup.png" />
</imageobject>
</mediaobject>
</screenshot>
</section>
<section> <section>
<title>Quota</title> <title>Quota</title>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -34,13 +34,24 @@ $Id$
*/ */
class inetLocalMailRecipient extends baseModule { 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. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { 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 // profile options
$profileContainer = new htmlTable(); $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')); $profileContainer->addElement(new htmlTableExtendedInputField(_('Mail server'), 'inetLocalMailRecipient_host', null, 'mailHost'));
$return['profile_options'] = $profileContainer; $return['profile_options'] = $profileContainer;
// profile checks // profile checks
@ -135,6 +147,22 @@ class inetLocalMailRecipient extends baseModule {
$this->messages['mailHost'][1] = array('ERROR', _('Account %s:') . ' inetLocalMailRecipient_server', 'Mail server is invalid!'); $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. * Returns the HTML meta data for the main account page.
* *
@ -142,6 +170,7 @@ class inetLocalMailRecipient extends baseModule {
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlTable();
if (in_array('inetLocalMailRecipient', $this->attributes['objectClass'])) {
// mail routing address // mail routing address
$this->addSimpleInputTextField($return, 'mailRoutingAddress', _('Routing address')); $this->addSimpleInputTextField($return, 'mailRoutingAddress', _('Routing address'));
// mail server // mail server
@ -169,6 +198,15 @@ class inetLocalMailRecipient extends baseModule {
$return->addElement(new htmlButton('addAdr', 'add.png', true)); $return->addElement(new htmlButton('addAdr', 'add.png', true));
$return->addElement(new htmlHelpLink('localAdr')); $return->addElement(new htmlHelpLink('localAdr'));
$return->addElement(new htmlHiddenInput('adr_number', sizeof($localAdresses))); $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')));
}
return $return; return $return;
} }
@ -179,6 +217,22 @@ class inetLocalMailRecipient extends baseModule {
* @return array list of info/error messages * @return array list of info/error messages
*/ */
function process_attributes() { 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(); $errors = array();
$this->attributes['mailRoutingAddress'] = array(); $this->attributes['mailRoutingAddress'] = array();
$this->attributes['mailLocalAddress'] = array(); $this->attributes['mailLocalAddress'] = array();
@ -243,6 +297,26 @@ class inetLocalMailRecipient extends baseModule {
return $errors; return $errors;
} }
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
* <br>This function returns an array with 3 entries:
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
* <br>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)
* <br>"add" are attributes which have to be added to LDAP entry
* <br>"remove" are attributes which have to be removed from LDAP entry
* <br>"modify" are attributes which have to been modified in LDAP entry
* <br>"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. * In this function the LDAP account is built up.
* *