Skip to content

Commit

Permalink
Use new ltb-common Directory functions
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Jul 22, 2024
1 parent 259ace4 commit 5c25b59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
$ldap_lastauth_attribute = "authTimestamp";
#$ldap_network_timeout = 10;
$ldap_type = "openldap";
#$ldap_lockout_duration = 3600;

# How display attributes
$attributes_map = array(
Expand Down
12 changes: 7 additions & 5 deletions htdocs/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
$prehookresult= "";
$posthookresult= "";
$ldapExpirationDate="";
$canLockAccount="";

if (isset($_GET["dn"]) and $_GET["dn"]) {
$dn = $_GET["dn"];
Expand Down Expand Up @@ -71,7 +72,6 @@

# Search entry
$search = ldap_read($ldap, $dn, $ldap_user_filter, $attributes);

$errno = ldap_errno($ldap);

if ( $errno ) {
Expand Down Expand Up @@ -103,10 +103,12 @@
$edit_link = str_replace("{dn}", urlencode($dn), $display_edit_link);
}

$unlockDate = "";
$isExpired = false;
$lockoutDuration = $directory->getLockoutDuration($ldap, $dn, array('pwdPolicy' => $pwdPolicy, 'lockoutDuration' => $ldap_lockout_duration));
$unlockDate = $directory->getUnlockDate($ldap, $dn, array('lockoutDuration' => $lockoutDuration));
$isLocked = $directory->isLocked($ldap, $dn, array('lockoutDuration' => $lockoutDuration));
$canLockAccount = $directory->canLockAccount($ldap, $dn, array('pwdPolicy' => $pwdPolicy));

$isLocked = $directory->isLocked($ldap, $dn, array( 'pwdpolicy' => $pwdPolicy ));
$isExpired = false;

if ($pwdPolicy) {
$search_ppolicy = ldap_read($ldap, $pwdPolicy, "(objectClass=pwdPolicy)", array('pwdMaxAge'));
Expand Down Expand Up @@ -158,5 +160,5 @@
$smarty->assign("accountlockresult", $accountlockresult);
$smarty->assign("prehookresult", $prehookresult);
$smarty->assign("posthookresult", $posthookresult);
if ($pwdLockout == false) $smarty->assign("use_lockaccount", $pwdLockout);
if ($canLockAccount == false) $smarty->assign("use_lockaccount", $canLockAccount);
?>

0 comments on commit 5c25b59

Please sign in to comment.