Code

-Updated jsonRPC calls - use ssl certs
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Jul 2010 14:27:50 +0000 (14:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Jul 2010 14:27:50 +0000 (14:27 +0000)
-Adde pre_events

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19190 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_configRegistry.inc
gosa-core/include/class_jsonRPC.inc
gosa-core/include/class_plugin.inc

index 9809788ef5eb76f7d65195bf63357bb4fc45be54..ee68d2ed46836ec343471604dde32eb23770a94c 100644 (file)
@@ -415,6 +415,12 @@ class configRegistry{
             $this->register($cname, $data);    
             $data = array('name' => 'postmodify','type' => 'command');
             $this->register($cname, $data);    
+            $data = array('name' => 'precreate','type' => 'command');
+            $this->register($cname, $data);    
+            $data = array('name' => 'preremove','type' => 'command');
+            $this->register($cname, $data);    
+            $data = array('name' => 'premodify','type' => 'command');
+            $this->register($cname, $data);    
             $data = array('name' => 'check', 'type' => 'command');
             $this->register($cname, $data);    
 
index f0032365af1d0d4790494abd0177ee980b6d1bed..d9084f61c0913dba6c4bbcefb8668f69ddc754dd 100644 (file)
@@ -34,6 +34,7 @@ class jsonRPC {
         curl_setopt($this->curlHandler, CURLOPT_COOKIEFILE, 'cookiefile.txt'); 
         curl_setopt($this->curlHandler, CURLOPT_POST , TRUE);
         curl_setopt($this->curlHandler, CURLOPT_RETURNTRANSFER , TRUE);
+        curl_setopt($this->curlHandler, CURLOPT_SSL_VERIFYPEER, TRUE);
         curl_setopt($this->curlHandler, CURLOPT_HTTPHEADER , array('Content-Type: application/json'));
 
         // Try to login 
index bb5d80135f421177af7715334feaae413062f08e..4660c375c35f1bbac6dce9c2020ceb126f5a2b89 100644 (file)
@@ -319,6 +319,9 @@ class plugin
     /*
        $ldap->modify($this->attrs);
      */
+    if($this->initially_was_account){
+        $this->handle_pre_events('remove');
+    }
   }
 
 
@@ -398,6 +401,37 @@ class plugin
 
     /* Handle tagging */
     $this->tag_attrs($this->attrs);
+
+    if($this->is_new){
+        $this->handle_pre_events('add');
+    }else{
+        $this->handle_pre_events('modify');
+    }
+  }
+
+
+  /*! \brief    Forward command execution requests
+   *             to the hook execution method.
+   */
+  function handle_pre_events($mode, $addAttrs= array())
+  {
+    if(!in_array($mode, array('add','remove','modify'))){
+      trigger_error(sprintf("Invalid pre event type given %s! Valid types are [add,modify,remove].", $mode));
+      return;
+    }
+    switch ($mode){
+      case "add":
+        plugin::callHook($this,"PRECREATE", $addAttrs);
+      break;
+
+      case "modify":
+        plugin::callHook($this,"PREMODIFY", $addAttrs);
+      break;
+
+      case "remove":
+        plugin::callHook($this,"PREREMOVE", $addAttrs);
+      break;
+    }
   }