Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

125 block account #169

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"datatables.net/datatables.net-bs5": "2.0.8",
"datatables.net/datatables.net-buttons-bs5": "3.0.2",
"fortawesome/font-awesome": "v6.5.2",
"ltb-project/ltb-common": "dev-main",
"ltb-project/ltb-common": "dev-44-openldap-account-disabling",
"twbs/bootstrap": "v5.3.2"
},
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion htdocs/disableaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
$result = "";
$dn = "";
$password = "";
$comment = "";

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
} else {
$result = "dnrequired";
}

if (isset($_POST["comment"]) and $_POST["comment"]) {
$comment = $_POST["comment"];
}


if (!$use_disableaccount) {
$result = "actionforbidden";
}
Expand All @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment modal is only defined for now in lock/unlock panel in the HTML template.

We may add comment for all action, but this should maybe done in a separate PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'll do another PR for the comment feature...

Anyway, the last argument of the function auditlog is needed, else Service-Desk crashes.

}

header('Location: index.php?page=display&dn='.$dn.'&disableaccountresult='.$result);
24 changes: 0 additions & 24 deletions htdocs/display.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems some cleaning has to be done, as I forgot to remove OpenLDAP specific code. With the merge of AD support branch, we should have no more any reference to an OpenLDAP specific attribute.

Maybe this should also be part of another PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done in #170

Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
$isAccountEnabled = $directory->isAccountEnabled($ldap, $dn);
}

$isLocked = false;
$unlockDate = "";
$isExpired = false;
$ppolicy_entry = "";
Expand All @@ -145,29 +144,6 @@
{
$pwdLockoutDuration = $ppolicy_entry[0]['pwdlockoutduration'][0];
}
if(isset($entry[0]['pwdaccountlockedtime'][0]))
{
$pwdAccountLockedTime = $entry[0]['pwdaccountlockedtime'][0];
}
else
{
$pwdAccountLockedTime = null;
}

if ( $pwdAccountLockedTime === "000001010000Z" ) {
$isLocked = true;
unset($entry[0]['pwdaccountlockedtime']);
} else if (isset($pwdAccountLockedTime)) {
if (isset($pwdLockoutDuration) and ($pwdLockoutDuration > 0)) {
$lockDate = ldapDate2phpDate($pwdAccountLockedTime);
$unlockDate = date_add( $lockDate, new DateInterval('PT'.$pwdLockoutDuration.'S'));
if ( time() <= $unlockDate->getTimestamp() ) {
$isLocked = true;
}
} else {
$isLocked = true;
}
}

# Expiration
if(isset($ppolicy_entry[0]['pwdmaxage'][0]))
Expand Down
8 changes: 7 additions & 1 deletion htdocs/enableaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
$result = "";
$dn = "";
$password = "";
$comment = "";

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
} else {
$result = "dnrequired";
}

if (isset($_POST["comment"]) and $_POST["comment"]) {
$comment = $_POST["comment"];
}


if (!$use_enableaccount) {
$result = "actionforbidden";
}
Expand All @@ -38,7 +44,7 @@
}

if ($audit_log_file) {
auditlog($audit_log_file, $dn, $audit_admin, "enableaccount", $result);
auditlog($audit_log_file, $dn, $audit_admin, "enableaccount", $result, $comment);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same than previous comment, this need an adaptation of HTML template,

}

header('Location: index.php?page=display&dn='.$dn.'&enableaccountresult='.$result);
16 changes: 8 additions & 8 deletions lang/fr.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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é";
Expand Down Expand Up @@ -74,7 +74,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";
Expand All @@ -86,8 +86,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";
Expand All @@ -110,7 +110,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";
Expand Down
Loading