Code

Added pre/post lock/unlock events
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Oct 2010 12:40:29 +0000 (12:40 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Oct 2010 12:40:29 +0000 (12:40 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@19911 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/password-methods/class_password-methods.inc

index 51fdad0c8149c5a7de13074428c946bb8a136507..9f08e239509a1b202bb593ceb0b01c5fc0c1d31c 100644 (file)
@@ -94,11 +94,21 @@ class passwordMethod
       if(preg_match("/^[^\}]*+\}!/",$pwd)){
         return(TRUE);
       }     
-      
+     
+      // Lock the account by modifying the password hash.
+      $pwdClass = new password($config, $dn);
+      $pwdClass->callHook($pwdClass, 'PRELOCK',array(), $ret);
+
       /* Lock entry */
       $pwd = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$pwd);
       $ldap->cd($dn);
       $ldap->modify(array("userPassword" => $pwd));
+
+      // Call the password post-lock hook, if defined.
+      if($ldap->success()){
+          $pwdClass->callHook($pwdClass, 'POSTLOCK',array(), $ret);
+      }
+
       return($ldap->success());
     }
     return(FALSE);
@@ -132,10 +142,19 @@ class passwordMethod
         return (TRUE);
       }     
       
+      // Unlock the account by modifying the password hash.
+      $pwdClass = new password($config, $dn);
+      $pwdClass->callHook($pwdClass, 'PREUNLOCK',array(), $ret);
+
       /* Lock entry */
       $pwd = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$pwd);
       $ldap->cd($dn);
       $ldap->modify(array("userPassword" => $pwd));
+
+      // Call the password post-lock hook, if defined.
+      if($ldap->success()){
+          $pwdClass->callHook($pwdClass, 'POSTUNLOCK',array(), $ret);
+      }
       return($ldap->success());
     }
     return(FALSE);