diff --git a/conf/config.inc.php b/conf/config.inc.php index e232141..e6173e7 100644 --- a/conf/config.inc.php +++ b/conf/config.inc.php @@ -137,6 +137,8 @@ $use_searchlocked = true; +$use_searchdisabled = true; + $use_searchexpired = true; $use_searchwillexpire = true; @@ -149,6 +151,12 @@ $use_disableaccount = false; $show_enablestatus = false; +$use_enablecomment = false; +$use_enablecomment_required = false; +$use_disablecomment = false; +$use_disablecomment_required = false; + + # Local password policy # This is applied before directory password policy # Minimal length diff --git a/docs/enableaccount.rst b/docs/enableaccount.rst index 8b88451..e7f6dee 100644 --- a/docs/enableaccount.rst +++ b/docs/enableaccount.rst @@ -31,3 +31,25 @@ To enable this feature: .. code-block:: php $use_disableaccount = true; + +Insert comment +-------------- + +This feature displays a comment pop-up when enabling and disabling user accounts. + +To enable this feature: + +.. code-block:: php + + $use_enablecomment = true; + $use_disablecomment = true; + +Comment required +---------------- + +This feature ensures a comment is required before enabling/disabling a user. + +.. code-block:: php + + $use_enablecomment_required = true; + $use_disablecomment_required = true; diff --git a/htdocs/disableaccount.php b/htdocs/disableaccount.php index f54b424..ce3e1ba 100644 --- a/htdocs/disableaccount.php +++ b/htdocs/disableaccount.php @@ -6,6 +6,7 @@ $result = ""; $dn = ""; $password = ""; +$comment = ""; if (isset($_POST["dn"]) and $_POST["dn"]) { $dn = $_POST["dn"]; @@ -13,6 +14,11 @@ $result = "dnrequired"; } +if (isset($_POST["comment"]) and $_POST["comment"]) { + $comment = $_POST["comment"]; +} + + if (!$use_disableaccount) { $result = "actionforbidden"; } @@ -38,7 +44,7 @@ } if ($audit_log_file) { - auditlog($audit_log_file, $dn, $audit_admin, "disableaccount", $result); + auditlog($audit_log_file, $dn, $audit_admin, "disableaccount", $result, $comment); } header('Location: index.php?page=display&dn='.$dn.'&disableaccountresult='.$result); diff --git a/htdocs/enableaccount.php b/htdocs/enableaccount.php index 0756186..95e2616 100644 --- a/htdocs/enableaccount.php +++ b/htdocs/enableaccount.php @@ -5,16 +5,23 @@ $result = ""; $dn = ""; -$password = ""; +$comment = ""; +$returnto = "display"; if (isset($_POST["dn"]) and $_POST["dn"]) { $dn = $_POST["dn"]; +} else if (isset($_GET["dn"]) and $_GET["dn"]) { + $dn = $_GET["dn"]; } else { $result = "dnrequired"; } -if (!$use_enableaccount) { - $result = "actionforbidden"; +if (isset($_GET["returnto"]) and $_GET["returnto"]) { + $returnto = $_GET["returnto"]; +} + +if (isset($_POST["comment"]) and $_POST["comment"]) { + $comment = $_POST["comment"]; } if ($result === "") { @@ -38,7 +45,7 @@ } if ($audit_log_file) { - auditlog($audit_log_file, $dn, $audit_admin, "enableaccount", $result); + auditlog($audit_log_file, $dn, $audit_admin, "enableaccount", $result, $comment); } -header('Location: index.php?page=display&dn='.$dn.'&enableaccountresult='.$result); +header('Location: index.php?page='.$returnto.'&dn='.$dn.'&enableaccountresult='.$result); diff --git a/htdocs/index.php b/htdocs/index.php index c2a48f4..6c2bd9b 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -179,6 +179,7 @@ $smarty->assign('show_expirestatus',$show_expirestatus); $smarty->assign('display_password_expiration_date',$display_password_expiration_date); $smarty->assign('use_searchlocked',$use_searchlocked); +$smarty->assign('use_searchdisabled',$use_searchdisabled); $smarty->assign('use_searchexpired',$use_searchexpired); $smarty->assign('use_searchwillexpire',$use_searchwillexpire); $smarty->assign('use_searchidle',$use_searchidle); @@ -187,6 +188,10 @@ $smarty->assign('use_enableaccount',$use_enableaccount); $smarty->assign('use_disableaccount',$use_disableaccount); $smarty->assign('show_enablestatus',$show_enablestatus); +$smarty->assign('use_enablecomment',$use_enablecomment); +$smarty->assign('use_enablecomment_required',$use_enablecomment_required); +$smarty->assign('use_disablecomment',$use_disablecomment); +$smarty->assign('use_disablecomment_required',$use_disablecomment_required); # Assign messages @@ -241,7 +246,9 @@ if ( $page === "checkpassword" and !$use_checkpassword ) { $page = "welcome"; } if ( $page === "resetpassword" and !$use_resetpassword ) { $page = "welcome"; } if ( $page === "unlockaccount" and !$use_unlockaccount ) { $page = "welcome"; } +if ( $page === "enableaccount" and !$use_enableaccount ) { $page = "welcome"; } if ( $page === "searchlocked" and !$use_searchlocked ) { $page = "welcome"; } +if ( $page === "searchdisabled" and !$use_searchdisabled ) { $page = "welcome"; } if ( $page === "searchexpired" and !$use_searchexpired ) { $page = "welcome"; } if ( $page === "searchwillexpire" and !$use_searchwillexpire ) { $page = "welcome"; } if ( $page === "searchidle" and !$use_searchidle ) { $page = "welcome"; } diff --git a/htdocs/searchdisabled.php b/htdocs/searchdisabled.php new file mode 100644 index 0000000..cc3d66f --- /dev/null +++ b/htdocs/searchdisabled.php @@ -0,0 +1,45 @@ +search($ldap_user_filter, array(), $attributes_map, $search_result_title, $search_result_sortby, $search_result_items, $ldap_scope); + +if ( !empty($entries) ) +{ + + # Check if entry is still locked + foreach($entries as $entry_key => $entry) { + + $isEnabled = $directory->isAccountEnabled($ldap, $entry['dn']); + + if ( $isEnabled === true ) { + unset($entries[$entry_key]); + $nb_entries--; + } + + } + + $smarty->assign("page_title", "disabledaccounts"); + if ($nb_entries === 0) { + $result = "noentriesfound"; + } else { + $smarty->assign("nb_entries", $nb_entries); + $smarty->assign("entries", $entries); + $smarty->assign("size_limit_reached", $size_limit_reached); + + $columns = $search_result_items; + if (! in_array($search_result_title, $columns)) array_unshift($columns, $search_result_title); + $smarty->assign("listing_columns", $columns); + $smarty->assign("listing_linkto", isset($search_result_linkto) ? $search_result_linkto : array($search_result_title)); + $smarty->assign("listing_sortby", array_search($search_result_sortby, $columns)); + $smarty->assign("show_undef", $search_result_show_undefined); + $smarty->assign("truncate_value_after", $search_result_truncate_value_after); + if ($use_enableaccount) { $smarty->assign("display_enable_button", true); } + } +} + +?> diff --git a/lang/en.inc.php b/lang/en.inc.php index ca8e65d..06d7e82 100644 --- a/lang/en.inc.php +++ b/lang/en.inc.php @@ -26,6 +26,7 @@ $messages['currentpassword'] = "Current password"; $messages['dashboards'] = "Dashboards"; $messages['disableaccount'] = "Disable account"; +$messages['disabledaccounts'] = "Disabled accounts"; $messages['displayentry'] = "Display entry"; $messages['dnrequired'] = "Entry identifier required"; $messages['editentry'] = "Edit entry"; diff --git a/lang/fr.inc.php b/lang/fr.inc.php index f9d27a0..e7357f9 100644 --- a/lang/fr.inc.php +++ b/lang/fr.inc.php @@ -8,13 +8,13 @@ $messages['accountdisabled'] = "Le compte est désactivé"; $messages['auditlogs'] = "Audit"; $messages['auditlogtitle'] = "Traces d'audit pour les $audit_log_days derniers jours"; -$messages['accountlocked'] = "Le compte est bloqué"; +$messages['accountlocked'] = "Le compte est verrouillé"; $messages['accountnotdisabled'] = "Échec de la désactivation du compte"; $messages['accountnotenabled'] = "Échec de l'activation du compte"; -$messages['accountnotlocked'] = "Échec de blocage du compte"; -$messages['accountnotunlocked'] = "Échec de déblocage du compte"; +$messages['accountnotlocked'] = "Échec de verrouillage du compte"; +$messages['accountnotunlocked'] = "Échec de déverrouillage du compte"; $messages['accountstatus'] = "Statut du compte"; -$messages['accountunlocked'] = "Le compte n'est pas bloqué"; +$messages['accountunlocked'] = "Le compte n'est pas verrouillé"; $messages['actionforbidden'] = "Action interdite"; $messages['changesubject'] = "Votre mot de passe a été changé"; $messages['changesubjectforadmin'] = "Le mot de passe d'un utilisateur a été changé"; @@ -26,6 +26,7 @@ $messages['currentpassword'] = "Mot de passe actuel"; $messages['dashboards'] = "Tableaux de bord"; $messages['disableaccount'] = "Désactiver le compte"; +$messages['disabledaccounts'] = "Comptes désactivés"; $messages['displayentry'] = "Afficher l'entrée"; $messages['dnrequired'] = "L'identifiant de l'entrée est requis"; $messages['editentry'] = "Modifier l'entrée"; @@ -74,7 +75,7 @@ $messages['label_phone'] = "Téléphone"; $messages['label_postaladdress'] = "Adresse"; $messages['label_postalcode'] = "Code postal"; -$messages['label_pwdaccountlockedtime'] = "Date de blocage"; +$messages['label_pwdaccountlockedtime'] = "Date de verrouillage"; $messages['label_pwdchangedtime'] = "Dernier changement de mot de passe"; $messages['label_pwdfailuretime'] = "Derniers échecs d'authentification"; $messages['label_pwdpolicysubentry'] = "Politique des mots de passe associée"; @@ -86,8 +87,8 @@ $messages['label_title'] = "Titre"; $messages['label_user_dn'] = "Utilisateur"; $messages['ldaperror'] = "Erreur de communication avec l'annuaire LDAP"; -$messages['lockaccount'] = "Bloquer le compte"; -$messages['lockedaccounts'] = "Comptes bloqués"; +$messages['lockaccount'] = "Verrouiller le compte"; +$messages['lockedaccounts'] = "Comptes verrouillés"; $messages['logout'] = "Déconnexion"; $messages['newpassword'] = "Nouveau mot de passe"; $messages['noentriesfound'] = "Aucune entrée trouvée"; @@ -111,7 +112,7 @@ $messages['tooltip_emailto'] = "Envoyer un email"; $messages['tooltip_phoneto'] = "Composer ce numéro"; $messages['true'] = "Oui"; -$messages['unlockaccount'] = "Débloquer le compte"; +$messages['unlockaccount'] = "Déverrouiller le compte"; $messages['unlockdate'] = "Date de déblocage automatique :"; $messages['welcome'] = "Bienvenue sur le guichet de service LDAP Tool Box"; $messages['willexpireaccounts'] = "Mots de passe bientôt expirés"; diff --git a/templates/comment.tpl b/templates/comment.tpl index 8550a87..17172d7 100644 --- a/templates/comment.tpl +++ b/templates/comment.tpl @@ -7,7 +7,13 @@