Code

<h2> => </h3>
[gosa.git] / gosa-plugins / goto / admin / systems / goto / class_terminalStartup.inc
index bc6009fef7a95e1ab743fda4bed0d4f84ae399de..15cd3bdfe762397aeb7844867d1c71e0a2bd3694 100644 (file)
@@ -58,7 +58,7 @@ class termstartup extends plugin
       unset($this->attrs['gotoShare']['count']);
       foreach($this->attrs['gotoShare'] as $share){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
+        $tmp = explode("|",$share);
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
         $tmp2['mountPoint']  =$tmp[2];
@@ -71,9 +71,21 @@ class termstartup extends plugin
 
     $this->orig_dn= $this->dn;
 
-    foreach($this->config->data['SERVERS']['LDAP'] as $server) {
-      $this->gotoLdapServerList[]= $server;
+    /* Creating a list of valid Mirrors
+     * none will not be saved to ldap.
+     */
+    $ldap   = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ui = get_userinfo();
+    foreach($this->config->data['SERVERS']['LDAP'] as $dn => $data){
+      if($ui->get_category_permissions($data['dn'],"server",TRUE)){
+        for($i = 0; $i < $data['goLdapBase']['count']; $i ++){
+          $name = $data["cn"][0].":".$data["goLdapBase"][$i];
+          $this->gotoLdapServerList[]= $name;
+        }
+      }
     }
+
     if(isset($this->attrs['gotoLdapServer'])){
       unset($this->attrs['gotoLdapServer']['count']);
       sort($this->attrs['gotoLdapServer']);
@@ -209,7 +221,7 @@ class termstartup extends plugin
       /* We assign a share to this user, if we don't know where to mount the share */
       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
         msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point")), WARNING_DIALOG);
-      }elseif(isset($this->gotoAvailableShares[$_POST['gotoShareSelection']])){
+      }elseif(isset($_POST['gotoShareSelection']) && isset($this->gotoAvailableShares[$_POST['gotoShareSelection']])){
         $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
         $s_mount = $_POST['gotoShareMountPoint'];
         /* Preparing the new assignment */
@@ -340,11 +352,6 @@ class termstartup extends plugin
       }else{
         $this->gotoLdap_inherit = FALSE;
       }
-
-      /* Save kernel parameters */
-      if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["gotoKernelParameters"])){
-        $this->gotoKernelParameters= $_POST["gotoKernelParameters"];
-      }
     }
   }
 
@@ -368,35 +375,6 @@ class termstartup extends plugin
       exit();
     }
 
-    /* Find proper terminal path for tftp configuration
-       FIXME: This is suboptimal when the default has changed to
-       another location! */
-    if ($this->gotoTerminalPath == "default-inherit"){
-      $ldap= $this->config->get_ldap_link();
-
-      /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,".get_ou('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
-         'gotoTerminalPath'. Abort when an entry is found. */
-      while (TRUE){
-        $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
-
-        $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
-            $this->config->current['BASE'], array('gotoTerminalPath'));
-        $attrs= $ldap->fetch();
-        if (isset($attrs['gotoTerminalPath'])){
-          $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
-          break;
-        }
-
-        /* Nothing left? */
-        if ($tmp == ""){
-          break;
-        }
-      }
-    }
     
     plugin::save();
 
@@ -429,7 +407,7 @@ class termstartup extends plugin
      /* prepare share settings */
     $tmp = array();
     foreach($this->gotoShares as $name => $settings){
-      $tmp2 = split("\|",$name);
+      $tmp2 = explode("|",$name);
       $name = $tmp2[0];
       $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
     }
@@ -494,7 +472,12 @@ class termstartup extends plugin
 
     $source_o = new termstartup ($this->config, $source['dn']);
 
-    foreach(array("gotoModules", "gotoKernelParameters","gotoShares","gotoKernelParameters","gotoTerminalPath","gotoShares","goLdapServerList","gotoBootKernel","gotoLdapServer","gotoBootKernels") as $attr){
+    foreach(array("gotoModules", "gotoKernelParameters","gotoShare",
+                  "gotoKernelParameters","gotoShares",
+                  "goLdapServerList","gotoBootKernel","gotoLdapServer",
+                  "gotoBootKernels","gotoLdapServers","gotoLdapServers",
+                  "gotoLdapServerList","gotoLdap_inherit","gotoShareSelections",
+                  "gotoAvailableShares") as $attr){
       $this->$attr = $source_o->$attr;
     }
   }