Code

Updated account expiration
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 6 Jul 2010 14:00:30 +0000 (14:00 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 6 Jul 2010 14:00:30 +0000 (14:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@18946 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/users/class_userManagement.inc

index 663d598a4d9cb4c3f0151ae9915ee3f5dcad5fe7..807634a645631c39a5b10f51a380bbe08a383aac 100644 (file)
@@ -275,7 +275,7 @@ class userManagement extends management
           $attrs = $ldap->fetch();
           $this->passwordChangeForceable =
               in_array('sambaAccount', $attrs['objectClass']) ||
-              in_array('posixAccount', $attrs['objectClass']);
+              (in_array('posixAccount', $attrs['objectClass']) && isset($attrs['shadowMax']));
           $smarty->assign("passwordChangeForceable" , $this->passwordChangeForceable);
           $smarty->assign("enforcePasswordChange" , $this->enforcePasswordChange);
 
@@ -359,11 +359,18 @@ class userManagement extends management
 
                   // Update the posix shadow flag...
                   if($posix){
-                      $posixAccount = new posixAccount($this->config, $this->dn);
-                      $posixAccount->is_modified=TRUE;
-                      $posixAccount->activate_shadowExpire=1;
-                      $posixAccount->shadowExpire = date('d.m.Y', time() - (1 * 24 * 60 *60));
-                      $posixAccount->save();
+                      $current= floor(date("U") /60 /60 /24);
+                      $enforceDate = $current -  $attrs['shadowMax'][0];
+                      $new_attrs = array();
+                      $new_attrs['shadowLastChange'] = $enforceDate;
+                      $ldap->cd($this->dn);
+                      $ldap->modify($new_attrs);
+
+#                     $posixAccount = new posixAccount($this->config, $this->dn);
+#                     $posixAccount->is_modified=TRUE;
+#                     $posixAccount->activate_shadowExpire=1;
+#                     $posixAccount->shadowExpire = date('d.m.Y', time() - (1 * 24 * 60 *60));
+#                     $posixAccount->save();
                   }
 
                   // Update the samba kickoff flag...