Code

Updated get_ou it receives values from the config registry now.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 May 2010 05:29:38 +0000 (05:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 May 2010 05:29:38 +0000 (05:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18301 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_FAI.inc
gosa-plugins/fai/admin/fai/class_faiHook.inc
gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/fai/admin/fai/class_faiPackage.inc
gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
gosa-plugins/fai/admin/fai/class_faiProfile.inc
gosa-plugins/fai/admin/fai/class_faiScript.inc
gosa-plugins/fai/admin/fai/class_faiTemplate.inc
gosa-plugins/fai/admin/fai/class_faiVariable.inc
gosa-plugins/fai/admin/fai/class_filterFAI.inc
gosa-plugins/fai/admin/fai/class_filterOPSIPackages.inc

index b6ef2a6125cae94dd430be037d543df5d9b1cd45..6bb494aec212382a0431c06d2d5bd939b52162f0 100644 (file)
@@ -166,8 +166,8 @@ class FAI
   {
     global $config;
 
-    if(!preg_match("/".preg_quote(get_ou('faiBaseRDN'), '/')."/i",$dn)){
-      $base = get_ou('faiBaseRDN').$dn;
+    if(!preg_match("/".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/')."/i",$dn)){
+      $base = get_ou("faiManagement", "faiBaseRDN").$dn;
     }else{
       $base = $dn;
     }
@@ -178,7 +178,7 @@ class FAI
     $ldap->search("(objectClass=FAIbranch)",array("ou","dn"));
     while($attrs = $ldap->fetch()){
       if($appendedName){
-        $res[$attrs['dn']] = convert_department_dn(preg_replace("/,".preg_quote(get_ou('faiBaseRDN'), '/').".*$/i","",$attrs['dn']));
+        $res[$attrs['dn']] = convert_department_dn(preg_replace("/,".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/').".*$/i","",$attrs['dn']));
       }else{
         $res[$attrs['dn']] = $attrs['ou'][0];
       }
@@ -222,7 +222,7 @@ class FAI
 
       /* Dont't try to modify non FAIclasses  
        */
-      if(!preg_match("/[^,]+,".preg_quote(get_ou("faiBaseRDN"), '/')."/i",$obj_dn)){
+      if(!preg_match("/[^,]+,".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/')."/i",$obj_dn)){
         trigger_error("PLEASE check fai class handling in ".__LINE__." -> ".__FILE__);        
         echo "<br>-->".$Current_DN."<br>";
         echo "<br>-->".$obj_dn."<br>";
@@ -923,8 +923,8 @@ class FAI
     $ldap->search("(objectClass=FAIbranch)",array("ou","FAIstate"));
     while($attrs = $ldap->fetch()){
       foreach($sub_releases as $sub_rel){
-        if(preg_match("/^".preg_quote($sub_rel.get_ou('faiBaseRDN'), '/')."/i",$attrs['dn'])){
-          $f_releases[$sub_rel.get_ou('faiBaseRDN')] = $attrs;
+        if(preg_match("/^".preg_quote($sub_rel.get_ou("faiManagement", "faiBaseRDN"), '/')."/i",$attrs['dn'])){
+          $f_releases[$sub_rel.get_ou("faiManagement", "faiBaseRDN")] = $attrs;
         }
       }
     }
@@ -945,8 +945,8 @@ class FAI
     foreach($sub_releases as $name => $sub_rel){
 
       $FAIstate = "";
-      if(isset($f_releases[$sub_rel.get_ou('faiBaseRDN')]) && isset($f_releases[$sub_rel.get_ou('faiBaseRDN')]['FAIstate'])){
-        $FAIstate = $f_releases[$sub_rel.get_ou('faiBaseRDN')]['FAIstate'][0];
+      if(isset($f_releases[$sub_rel.get_ou("faiManagement", "faiBaseRDN")]) && isset($f_releases[$sub_rel.get_ou("faiManagement", "faiBaseRDN")]['FAIstate'])){
+        $FAIstate = $f_releases[$sub_rel.get_ou("faiManagement", "faiBaseRDN")]['FAIstate'][0];
       }
 
       foreach($groups as $dn => $data){
index d0e151712b77e0dcdf7a0194974dfbb8d25a94df..62694d82509717e383eb9a29b6eff7e2ef7d447a 100644 (file)
@@ -381,7 +381,7 @@ class faiHook extends plugin
      */
     if($this->is_new){
       $release = $this->parent->parent->fai_release;
-      $new_dn= 'cn='.$this->cn.",".get_ou("faiHook", "faiHookRDN").get_ou('faiBaseRDN').$release;
+      $new_dn= 'cn='.$this->cn.",".get_ou("faiHook", "faiHookRDN").get_ou("faiManagement", "faiBaseRDN").$release;
       $res = faiManagement::check_class_name("FAIhook",$this->cn,$new_dn);
       if(isset($res[$this->cn])){
         $message[] = msgPool::duplicated(_("Name"));
index 9041bb00d7d80a695e4d19e56db41f2c77c7945f..6574bb3f8f6f4465901c9637679fdbac715e8e19 100644 (file)
@@ -61,7 +61,7 @@ class faiManagement extends management
       $this->opsi = new opsi($this->config);;
     }
 
-    $this->fai_base = get_ou("faiBaseRDN").$this->config->current['BASE'];
+    $this->fai_base = get_ou("faiManagement", "faiBaseRDN").$this->config->current['BASE'];
     $cfg_rel = $this->config->get_cfg_value("faiManagement","defaultFaiRelease");
 
     if(!empty($cfg_rel)){
@@ -602,9 +602,9 @@ class faiManagement extends management
 
           $ldap->cd($bb);
           $ldap->recursive_remove();
-          $ldap->cd(preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'/i', ','.get_ou("application", "applicationRDN"), $bb));
+          $ldap->cd(preg_replace('/,'.preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/').'/i', ','.get_ou("application", "applicationRDN"), $bb));
           $ldap->recursive_remove();
-          $ldap->cd(preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'/i', ','.get_ou("mimetype", "mimetypeRDN"), $bb));
+          $ldap->cd(preg_replace('/,'.preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/').'/i', ','.get_ou("mimetype", "mimetypeRDN"), $bb));
           $ldap->recursive_remove();
 
           /* Search for all groups with configured application menus.
@@ -612,7 +612,7 @@ class faiManagement extends management
              - The search für menu configuration for the specified release and collect all those dns.
              - Remove entries
            */
-          $release_ou = preg_replace("/".preg_quote(get_ou("faiBaseRDN"), '/').".*$/i","",$bb);
+          $release_ou = preg_replace("/".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/').".*$/i","",$bb);
           $ldap->cd($this->config->current['BASE']);
           $ldap->search("(objectClass=posixGroup)",array("dn"));
 
@@ -761,11 +761,11 @@ class faiManagement extends management
 
       $targetReleaseDN = "ou=".$name.",".$baseToUse;
 
-      $appsrc = preg_replace("/".preg_quote(get_ou('faiBaseRDN'), '/')."/i",get_ou("application", "applicationRDN"),$baseToUse);
-      $appdst = preg_replace("/".preg_quote(get_ou('faiBaseRDN'), '/')."/i",get_ou("application", "applicationRDN"),"ou=".$name.",".$baseToUse) ;
+      $appsrc = preg_replace("/".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/')."/i",get_ou("application", "applicationRDN"),$baseToUse);
+      $appdst = preg_replace("/".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/')."/i",get_ou("application", "applicationRDN"),"ou=".$name.",".$baseToUse) ;
 
-      $mimesrc = preg_replace("/".preg_quote(get_ou('faiBaseRDN'), '/')."/i",get_ou("mimetype", "mimetypeRDN"),$baseToUse);
-      $mimedst = preg_replace("/".preg_quote(get_ou('faiBaseRDN'), '/')."/i",get_ou("mimetype", "mimetypeRDN"),"ou=".$name.",".$baseToUse) ;
+      $mimesrc = preg_replace("/".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/')."/i",get_ou("mimetype", "mimetypeRDN"),$baseToUse);
+      $mimedst = preg_replace("/".preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/')."/i",get_ou("mimetype", "mimetypeRDN"),"ou=".$name.",".$baseToUse) ;
 
       /* Check if source depeartments exist */
       foreach(array($baseToUse,$appsrc,$mimesrc) as $dep){
index 28631c25f52a513ad988771311d7fa0986b74360..933cbe0c9f57f3027bfd053befe6e91df798f71b 100644 (file)
@@ -185,7 +185,7 @@ class faiPackage extends plugin
 
       /* Assemble release name */
       $release = $this->parent->parent->fai_release;
-      $tmp= preg_replace('/[,]*'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/i', '', $release);
+      $tmp= preg_replace('/[,]*'.preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/').'.*$/i', '', $release);
       $tmp= preg_replace('/ou=/', '', $tmp);
       $rev= array_reverse(explode(',', $tmp));
       $this->FAIdebianRelease= "/";
@@ -544,7 +544,7 @@ class faiPackage extends plugin
      */
     if($this->is_new){
       $release = $this->parent->parent->fai_release;
-      $new_dn= 'cn='.$this->cn.",".get_ou("faiPackage", "faiPackageRDN").get_ou('faiBaseRDN').$release;
+      $new_dn= 'cn='.$this->cn.",".get_ou("faiPackage", "faiPackageRDN").get_ou("faiManagement", "faiBaseRDN").$release;
       $res = faiManagement::check_class_name("FAIpackageList",$this->cn,$new_dn);
       if(isset($res[$this->cn])){
         $message[] = msgPool::duplicated(_("Name"));
@@ -589,7 +589,7 @@ class faiPackage extends plugin
     if($this->FAIdebianRelease == "ClearFromCopyPaste"){
 
       $current_release  = $this->parent->parent->fai_release;
-      $tmp= preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/i', '', $current_release);
+      $tmp= preg_replace('/,'.preg_quote(get_ou("faiManagement", "faiBaseRDN"), '/').'.*$/i', '', $current_release);
       $tmp= preg_replace('/ou=/', '', $tmp);
       $rev= array_reverse(explode(',', $tmp));
       $this->FAIdebianRelease= "";
index 6f3630e6e54c2b8768198af0294f2bce6530a997..342b6516013a911fe5668cc2169d6ccac46d6aae 100644 (file)
@@ -481,7 +481,7 @@ class faiPartitionTable extends plugin
      */
     if($this->is_new){
       $release = $this->parent->parent->fai_release;
-      $new_dn= 'cn='.$this->cn.",".get_ou("faiPartitionTable", "faiPartitionRDN").get_ou('faiBaseRDN').$release;
+      $new_dn= 'cn='.$this->cn.",".get_ou("faiPartitionTable", "faiPartitionRDN").get_ou("faiManagement", "faiBaseRDN").$release;
       $res = faiManagement::check_class_name("FAIpartitionTable",$this->cn,$new_dn);
       if(isset($res[$this->cn])){
         $message[] = msgPool::duplicated(_("Name"));
index 80908909fc2a86f7aa1b4c2757b555f07bda8be1..98940c170e430f3d3e410e4022387b1f977815c3 100644 (file)
@@ -284,7 +284,7 @@ class faiProfile extends plugin
          */
         if($this->dn == "new" || $this->cn != $this->old_cn){
             $release = $this->parent->parent->fai_release;
-            $new_dn= 'cn='.$this->cn.",".get_ou("faiProfile", "faiProfileRDN").get_ou('faiBaseRDN').$release;
+            $new_dn= 'cn='.$this->cn.",".get_ou("faiProfile", "faiProfileRDN").get_ou("faiManagement", "faiBaseRDN").$release;
             $res = faiManagement::check_class_name("FAIprofile",$this->cn,$new_dn);
             if(isset($res[$this->cn])){
                 $message[] = msgPool::duplicated(_("Name"));
index 8575e6f8fadb03e75c9a05c87191e628ee338a56..1c9f03edf1c4a23a78ed375b900186861025fd8b 100644 (file)
@@ -386,7 +386,7 @@ class faiScript extends plugin
      */
     if($this->is_new){
       $release = $this->parent->parent->fai_release;
-      $new_dn= 'cn='.$this->cn.",".get_ou("faiScript", "faiScriptRDN").get_ou('faiBaseRDN').$release;
+      $new_dn= 'cn='.$this->cn.",".get_ou("faiScript", "faiScriptRDN").get_ou("faiManagement", "faiBaseRDN").$release;
       $res = faiManagement::check_class_name("FAIscript",$this->cn,$new_dn);
       if(isset($res[$this->cn])){
         $message[] = msgPool::duplicated(_("Name"));
index b370dd6c9dcb53f3ff5d4d0976c1d31707aeb031..635e5b826fee4168ac4995f6199f742b249d2fb0 100644 (file)
@@ -404,7 +404,7 @@ class faiTemplate extends plugin
      */
     if($this->is_new){
       $release = $this->parent->parent->fai_release;
-      $new_dn= 'cn='.$this->cn.",".get_ou("faiTemplate", "faiTemplateRDN").get_ou('faiBaseRDN').$release;
+      $new_dn= 'cn='.$this->cn.",".get_ou("faiTemplate", "faiTemplateRDN").get_ou("faiManagement", "faiBaseRDN").$release;
       $res = faiManagement::check_class_name("FAItemplate",$this->cn,$new_dn);
       if(isset($res[$this->cn])){
         $message[] = msgPool::duplicated(_("Name"));
index 9de8ee3123c4a89b9aec27c663fe99f0028c945c..8d35ca7311e35fae82f8c782290db94bb50c0a4c 100644 (file)
@@ -290,7 +290,7 @@ class faiVariable extends plugin
      */
     if($this->is_new){
       $release = $this->parent->parent->fai_release;
-      $new_dn= 'cn='.$this->cn.",".get_ou("faiVariable", "faiVariableRDN").get_ou('faiBaseRDN').$release;
+      $new_dn= 'cn='.$this->cn.",".get_ou("faiVariable", "faiVariableRDN").get_ou("faiManagement", "faiBaseRDN").$release;
       $res = faiManagement::check_class_name("FAIvariable",$this->cn,$new_dn);
       if(isset($res[$this->cn])){
         $message[] = msgPool::duplicated(_("Name"));
index 86f2e989b44f19929437b6c506a1dcb8e6c82a93..5f1065ce35df6554ed7fdbb7c503bd7a0f3061c3 100644 (file)
@@ -55,7 +55,7 @@ class filterFAI extends filterLDAP{
           /* Clean up object informations */
           $obj                  = array();
           $obj['cn']            = $object['cn'][0];
-          $obj['dn']            = $object['cn'][0].",".get_ou("faiBaseRDN").$config->current['BASE'];
+          $obj['dn']            = $object['cn'][0].",".get_ou("faiManagement", "faiBaseRDN").$config->current['BASE'];
           $obj['acl']           = $acl;
           $obj['class']         = $rest ['ACL'];
           $obj['FAIstate']      = $entry['FAIstate'];
@@ -98,7 +98,7 @@ class filterFAI extends filterLDAP{
 
 
     // Append opsi stuff ... 
-    if(class_available('opsi') && $base == get_ou("faiBaseRDN").$config->current['BASE']){
+    if(class_available('opsi') && $base == get_ou("faiManagement", "faiBaseRDN").$config->current['BASE']){
       $opsi = new opsi($config);
       $objects = array();
       if($opsi instanceof opsi && $opsi->enabled()){
index 2a52389f18a34067cb19c80e3a8e4b5171fc5181..e1712163406b19f0aa6a1ff8dab959f2eb143412 100644 (file)
@@ -11,7 +11,7 @@ class filterOPSIPackages extends filterLDAP{
     $entries = array();
 
     // Append opsi stuff ...
-    if(class_available('opsi') && $base == get_ou("faiBaseRDN").$config->current['BASE']){
+    if(class_available('opsi') && $base == get_ou("faiManagement", "faiBaseRDN").$config->current['BASE']){
       $opsi = new opsi($config);
       $objects = array();
       if($opsi instanceof opsi && $opsi->enabled()){