Commit 838fab37 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(user-reminder): Add a config section for ppolicy alerts

This adds a config section specific to ppolicy expiration alerts, as
 they do not contain a token link should instead explain how to change
 the password.

issue #5723
Showing with 64 additions and 6 deletions
+64 -6
...@@ -61,6 +61,32 @@ class userReminderConfig extends simplePlugin ...@@ -61,6 +61,32 @@ class userReminderConfig extends simplePlugin
), ),
) )
), ),
'emailppolicy' => array(
'name' => _('Ppolicy email settings'),
'attrs' => array(
new BooleanAttribute (
_('Forward alerts to the manager'), _('Forward ppolicy alerts to the manager'),
'fdUserReminderForwardPpolicyAlert', FALSE,
TRUE
),
new StringAttribute (
_('Subject'), _('Subject of the ppolicy alert email'),
'fdUserReminderPpolicyAlertSubject', FALSE,
_('[FusionDirectory] Your password is about to expire')
),
new TextAreaAttribute (
_('Body (%s are cn and login)'),
_('Body of the ppolicy alert email, sent when the user password is about to expire. Use %s for the cn and uid.'),
'fdUserReminderPpolicyAlertBody', FALSE,
_('Dear %1$s,'."\n".
'your password for account %2$s is about to expire, please change your password: '."\n".
'https://'.$_SERVER['SERVER_NAME'].
(($_SERVER['SERVER_PORT'] != '80') ? ':'.$_SERVER['SERVER_PORT'] : '').
(empty($_SERVER['REQUEST_URI']) ? $_SERVER['PATH_INFO'] : $_SERVER['REQUEST_URI']).
"\n")
)
)
),
'email1' => array( 'email1' => array(
'name' => _('Alert email settings'), 'name' => _('Alert email settings'),
'attrs' => array( 'attrs' => array(
...@@ -71,13 +97,13 @@ class userReminderConfig extends simplePlugin ...@@ -71,13 +97,13 @@ class userReminderConfig extends simplePlugin
), ),
new StringAttribute ( new StringAttribute (
_('Subject'), _('Subject of the alert email'), _('Subject'), _('Subject of the alert email'),
'fdUserReminderAlertSubject', TRUE, 'fdUserReminderAlertSubject', FALSE,
_('[FusionDirectory] Your account is about to expire') _('[FusionDirectory] Your account is about to expire')
), ),
new TextAreaAttribute ( new TextAreaAttribute (
_('Body (%s are cn, login, and link token)'), _('Body (%s are cn, login, and link token)'),
_('Body of the alert email, sent when the user is about to expire. Use %s for the cn, uid and token.'), _('Body of the alert email, sent when the user is about to expire. Use %s for the cn, uid and token.'),
'fdUserReminderAlertBody', TRUE, 'fdUserReminderAlertBody', FALSE,
_('Dear %1$s,'."\n". _('Dear %1$s,'."\n".
'your account %2$s is about to expire, please use this link to avoid this: '."\n". 'your account %2$s is about to expire, please use this link to avoid this: '."\n".
'https://'.$_SERVER['SERVER_NAME']. 'https://'.$_SERVER['SERVER_NAME'].
...@@ -116,6 +142,17 @@ class userReminderConfig extends simplePlugin ...@@ -116,6 +142,17 @@ class userReminderConfig extends simplePlugin
); );
} }
function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE, $attributesInfo = NULL)
{
parent::__construct($dn, $object, $parent, $mainTab);
if (!class_available('ppolicy')) {
$this->attributesAccess['fdUserReminderForwardPpolicyAlert']->setDisabled(TRUE);
$this->attributesAccess['fdUserReminderPpolicyAlertSubject']->setDisabled(TRUE);
$this->attributesAccess['fdUserReminderPpolicyAlertBody']->setDisabled(TRUE);
}
}
protected function post_save() protected function post_save()
{ {
global $config; global $config;
......
...@@ -64,13 +64,30 @@ attributetype ( 1.3.6.1.4.1.38414.59.1.10 NAME 'fdUserReminderConfirmationBody' ...@@ -64,13 +64,30 @@ attributetype ( 1.3.6.1.4.1.38414.59.1.10 NAME 'fdUserReminderConfirmationBody'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE ) SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.59.1.11 NAME 'fdReminderTokenRDN' attributetype ( 1.3.6.1.4.1.38414.59.1.11 NAME 'fdReminderTokenRDN'
DESC 'FusionDirectory - User Reminder Token RDN' DESC 'FusionDirectory - User Reminder Token RDN'
EQUALITY caseExactIA5Match EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE) SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.59.1.12 NAME 'fdUserReminderForwardPpolicyAlert'
DESC 'FusionDirectory - Forward ppolicy alerts to manager'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.59.1.13 NAME 'fdUserReminderPpolicyAlertSubject'
DESC 'Fusion Directory - User reminder ppolicy alert email subject'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.59.1.14 NAME 'fdUserReminderPpolicyAlertBody'
DESC 'Fusion Directory - User reminder ppolicy alert email body'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
# Object Class # Object Class
...@@ -79,5 +96,9 @@ objectclass ( 1.3.6.1.4.1.38414.59.2.1 NAME 'fdUserReminderPluginConf' ...@@ -79,5 +96,9 @@ objectclass ( 1.3.6.1.4.1.38414.59.2.1 NAME 'fdUserReminderPluginConf'
SUP top AUXILIARY SUP top AUXILIARY
MUST ( cn $ fdReminderTokenRDN $ fdUserReminderAlertDelay $ fdUserReminderResendDelay $ MUST ( cn $ fdReminderTokenRDN $ fdUserReminderAlertDelay $ fdUserReminderResendDelay $
fdUserReminderPostponeDays $ fdUserReminderForwardAlert $ fdUserReminderForwardConfirmation $ fdUserReminderPostponeDays $ fdUserReminderForwardAlert $ fdUserReminderForwardConfirmation $
fdUserReminderEmail $ fdUserReminderAlertSubject $ fdUserReminderAlertBody) fdUserReminderEmail )
MAY ( fdUserReminderConfirmationSubject $ fdUserReminderConfirmationBody ) ) MAY (
fdUserReminderConfirmationSubject $ fdUserReminderConfirmationBody $
fdUserReminderAlertSubject $ fdUserReminderAlertBody $
fdUserReminderPpolicyAlertSubject $ fdUserReminderPpolicyAlertBody $
fdUserReminderForwardPpolicyAlert ) )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment