Code

removed unused code
[gosa.git] / gosa-plugins / systems / admin / systems / class_componentGeneric.inc
index 8fe4eb5f1ce2bc2fd3b810d782a570e3f5154c6b..002b38b2eb4c3fe12d580b6c3e15e2b56c079d73 100644 (file)
@@ -31,6 +31,8 @@ class componentGeneric extends plugin
   var $cn= "";
   var $description= "";
   var $orig_dn= "";
+  var $orig_cn= "";
+  var $orig_base= "";
 
   /* attribute list for save action */
   var $attributes= array("cn", "description");
@@ -48,11 +50,14 @@ class componentGeneric extends plugin
       $this->base= dn2base($ui->dn);
       $this->cn= "";
     } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+      $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_ou("componentou"))."/", "", $this->dn);
     }
     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, true);
     /* Save dn for later references */
     $this->orig_dn= $this->dn;
+
+    $this->orig_base = $this->base;
+    $this->orig_cn = $this->cn;
   }
 
 
@@ -68,7 +73,7 @@ class componentGeneric extends plugin
 
     /* Do we represent a valid phone? */
     if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+      $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
         msgPool::noValidExtension(_("component"))."</b>";
       return($display);
     }
@@ -235,6 +240,14 @@ class componentGeneric extends plugin
       }
     }
 
+    /* Check if we are allowed to create or move this object
+     */
+    if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
+      $message[] = msgPool::permCreate();
+    }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
+      $message[] = msgPool::permMove();
+    }
+
     return ($message);
   }
 
@@ -274,10 +287,6 @@ class componentGeneric extends plugin
       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
       
     } else {
-      if ($this->orig_dn != $this->dn){
-        $this->move($this->orig_dn, $this->dn);
-      }
-
       $ldap->cd($this->dn);
       $this->cleanup();
       $ldap->modify ($this->attrs);