From 016025fe2d436a898556fcc2cee467714ab1a877 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 14 May 2016 13:28:22 +0200 Subject: [PATCH] show 389ds deactivation status in account list --- lam/lib/types/user.inc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lam/lib/types/user.inc b/lam/lib/types/user.inc index 9d09f9b8..34f7b023 100644 --- a/lam/lib/types/user.inc +++ b/lam/lib/types/user.inc @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2005 - 2015 Roland Gruber + Copyright (C) 2005 - 2016 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -808,6 +808,7 @@ class lamUserList extends lamList { $attrs[] = 'sambaAcctFlags'; $attrs[] = 'userPassword'; $attrs[] = 'userAccountControl'; + $attrs[] = 'nsAccountLock'; $attrs[] = 'objectClass'; } return $attrs; @@ -866,15 +867,13 @@ class lamUserList extends lamList { $sambaAvailable = self::isSambaAvailable($attrs); $ppolicyAvailable = self::isPPolicyAvailable($attrs); $windowsAvailable = self::isWindowsAvailable($attrs); - if (!$unixAvailable && !$sambaAvailable && !$ppolicyAvailable && !$windowsAvailable) { - return; - } $unixLocked = self::isUnixLocked($attrs); $sambaLocked = self::isSambaLocked($attrs); $ppolicyLocked = self::isPPolicyLocked($attrs); $windowsLocked = self::isWindowsLocked($attrs); - $partiallyLocked = $unixLocked || $sambaLocked || $ppolicyLocked || $windowsLocked; - $fullyLocked = ($unixAvailable || $sambaAvailable || $ppolicyAvailable || $windowsAvailable) + $is389dsDeactivated = self::is389dsDeactivated($attrs); + $partiallyLocked = $unixLocked || $sambaLocked || $ppolicyLocked || $windowsLocked || $is389dsDeactivated; + $fullyLocked = ($unixAvailable || $sambaAvailable || $ppolicyAvailable || $windowsAvailable || $is389dsDeactivated) && (!$unixAvailable || $unixLocked) && (!$sambaAvailable || $sambaLocked) && (!$ppolicyAvailable || $ppolicyLocked) @@ -887,7 +886,7 @@ class lamUserList extends lamList { $icon = 'partiallyLocked.png'; } // print icon and detail tooltips - if ($unixAvailable || $sambaAvailable || $ppolicyAvailable || $windowsAvailable) { + if ($unixAvailable || $sambaAvailable || $ppolicyAvailable || $windowsAvailable || $is389dsDeactivated) { $tipContent = ''; // Unix if ($unixAvailable) { @@ -921,6 +920,10 @@ class lamUserList extends lamList { } $tipContent .= ''; } + // 389 deactivation + if ($is389dsDeactivated) { + $tipContent .= ''; + } $tipContent .= '
' . _('Windows') . '  
' . _('Deactivated') . '  
'; echo 'status'; } @@ -1009,6 +1012,16 @@ class lamUserList extends lamList { return windowsUser::isDeactivated($attrs); } + /** + * Returns if deactivated by nsAccountLock. + * + * @param array $attrs LDAP attributes + * @return boolean account is deactivated + */ + public static function is389dsDeactivated(&$attrs) { + return (isset($attrs['nsaccountlock'][0]) && ($attrs['nsaccountlock'][0] == 'true')); + } + } ?> \ No newline at end of file