0012560: fix AD account expiry
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 23 Jan 2017 14:30:08 +0000 (15:30 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 24 Jan 2017 08:45:08 +0000 (09:45 +0100)
value 0 means: never expires

https://forge.tine20.org/view.php?id=12560

Change-Id: I5d6d6d2465653ed338ac53786b6e3ce756a1df44
Reviewed-on: http://gerrit.tine20.com/customers/4126
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/User/ActiveDirectory.php

index 9541b49..0f5bdb1 100644 (file)
@@ -433,7 +433,7 @@ class Tinebase_User_ActiveDirectory extends Tinebase_User_Ldap
             if ($keyMapping !== FALSE) {
                 switch($keyMapping) {
                     case 'accountExpires':
-                        if ($value === '0' || $value[0] === '9223372036854775807') {
+                        if ($value === '0' || $value[0] === '0' || $value[0] === '9223372036854775807') {
                             $accountArray[$keyMapping] = null;
                         } else {
                             $accountArray[$keyMapping] = self::convertADTimestamp($value[0]);
@@ -458,7 +458,7 @@ class Tinebase_User_ActiveDirectory extends Tinebase_User_Ldap
 
         $accountArray['accountStatus'] = (isset($_userData['useraccountcontrol']) && ($_userData['useraccountcontrol'][0] & self::ACCOUNTDISABLE)) ? 'disabled' : 'enabled';
         if ($accountArray['accountExpires'] instanceof Tinebase_DateTime && Tinebase_DateTime::now()->compare($accountArray['accountExpires']) == -1) {
-            $accountArray['accountStatus'] = 'disabled';
+            $accountArray['accountStatus'] = Tinebase_Model_User::ACCOUNT_STATUS_EXPIRED;
         }
         
         /*