mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-23 00:43:48 +01:00
LSaddon::ppolicy: improve password expiration extra displayed column
Add LStip to show password last changed date and password max age.
This commit is contained in:
parent
2d08374a53
commit
78af62d428
4 changed files with 53 additions and 19 deletions
|
@ -137,20 +137,22 @@ function get_ppolicy_password_max_age($ppolicy_dn=null) {
|
|||
* @param string $text The text of the badge
|
||||
* @param string $bg_color The background color of the badge (optional, default: green)
|
||||
* @param string $color The text color of the badge (optional, default: white)
|
||||
* @param string $title The text title of the badge (optional, default: empty string)
|
||||
*
|
||||
* @return string The HTML code of the badge
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*/
|
||||
function _ppolicy_badge($text, $bg_color='green', $color='white') {
|
||||
function _ppolicy_badge($text, $bg_color='green', $color='white', $title='') {
|
||||
// Disable HTML formating on PHP cli
|
||||
if (php_sapi_name() == 'cli') return $text;
|
||||
return sprintf(
|
||||
'<span style="
|
||||
background-color: %s; color: %s;
|
||||
padding: 0.2em; font-size: 0.8em; border-radius: 0.4em;"
|
||||
class="LStips" title="%s"
|
||||
>%s</span>',
|
||||
$bg_color, $color, $text
|
||||
$bg_color, $color, $title, $text
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -170,7 +172,10 @@ function ppolicy_extraDisplayColumn_password_expiration($entry) {
|
|||
$change_time = ldapDate2Timestamp($change_time);
|
||||
$max_age = get_ppolicy_password_max_age($entry->pwdPolicySubentry);
|
||||
if ($max_age === false)
|
||||
return _ppolicy_badge(__('Unknown'), 'gray');
|
||||
return _ppolicy_badge(
|
||||
__('Unknown'), 'gray', 'white',
|
||||
sprintf(_('Last password changed: %s, no duration of validity configured.'), date('Y-m-d H:i', $change_time))
|
||||
);
|
||||
if (!$max_age)
|
||||
return _('Never');
|
||||
$expiration_date = $change_time + $max_age;
|
||||
|
@ -178,7 +183,9 @@ function ppolicy_extraDisplayColumn_password_expiration($entry) {
|
|||
if ($expiration_date <= $now)
|
||||
return _ppolicy_badge(
|
||||
sprintf(_('Expired (since %s)'), date('Y-m-d H:i', $expiration_date)),
|
||||
'black');
|
||||
'black', 'white',
|
||||
sprintf(_('Last password changed: %s, duration of validity: %s days'), date('Y-m-d H:i', $change_time), floor($max_age/86400))
|
||||
);
|
||||
$delta = $expiration_date - $now;
|
||||
if ($delta <= LS_PPOLICY_CRITICAL_EXPIRATION_THRESHOLD)
|
||||
$badge_color = 'red';
|
||||
|
@ -188,7 +195,9 @@ function ppolicy_extraDisplayColumn_password_expiration($entry) {
|
|||
$badge_color = 'green';
|
||||
return _ppolicy_badge(
|
||||
sprintf(_('Expire on %s'), date('Y-m-d H:i', $expiration_date)),
|
||||
$badge_color);
|
||||
$badge_color, 'white',
|
||||
sprintf(_('Last password changed: %s, duration of validity: %s days'), date('Y-m-d H:i', $change_time), floor($max_age/86400))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Project-Id-Version: LdapSaisie\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2023-10-13 18:57+0200\n"
|
||||
"PO-Revision-Date: 2023-12-05 12:48+0100\n"
|
||||
"Last-Translator: Benjamin Renard <brenard@easter-eggs.com>\n"
|
||||
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
|
||||
"org>\n"
|
||||
|
@ -56,26 +56,40 @@ msgstr ""
|
|||
"Politique de mots de passe : Une erreur est survenue en écrivant une ligne "
|
||||
"CSV."
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:169
|
||||
#: includes/addons/LSaddons.ppolicy.php:175
|
||||
#: includes/addons/LSaddons.ppolicy.php:171
|
||||
#: includes/addons/LSaddons.ppolicy.php:180
|
||||
msgid "Never"
|
||||
msgstr "Jamais"
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:173
|
||||
#: includes/addons/LSaddons.ppolicy.php:176
|
||||
msgid "Unknown"
|
||||
msgstr "Inconnu"
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:180
|
||||
#: includes/addons/LSaddons.ppolicy.php:177
|
||||
#, php-format
|
||||
msgid "Last password changed: %s, no duration of validity configured."
|
||||
msgstr ""
|
||||
"Dernière modification du mot de passe : %s, pas de durée de validité "
|
||||
"configurée."
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:185
|
||||
#, php-format
|
||||
msgid "Expired (since %s)"
|
||||
msgstr "Expiré (depuis %s)"
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:190
|
||||
#: includes/addons/LSaddons.ppolicy.php:187
|
||||
#: includes/addons/LSaddons.ppolicy.php:199
|
||||
#, php-format
|
||||
msgid "Last password changed: %s, duration of validity: %s days"
|
||||
msgstr ""
|
||||
"Dernière modification du mot de passe : %s, durée de validité : %s jours."
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:197
|
||||
#, php-format
|
||||
msgid "Expire on %s"
|
||||
msgstr "Expirera le %s"
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:260
|
||||
#: includes/addons/LSaddons.ppolicy.php:269
|
||||
msgid "Not set"
|
||||
msgstr "Non défini"
|
||||
|
||||
|
@ -557,7 +571,7 @@ msgstr ""
|
|||
#: includes/addons/LSaddons.ftp.php:48
|
||||
msgid "FTP: Unable to delete file %{file} on the remote server."
|
||||
msgstr ""
|
||||
"FTP : Impossible de supprimer le fichier %{dir} sur le serveur distant."
|
||||
"FTP : Impossible de supprimer le fichier %{file} sur le serveur distant."
|
||||
|
||||
#: includes/addons/LSaddons.ftp.php:51
|
||||
msgid ""
|
||||
|
|
|
@ -22,26 +22,37 @@ msgstr ""
|
|||
msgid "Password policy: An error occured writing a CSV row."
|
||||
msgstr ""
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:169
|
||||
#: includes/addons/LSaddons.ppolicy.php:175
|
||||
#: includes/addons/LSaddons.ppolicy.php:171
|
||||
#: includes/addons/LSaddons.ppolicy.php:180
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:173
|
||||
#: includes/addons/LSaddons.ppolicy.php:176
|
||||
msgid "Unknown"
|
||||
msgstr ""
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:180
|
||||
#: includes/addons/LSaddons.ppolicy.php:177
|
||||
#, php-format
|
||||
msgid "Last password changed: %s, no duration of validity configured."
|
||||
msgstr ""
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:185
|
||||
#, php-format
|
||||
msgid "Expired (since %s)"
|
||||
msgstr ""
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:190
|
||||
#: includes/addons/LSaddons.ppolicy.php:187
|
||||
#: includes/addons/LSaddons.ppolicy.php:199
|
||||
#, php-format
|
||||
msgid "Last password changed: %s, duration of validity: %s days"
|
||||
msgstr ""
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:197
|
||||
#, php-format
|
||||
msgid "Expire on %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/addons/LSaddons.ppolicy.php:260
|
||||
#: includes/addons/LSaddons.ppolicy.php:269
|
||||
msgid "Not set"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in a new issue