Code

Fixed problem with inherited kernel settings for goto enabled clients
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Oct 2008 16:19:42 +0000 (16:19 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Oct 2008 16:19:42 +0000 (16:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12623 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc

index e2488e675afd4dc4ddce1e5e9babca78b3d2b6e9..acdd4af3cf05c8bc8abb83551f620c6c4db6ca72 100644 (file)
@@ -71,36 +71,6 @@ class termstartup extends plugin
 
     $this->orig_dn= $this->dn;
 
-    /* Get list of boot kernels */
-    if (isset($this->config->data['TABS'])){
-      $command= $this->config->search(get_class($this), "systemKernelsHook",array('tabs'));
-
-      if (!check_command($command)){
-        $message[]= sprintf(_("Command '%s', specified as systemKernelsHook for plugin '%s' doesn't seem to exist."), $command,
-            get_class($this));
-      } else {
-        $fh= popen($command, "r");
-        while (!feof($fh)) {
-          $buffer= trim(fgets($fh, 256));
-          
-          if(!empty($buffer)){
-          
-            $name=$value = $buffer;
-
-            if(preg_match("/:/",$buffer)){
-              $name = preg_replace("/:.*$/","",$buffer);
-              $value= preg_replace("/^.*:/","",$buffer);
-              $this->gotoBootKernels[$name]= $name.":".$value;
-            }else{
-              $this->gotoBootKernels[$name]= $value;
-            }
-          }
-        }
-        pclose($fh);
-      }
-
-    }
-    
     foreach($this->config->data['SERVERS']['LDAP'] as $server) {
       $this->gotoLdapServerList[]= $server;
     }
@@ -120,6 +90,8 @@ class termstartup extends plugin
     if ($ldap->count() == 1){
       $map= array("gotoLdapServer","gotoBootKernel");
       $attrs= $ldap->fetch();
+      $this->member_of_ogroup = TRUE;
+      $this->o_group_dn = $attrs['dn'];
 
       foreach ($map as $name){
         if (!isset($attrs[$name][0])){
@@ -129,7 +101,7 @@ class termstartup extends plugin
           case 'gotoBootKernel':
                  /* Handle inheritance value "default" */
                  if ($this->member_of_ogroup){
-                         $this->gotoBootKernels= array("default-inherited" => '['._("inherited").']');
+                         $this->gotoBootKernels["default-inherited"]= _("inherited")." [".$attrs['gotoBootKernel'][0]."]";
                  }
           break;
           case 'gotoLdapServer':
@@ -137,14 +109,42 @@ class termstartup extends plugin
             break;
         }
       }
-
-      $this->member_of_ogroup = TRUE;
-      $this->o_group_dn = $attrs['dn'];
     }
 
     if(!count($this->gotoLdapServers) && $this->member_of_ogroup){
       $this->gotoLdap_inherit = TRUE;
     }
+
+    /* Get list of boot kernels */
+    if (isset($this->config->data['TABS'])){
+      $command= $this->config->search(get_class($this), "systemKernelsHook",array('tabs'));
+
+      if (!check_command($command)){
+        $message[]= sprintf(_("Command '%s', specified as systemKernelsHook for plugin '%s' doesn't seem to exist."), $command,
+            get_class($this));
+      } else {
+        $fh= popen($command, "r");
+        while (!feof($fh)) {
+          $buffer= trim(fgets($fh, 256));
+          
+          if(!empty($buffer)){
+          
+            $name=$value = $buffer;
+
+            if(preg_match("/:/",$buffer)){
+              $name = preg_replace("/:.*$/","",$buffer);
+              $value= preg_replace("/^.*:/","",$buffer);
+              $this->gotoBootKernels[$name]= $name.":".$value;
+            }else{
+              $this->gotoBootKernels[$name]= $value;
+            }
+          }
+        }
+        pclose($fh);
+      }
+
+    }
+    
   }
 
   function execute()