Code

Added pre/post lock/unlock method for user passwords
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Oct 2010 11:55:55 +0000 (11:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Oct 2010 11:55:55 +0000 (11:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19908 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index b933300e1fc82afe60bd24faf204069a69d29408..ffcff6799b0d86800cbea41f85de032a03736b0e 100644 (file)
@@ -109,12 +109,21 @@ class passwordMethod
             $sambaLMPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaLMPassword);
             $sambaNTPassword = preg_replace("/^[!]*(.*$)/","!\\1",$sambaNTPassword);
             $ldap->cd($dn);
+
+            $pwdClass = new password($config, $dn);
+            $pwdClass->callHook($pwdClass, 'PRELOCK',array(), $ret);
             $ldap->modify(
                     array(
                         "userPassword" => $userPassword,
                         "sambaLMPassword" => $sambaLMPassword,
                         "sambaNTPassword" => $sambaNTPassword));
+
+            if($ldap->success()){
+                $pwdClass->callHook($pwdClass, 'POSTLOCK',array(), $ret);
+                print_a($ret);
+            }
             return($ldap->success());
+            
         }
         return(FALSE);
     }
@@ -157,12 +166,20 @@ class passwordMethod
             $userPassword = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$userPassword);
             $sambaLMPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaLMPassword);
             $sambaNTPassword = preg_replace("/^[!]*(.*$)/","\\1",$sambaNTPassword);
+
+            $pwdClass = new password($config, $dn);
+            $pwdClass->callHook($pwdClass, 'PREUNLOCK',array(), $ret);
+
             $ldap->cd($dn);
             $ldap->modify(
                     array(
                         "userPassword" => $userPassword,
                         "sambaLMPassword" => $sambaLMPassword,
                         "sambaNTPassword" => $sambaNTPassword));
+            if($ldap->success()){
+                $pwdClass = new password($config, $dn);
+                $pwdClass->callHook($pwdClass, 'POSTUNLOCK',array(), $ret);
+            }
             return($ldap->success());
         }
         return(FALSE);
index 2833de2ecaac6e1f915588f10807e056d1ffb8b1..7645b8217b0e6dcabe6b7ffad1eaa6861a29b2a0 100644 (file)
@@ -220,14 +220,52 @@ class password extends plugin
     static function plInfo()
     {
         return (array(
-                    "plDescription"     => _("User password"),
-                    "plSelfModify"      => TRUE,
-                    "plDepends"         => array("user"),
-                    "plPriority"        => 10,
+                    "plDescription" => _("User password"),
+                    "plSelfModify"  => TRUE,
+                    "plDepends"     => array("user"),
+                    "plPriority"    => 10,
                     "plSection"     => array("personal" => _("My account")),
                     "plCategory"    => array("users"),
-                    "plOptions"         => array(),
+                    "plOptions"     => array(),
 
+                    "plProperties" => array(
+                        array(
+                            "name"          => "PRELOCK",
+                            "type"          => "command",
+                            "default"       => "",
+                            "description"   => "",
+                            "check"         => "gosaProperty::isCommand",
+                            "migrate"       => "",
+                            "group"         => "password",
+                            "mandatory"     => FALSE),
+                        array(
+                            "name"          => "POSTLOCK",
+                            "type"          => "command",
+                            "default"       => "",
+                            "description"   => "",
+                            "check"         => "gosaProperty::isCommand",
+                            "migrate"       => "",
+                            "group"         => "password",
+                            "mandatory"     => FALSE),
+                        array(
+                            "name"          => "PREUNLOCK",
+                            "type"          => "command",
+                            "default"       => "",
+                            "description"   => "",
+                            "check"         => "gosaProperty::isCommand",
+                            "migrate"       => "",
+                            "group"         => "password",
+                            "mandatory"     => FALSE),
+                        array(
+                            "name"          => "POSTUNLOCK",
+                            "type"          => "command",
+                            "default"       => "",
+                            "description"   => "",
+                            "check"         => "gosaProperty::isCommand",
+                            "migrate"       => "",
+                            "group"         => "password",
+                            "mandatory"     => FALSE)
+                        ),
                     "plProvidedAcls"  => array())
                );
     }