Code

Fixed base selection.
[gosa.git] / plugins / admin / systems / class_printGeneric.inc
index a253a2296e7d6e20439e9d8cc6f2a9428f7ff8ab..021c75f9d0f5b6864dbd6fbe27e31abb6d306aac 100644 (file)
@@ -288,14 +288,6 @@ class printgeneric extends plugin
       $smarty->assign($name."ACL", $this->getacl($name));
     }
 
-    /* Create base acls */
-    $baseACL = $this->getacl("base");
-    if(!$this->acl_is_moveable()) {
-      $baseACL = preg_replace("/w/","",$baseACL);
-    }
-    $smarty->assign("baseACL",          $baseACL);
-
-
     $display="";
 
     /* Tell smarty if this is a standalone object or a terminal / WS depending printer */
@@ -371,7 +363,13 @@ class printgeneric extends plugin
           $this->dialog = false;
           $this->baseSelection = false;
         }elseif($this->dialog->isSelected()){
-          $this->base = $this->dialog->isSelected();
+
+          /* A new base was selected, check if it is a valid one */
+          $tmp = $this->get_allowed_bases();
+          if(isset($tmp[$this->dialog->isSelected()])){
+            $this->base = $this->dialog->isSelected();
+          }
+
           $this->dialog= false;
           $this->baseSelection = false;
         }else{
@@ -603,27 +601,22 @@ class printgeneric extends plugin
   /* Save data to object */
   function save_object()
   {
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
     plugin::save_object();
-    
+    $this->base = $base_tmp;
+
     if(is_object($this->netConfigDNS)){
       $this->netConfigDNS->save_object();
     }
-
-    /* Save base, since this is no LDAP attribute */
-    if((isset($_POST['base'])) && ($this->acl_is_moveable()) ) {
-      $this->set_acl_base('dummy,'.$_POST['base']);
-      if($this->acl_is_moveable()){
-
-        if(isset($this->config->idepartments[$_POST['base']])){
-          $this->base = $_POST['base'];
-          if ($_POST['base'] != $this->base){
-            $this->is_modified= TRUE;
-          }
-        }
-      }else{
-
-        print_red(sprintf(_("You are not allowed to move this object to '%s'."),LDAP::fix($_POST['base'])));
-        $this->set_acl_base('dummy,'.$this->base);
+    
+    /* Set new base if allowed */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
       }
     }
   }