Code

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

gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_terminalService.inc
gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_workstationService.inc
gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
gosa-plugins/goto/admin/systems/goto/tabs_printers.inc
gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc
gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc

index c420b2f1d5d93f893d7002ac93fa0271c5a46c02..39746e916a0c643fb1a7a57da9a91d2ce7a065f1 100644 (file)
@@ -71,11 +71,11 @@ class printgeneric extends plugin
 
     /* Update dn, to ensure storing as printer instead of WS / terminal */
     if(preg_match("/Terminal/i",$this->BelongsTo) || preg_match("/TerminalTemplate/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
     }
 
     if(preg_match("/Workstation/i",$this->BelongsTo) || preg_match("/WorkstationTemplate/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
     }
 
     $this->orig_dn = $this->dn;
@@ -104,10 +104,10 @@ class printgeneric extends plugin
     } else {
     
       /* Set base and check if the extracted base exists */
-      if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i",$this->dn)){
-        $this->base= preg_replace("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i","",dn2base($this->dn));
+      if(preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",$this->dn)){
+        $this->base= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i","",dn2base($this->dn));
       }else{
-        $this->base= preg_replace("/".preg_quote(get_ou('printerRDN'), '/')."/i","",dn2base($this->dn));
+        $this->base= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i","",dn2base($this->dn));
       }
 
       if(!isset($this->config->idepartments[$this->base])){
@@ -256,11 +256,11 @@ class printgeneric extends plugin
       /* Update dn, to ensure storing as printer instead of WS / terminal
        */
       if(preg_match("/terminal/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
       }
 
       if(preg_match("/workstation/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
       }
 
       /* Detect if this is a valid printer account;
@@ -625,11 +625,11 @@ class printgeneric extends plugin
       /* Update dn, to ensure storing as printer instead of WS / terminal
        */
       if(preg_match("/terminal/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/').",/i",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/').",/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
       }
 
       if(preg_match("/workstation/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
       }
 
       /* Check if this dn points to a printer, to avoid deleting something else */
@@ -727,7 +727,7 @@ class printgeneric extends plugin
       }
     }
 
-    $dn= "cn=".$this->cn.get_ou('printerRDN').",".$this->base;
+    $dn= "cn=".$this->cn.get_ou("workgeneric", "workstationRDN") .",".$this->base;
 
     /* must: cn */
     if(($this->BelongsTo == "Printer") && $this->cn == ""){
@@ -753,7 +753,7 @@ class printgeneric extends plugin
     if (($this->orig_dn != $dn)&&( preg_match("/printer/i",$this->BelongsTo))){
       $ldap= $this->config->get_ldap_link();
       $ldap->cd ($this->base);
-      $ldap->ls("(cn=".$this->cn.")",get_ou('printerRDN').$this->base, array("cn"));
+      $ldap->ls("(cn=".$this->cn.")",get_ou("workgeneric", "workstationRDN") .$this->base, array("cn"));
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
           if(preg_match("/cn=dhcp,/",$attrs['dn'])){
@@ -785,11 +785,11 @@ class printgeneric extends plugin
     /* Update dn, to ensure storing as printer instead of WS / terminal
      */
     if(preg_match("/terminal/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
     }
 
     if(preg_match("/workstation/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn);
     }
     
     if(!$this->is_account) return;
@@ -921,7 +921,7 @@ class printgeneric extends plugin
     }
 
     /* Ensure to create a new object */
-    if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i",$this->orig_dn)){
+    if(preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",$this->orig_dn)){
       $this->orig_dn = "new";
     }
 
index 6564b864c05b8af0695e334be69ae61e635bf09b..374b411339443a6bc62f105e04b43f542c72113b 100644 (file)
@@ -125,10 +125,10 @@ class termgeneric extends plugin
     if ($this->dn == "new"){
       $ui= get_userinfo();
       $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
-    } elseif(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", $this->dn)){
-      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", "", $this->dn);
+    } elseif(preg_match("/".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", $this->dn)){
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", "", $this->dn);
     } else {
-      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/i", "", $this->dn);
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", "", $this->dn);
     }
 
     /* Create an array of all Syslog servers */
@@ -420,7 +420,7 @@ class termgeneric extends plugin
     }
 
     /* Permissions for that base? */
-    $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base;
+    $this->dn= "cn=".$this->cn.",".get_ou("ArpNewDevice", "systemIncomingRDN") .$this->base;
 
     if ($this->cn == ""){
       $message[]= msgPool::required(_("Name"));
@@ -448,7 +448,7 @@ class termgeneric extends plugin
       }
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", $ldap->getDN())){
             continue;
           } else {
             if ($attrs['dn'] != $this->orig_dn){
@@ -493,7 +493,7 @@ class termgeneric extends plugin
       $ldap= $this->config->get_ldap_link();
 
       /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
+      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", "", $this->dn);
       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
 
       /* Walk from top to base and try to load default values for
@@ -501,7 +501,7 @@ class termgeneric extends plugin
       while (TRUE){
         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
 
-        $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
+        $ldap->cat("cn=default,".get_ou("ArpNewDevice", "systemIncomingRDN") .$tmp.
             $this->config->current['BASE'], array('gotoTerminalPath'));
         $attrs= $ldap->fetch();
         if (isset($attrs['gotoTerminalPath'])){
index 28846fd5049d62352e1918fbde38063deb774000..a7d91c1ddb742433f16dea36b118433a3a0fd924 100644 (file)
@@ -198,7 +198,7 @@ class termservice extends plugin
 
     /* Load phone hardware list 
      */
-    $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")), 
+    $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("group", "ogroupRDN") ), 
                   $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
     foreach($tmp as $attrs){
       $cn= $attrs['cn'][0];
@@ -216,13 +216,13 @@ class termservice extends plugin
      */
     $deps_a = array(
         get_people_ou(),
-        get_ou("ogroupRDN"),
-        get_ou("serverRDN"),
-        get_ou("terminalRDN"),
-        get_ou("workstationRDN"),
-        get_ou("printerRDN"),
-        get_ou("componentRDN"),
-        get_ou("phoneRDN"));
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") );
 
     $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
         array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
@@ -650,7 +650,7 @@ class termservice extends plugin
            */
           $p = $this->parent->by_object['ogroup'];
           foreach($p->memberList as $dn => $obj){
-            if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue;
+            if(preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$dn)) continue;
             if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
               $macs[] = $p->objcache[$dn]['macAddress'];
             }
@@ -660,7 +660,7 @@ class termservice extends plugin
           /* We are a workstation. Add current mac.
            */
           $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
-          if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
+          if(!empty($mac) && !preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$this->orig_dn)){
             $macs[] = $mac;
           }
         }
index b5ff4338ccee2d54b42253e8b04a8157c10400a4..53f4324dd571df535e96071a502afa034f3b805b 100644 (file)
@@ -141,10 +141,10 @@ class workgeneric extends plugin
     if ($this->dn == "new"){
       $ui= get_userinfo();
       $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
-    } elseif(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", $this->dn)){
-      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", "", $this->dn);
+    } elseif(preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", $this->dn)){
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", "", $this->dn);
     }else{
-      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("workstationRDN"), '/')."/i", "", $this->dn);
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", "", $this->dn);
     }
 
     /* Create an array of all Syslog servers */
@@ -429,7 +429,7 @@ class workgeneric extends plugin
       $message= array_merge($message, $this->netConfigDNS->check());
     }
 
-    $this->dn= "cn=".$this->cn.",".get_ou('workstationRDN').$this->base;
+    $this->dn= "cn=".$this->cn.",".get_ou("workgeneric", "workstationRDN") .$this->base;
 
     if ($this->cn == ""){
       $message[]= msgPool::required(_("Name"));
@@ -456,7 +456,7 @@ class workgeneric extends plugin
       }
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", $ldap->getDN())){
             continue;
           } else {
             if ($attrs['dn'] != $this->orig_dn){
@@ -486,7 +486,7 @@ class workgeneric extends plugin
     }else{
       /* Warn the user, that this host is currently installing */
       if($this->currently_installing && !$this->currently_installing_warned && 
-          !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i",$this->orig_dn)){
+          !preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",$this->orig_dn)){
       
         /* Force aborting without message dialog */
         $message[] = "";
index 4b131ec53ee2d3e83809d10751cecb9a8337ada9..b2e4cc281a9eb5cf68eaad51f298a74d11421ee1 100644 (file)
@@ -137,7 +137,7 @@ class workservice extends plugin
 
     /* Load phone hardware list
      */
-    $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")),
+    $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("group", "ogroupRDN") ),
                   $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
     foreach($tmp as $attrs){
       $cn= $attrs['cn'][0];
@@ -155,13 +155,13 @@ class workservice extends plugin
      */
     $deps_a = array(
         get_people_ou(),
-        get_ou("ogroupRDN"),
-        get_ou("serverRDN"),
-        get_ou("terminalRDN"),
-        get_ou("workstationRDN"),
-        get_ou("printerRDN"),
-        get_ou("componentRDN"),
-        get_ou("phoneRDN"));
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") ,
+        get_ou("group", "ogroupRDN") );
 
     $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
         array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
@@ -544,7 +544,7 @@ class workservice extends plugin
            */
           $p = $this->parent->by_object['ogroup'];
           foreach($p->memberList as $dn => $obj){
-            if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue;
+            if(preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$dn)) continue;
             if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
               $macs[] = $p->objcache[$dn]['macAddress'];
             }
@@ -554,7 +554,7 @@ class workservice extends plugin
           /* We are a workstation. Add current mac.
            */
           $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
-          if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
+          if(!empty($mac) && !preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$this->orig_dn)){
             $macs[] = $mac;
           }          
         }
index d28a4b20149209c3da65e5e72d8f4dd056c12062..894f5e7588da8c12bc5ca466f8a851d052787033 100644 (file)
@@ -674,7 +674,7 @@ class workstartup extends plugin
       $ldap= $this->config->get_ldap_link();
 
       /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
+      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN") , '/')."/i", "", $this->dn);
       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
 
       /* Walk from top to base and try to load default values for
@@ -682,7 +682,7 @@ class workstartup extends plugin
       while (TRUE){
         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
 
-        $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
+        $ldap->cat("cn=default,".get_ou("termgeneric", "terminalRDN") .$tmp.
             $this->config->current['BASE'], array('gotoTerminalPath'));
         $attrs= $ldap->fetch();
         if (isset($attrs['gotoTerminalPath'])){
@@ -1224,7 +1224,7 @@ class workstartup extends plugin
    */
   function dn_to_release_name($dn)
   {
-    $relevant = preg_replace("/,".preg_quote(get_ou("faiBaseRDN"), '/').".*$/i","",$dn);
+    $relevant = preg_replace("/,".preg_quote(get_ou("termgeneric", "terminalRDN") , '/').".*$/i","",$dn);
     $parts    = array_reverse(explode(",",$relevant));
     $str ="";
     foreach($parts as $part){
index 6a7e0e02d4323b767aa355e05fa1793f68e543c2..cd93fa1b4346f2f53441e664fe55d9f86e98e5a8 100644 (file)
@@ -81,7 +81,7 @@ class printtabs extends tabs
     /* Check for new 'dn', in order to propagate the
        'dn' to all plugins */
     $baseobject= $this->by_object['printgeneric'];
-    $this->dn= "cn=$baseobject->cn,".get_ou('printerRDN').$baseobject->base;
+    $this->dn= "cn=$baseobject->cn,".get_ou("printgeneric", "printerRDN") .$baseobject->base;
     $baseobject->dn= $this->dn;
 
     foreach ($this->by_object as $key => $obj){
index b1adb932836e4177e9f932b1fe2ff037c623630b..b016331a5b0aad2cfc9fd6652c290cc1ffd4ed10 100644 (file)
@@ -87,7 +87,7 @@ class termtabs extends tabs
     /* Check for new 'dn', in order to propagate the
        'dn' to all plugins */
     $baseobject= $this->by_object['termgeneric'];
-    $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalRDN').$baseobject->base;
+    $this->dn= "cn=".$baseobject->cn.",".get_ou("termgeneric", "terminalRDN") .$baseobject->base;
     $baseobject->dn= $this->dn;
 
     if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
index 32bcaea5c2ba75c7d882c25452dfbd628153d5b7..4d0a4e80a7f03e82af4db92876dac2e1857d3933 100644 (file)
@@ -86,7 +86,7 @@ class worktabs extends tabs
     /* Check for new 'dn', in order to propagate the
        'dn' to all plugins */
     $baseobject= $this->by_object['workgeneric'];
-    $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationRDN').$baseobject->base;
+    $this->dn= "cn=".$baseobject->cn.",".get_ou("workgeneric", "workstationRDN") .$baseobject->base;
 
     if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){