Skip to content

Commit

Permalink
Use new lockDate function to remove OpenLDAP specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Aug 21, 2024
1 parent 258b483 commit e992671
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
$display_items = array('identifier', 'firstname', 'lastname', 'title', 'businesscategory', 'employeenumber', 'employeetype', 'mail', 'mailquota', 'phone', 'mobile', 'fax', 'postaladdress', 'street', 'postalcode', 'l', 'state', 'organizationalunit', 'organization', 'manager', 'secretary' );
$display_title = "fullname";
$display_show_undefined = false;
$display_password_items = array('pwdchangedtime', 'pwdaccountlockedtime', 'pwdfailuretime','pwdpolicysubentry', 'authtimestamp', 'pwdlastsuccess', 'created', 'modified');
$display_password_items = array('pwdchangedtime', 'pwdfailuretime','pwdpolicysubentry', 'authtimestamp', 'pwdlastsuccess', 'created', 'modified');
$display_password_expiration_date = true;

# Features
Expand Down
9 changes: 3 additions & 6 deletions htdocs/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$ldapExpirationDate="";
$canLockAccount="";
$isAccountEnabled = "";
$lockDate = "";

if (isset($_GET["dn"]) and $_GET["dn"]) {
$dn = $_GET["dn"];
Expand Down Expand Up @@ -104,13 +105,8 @@
$edit_link = str_replace("{dn}", urlencode($dn), $display_edit_link);
}

# Remove lockout date if special value
$lockoutDateAttribute = $attributes_map['pwdaccountlockedtime']['attribute'];
if ( isset($entry[0][$lockoutDateAttribute]) and $entry[0][$lockoutDateAttribute][0] === "000001010000Z") {
unset($entry[0][$lockoutDateAttribute]);
}

$lockoutDuration = $directory->getLockoutDuration($ldap, $dn, array('pwdPolicy' => $pwdPolicy, 'lockoutDuration' => $ldap_lockout_duration));
$lockDate = $directory->getLockDate($ldap, $dn);
$unlockDate = $directory->getUnlockDate($ldap, $dn, array('lockoutDuration' => $lockoutDuration));
$isLocked = $directory->isLocked($ldap, $dn, array('lockoutDuration' => $lockoutDuration));
$canLockAccount = $directory->canLockAccount($ldap, $dn, array('pwdPolicy' => $pwdPolicy));
Expand All @@ -136,6 +132,7 @@
$smarty->assign("show_undef", $display_show_undefined);

$smarty->assign("isLocked", $isLocked);
$smarty->assign("lockDate", $lockDate);
$smarty->assign("unlockDate", $unlockDate);
$smarty->assign("isExpired", $isExpired);
$smarty->assign("ldapExpirationDate", $expirationDate ? $expirationDate->getTimestamp(): NULL);
Expand Down
10 changes: 10 additions & 0 deletions templates/display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
</td>
</tr>
{/foreach}
{if $lockDate}
<tr>
<th class="col-md-6">
{$msg_label_pwdaccountlockedtime}
</th>
<td class="col-md-6">
{$lockDate|date_format:{$date_specifiers}|truncate:10000}
</td>
</tr>
{/if}
{if {$display_password_expiration_date} and {$ldapExpirationDate}}
<tr>
<th class="col-md-6">
Expand Down

0 comments on commit e992671

Please sign in to comment.