Code

Fixed wrong existance check
[gosa.git] / gosa-plugins / systems / admin / systems / class_systemManagement.inc
index bed0165bbf0434547a6013e434f618934456f436..844e9f629ef24a9ed2fa44844db9291c63700453 100644 (file)
@@ -385,10 +385,15 @@ class systems extends plugin
 
             /* We are allowed to create the requested system type */
             if(preg_match("/c/",$tabacl)){
-              $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$selected_system);
+              $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn, $selected_system);
               $this->systab->set_acl_base($this->DivListSystem->selectedBase);
-              $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
-              $this->systab->base = $this->DivListSystem->selectedBase;
+              if($selected_group != "none"){
+                $this->systab->base = preg_replace("/^[^,]+,".get_ou('ogroupRDN')."/", "", $selected_group);
+                $this->systab->by_object[$tabname]->base = $this->systab->base;
+              } else {
+                $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
+                $this->systab->base = $this->DivListSystem->selectedBase;
+              }
 
               /* This will be used when the object is saved, to set FAIstate to 'install'
                   and to preset maybe other attributes.
@@ -1295,9 +1300,12 @@ class systems extends plugin
     $res = array_merge($res,get_list($filter,$sys_categories, get_ou('systemIncomingRDN').$base,$sys_attrs, GL_SIZELIMIT));
 
     /* Append opsi systems, the opsi extension have to installed.
-        (Only, if we are allowed to view opsi hosts)
+        (Only, if we are allowed to view opsi hosts and if we're on the ldap root)
      */
-    if($this->opsi instanceof opsi && $this->opsi->enabled() && $this->DivListSystem->ShowOpsiHosts){
+    if($this->DivListSystem->selectedBase == $this->config->current['BASE'] && 
+        $this->opsi instanceof opsi && 
+        $this->opsi->enabled() && 
+        $this->DivListSystem->ShowOpsiHosts){
       $o_acl = $this->ui->get_permissions($base,"opsi/opsiGeneric","");
       if(preg_match("/r/",$o_acl)){
         $opsi_clients = $this->opsi->get_hosts_for_system_management();
@@ -1462,8 +1470,9 @@ class systems extends plugin
        If there is a samba host, then merge it with the opsi host,
         to avoid duplicate entries.
      */
+    $oRex = preg_replace("/\*/",".*",$this->DivListSystem->Regex);
     foreach($opsi_clients as $entry){
-      if(isset($opsi_map[$entry['cn'][0]])){
+      if(isset($opsi_map[$entry['cn'][0]]) || !preg_match("/".($oRex)."/", $entry['cn'][0])){
         continue;
       }
       $terminal             = $entry;