mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-24 10:59:07 +01:00
Compare commits
No commits in common. "2104187b1464369f8660cad14edf46b16151b02a" and "2d08374a535a65b384c9eb8d2d0785454edf3c0a" have entirely different histories.
2104187b14
...
2d08374a53
4 changed files with 20 additions and 54 deletions
|
@ -86,7 +86,7 @@ function LSaddon_ppolicy_support() {
|
||||||
if ($retval) {
|
if ($retval) {
|
||||||
LSurl :: add_handler(
|
LSurl :: add_handler(
|
||||||
'#^api/1.0/exportPpolicyInfo/(?P<LSobject>[^/]+)/?$#',
|
'#^api/1.0/exportPpolicyInfo/(?P<LSobject>[^/]+)/?$#',
|
||||||
'handle_api_LSobject_exportPpolicyInfo',
|
'handle/export_api_LSobject_exportPpolicyInfo',
|
||||||
true, false, true);
|
true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,22 +137,20 @@ function get_ppolicy_password_max_age($ppolicy_dn=null) {
|
||||||
* @param string $text The text of the badge
|
* @param string $text The text of the badge
|
||||||
* @param string $bg_color The background color of the badge (optional, default: green)
|
* @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 $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
|
* @return string The HTML code of the badge
|
||||||
*
|
*
|
||||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
*/
|
*/
|
||||||
function _ppolicy_badge($text, $bg_color='green', $color='white', $title='') {
|
function _ppolicy_badge($text, $bg_color='green', $color='white') {
|
||||||
// Disable HTML formating on PHP cli
|
// Disable HTML formating on PHP cli
|
||||||
if (php_sapi_name() == 'cli') return $text;
|
if (php_sapi_name() == 'cli') return $text;
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<span style="
|
'<span style="
|
||||||
background-color: %s; color: %s;
|
background-color: %s; color: %s;
|
||||||
padding: 0.2em; font-size: 0.8em; border-radius: 0.4em;"
|
padding: 0.2em; font-size: 0.8em; border-radius: 0.4em;"
|
||||||
class="LStips" title="%s"
|
|
||||||
>%s</span>',
|
>%s</span>',
|
||||||
$bg_color, $color, $title, $text
|
$bg_color, $color, $text
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,10 +170,7 @@ function ppolicy_extraDisplayColumn_password_expiration($entry) {
|
||||||
$change_time = ldapDate2Timestamp($change_time);
|
$change_time = ldapDate2Timestamp($change_time);
|
||||||
$max_age = get_ppolicy_password_max_age($entry->pwdPolicySubentry);
|
$max_age = get_ppolicy_password_max_age($entry->pwdPolicySubentry);
|
||||||
if ($max_age === false)
|
if ($max_age === false)
|
||||||
return _ppolicy_badge(
|
return _ppolicy_badge(__('Unknown'), 'gray');
|
||||||
__('Unknown'), 'gray', 'white',
|
|
||||||
sprintf(_('Last password changed: %s, no duration of validity configured.'), date('Y-m-d H:i', $change_time))
|
|
||||||
);
|
|
||||||
if (!$max_age)
|
if (!$max_age)
|
||||||
return _('Never');
|
return _('Never');
|
||||||
$expiration_date = $change_time + $max_age;
|
$expiration_date = $change_time + $max_age;
|
||||||
|
@ -183,9 +178,7 @@ function ppolicy_extraDisplayColumn_password_expiration($entry) {
|
||||||
if ($expiration_date <= $now)
|
if ($expiration_date <= $now)
|
||||||
return _ppolicy_badge(
|
return _ppolicy_badge(
|
||||||
sprintf(_('Expired (since %s)'), date('Y-m-d H:i', $expiration_date)),
|
sprintf(_('Expired (since %s)'), date('Y-m-d H:i', $expiration_date)),
|
||||||
'black', 'white',
|
'black');
|
||||||
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;
|
$delta = $expiration_date - $now;
|
||||||
if ($delta <= LS_PPOLICY_CRITICAL_EXPIRATION_THRESHOLD)
|
if ($delta <= LS_PPOLICY_CRITICAL_EXPIRATION_THRESHOLD)
|
||||||
$badge_color = 'red';
|
$badge_color = 'red';
|
||||||
|
@ -195,9 +188,7 @@ function ppolicy_extraDisplayColumn_password_expiration($entry) {
|
||||||
$badge_color = 'green';
|
$badge_color = 'green';
|
||||||
return _ppolicy_badge(
|
return _ppolicy_badge(
|
||||||
sprintf(_('Expire on %s'), date('Y-m-d H:i', $expiration_date)),
|
sprintf(_('Expire on %s'), date('Y-m-d H:i', $expiration_date)),
|
||||||
$badge_color, 'white',
|
$badge_color);
|
||||||
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"
|
"Project-Id-Version: LdapSaisie\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: \n"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: 2023-12-05 12:48+0100\n"
|
"PO-Revision-Date: 2023-10-13 18:57+0200\n"
|
||||||
"Last-Translator: Benjamin Renard <brenard@easter-eggs.com>\n"
|
"Last-Translator: Benjamin Renard <brenard@easter-eggs.com>\n"
|
||||||
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
|
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
|
||||||
"org>\n"
|
"org>\n"
|
||||||
|
@ -56,40 +56,26 @@ msgstr ""
|
||||||
"Politique de mots de passe : Une erreur est survenue en écrivant une ligne "
|
"Politique de mots de passe : Une erreur est survenue en écrivant une ligne "
|
||||||
"CSV."
|
"CSV."
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:171
|
#: includes/addons/LSaddons.ppolicy.php:169
|
||||||
#: includes/addons/LSaddons.ppolicy.php:180
|
#: includes/addons/LSaddons.ppolicy.php:175
|
||||||
msgid "Never"
|
msgid "Never"
|
||||||
msgstr "Jamais"
|
msgstr "Jamais"
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:176
|
#: includes/addons/LSaddons.ppolicy.php:173
|
||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr "Inconnu"
|
msgstr "Inconnu"
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:177
|
#: includes/addons/LSaddons.ppolicy.php:180
|
||||||
#, 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
|
#, php-format
|
||||||
msgid "Expired (since %s)"
|
msgid "Expired (since %s)"
|
||||||
msgstr "Expiré (depuis %s)"
|
msgstr "Expiré (depuis %s)"
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:187
|
#: includes/addons/LSaddons.ppolicy.php:190
|
||||||
#: 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
|
#, php-format
|
||||||
msgid "Expire on %s"
|
msgid "Expire on %s"
|
||||||
msgstr "Expirera le %s"
|
msgstr "Expirera le %s"
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:269
|
#: includes/addons/LSaddons.ppolicy.php:260
|
||||||
msgid "Not set"
|
msgid "Not set"
|
||||||
msgstr "Non défini"
|
msgstr "Non défini"
|
||||||
|
|
||||||
|
@ -571,7 +557,7 @@ msgstr ""
|
||||||
#: includes/addons/LSaddons.ftp.php:48
|
#: includes/addons/LSaddons.ftp.php:48
|
||||||
msgid "FTP: Unable to delete file %{file} on the remote server."
|
msgid "FTP: Unable to delete file %{file} on the remote server."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"FTP : Impossible de supprimer le fichier %{file} sur le serveur distant."
|
"FTP : Impossible de supprimer le fichier %{dir} sur le serveur distant."
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ftp.php:51
|
#: includes/addons/LSaddons.ftp.php:51
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|
|
@ -22,37 +22,26 @@ msgstr ""
|
||||||
msgid "Password policy: An error occured writing a CSV row."
|
msgid "Password policy: An error occured writing a CSV row."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:171
|
#: includes/addons/LSaddons.ppolicy.php:169
|
||||||
#: includes/addons/LSaddons.ppolicy.php:180
|
#: includes/addons/LSaddons.ppolicy.php:175
|
||||||
msgid "Never"
|
msgid "Never"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:176
|
#: includes/addons/LSaddons.ppolicy.php:173
|
||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:177
|
#: includes/addons/LSaddons.ppolicy.php:180
|
||||||
#, php-format
|
|
||||||
msgid "Last password changed: %s, no duration of validity configured."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:185
|
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Expired (since %s)"
|
msgid "Expired (since %s)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:187
|
#: includes/addons/LSaddons.ppolicy.php:190
|
||||||
#: 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
|
#, php-format
|
||||||
msgid "Expire on %s"
|
msgid "Expire on %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: includes/addons/LSaddons.ppolicy.php:269
|
#: includes/addons/LSaddons.ppolicy.php:260
|
||||||
msgid "Not set"
|
msgid "Not set"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue