From: hickert Date: Mon, 4 Oct 2010 12:40:29 +0000 (+0000) Subject: Added pre/post lock/unlock events X-Git-Url: https://git.tokkee.org/?p=gosa.git;a=commitdiff_plain;h=1dab897a88eb5067c836e548880441c2569ccd98 Added pre/post lock/unlock events git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@19911 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/password-methods/class_password-methods.inc b/gosa-core/include/password-methods/class_password-methods.inc index 51fdad0c8..9f08e2395 100644 --- a/gosa-core/include/password-methods/class_password-methods.inc +++ b/gosa-core/include/password-methods/class_password-methods.inc @@ -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);