Code

Updated move and create checks
[gosa.git] / gosa-plugins / goto / admin / applications / class_applicationGeneric.inc
index d5691327912609e1bcf9188a1070da52885ade8b..820c9cea070004e6ba4dd85cae8e39ce7e1a2e0e 100644 (file)
@@ -17,6 +17,10 @@ class application extends plugin
   var $last_sorting= "invalid";
   var $applications= array();
 
+  var $orig_base = "";
+  var $orig_cn = "";
+  var $orig_dn = "";
+
   /* attribute list for save action */
   var $attributes= array("cn", "description", "gosaApplicationExecute", "gosaApplicationName","gosaApplicationIcon",
       "gosaApplicationFlags","gotoLogonScript");
@@ -29,6 +33,7 @@ class application extends plugin
 
     /* Load icon */
     $ldap= $config->get_ldap_link();
+    $this->orig_dn = $dn;
     if ($dn != 'new'){
       $this->iconData= $ldap->get_attribute($dn, "gosaApplicationIcon");
       $this->saved_attributes['gosaApplicationIcon'] = $this->iconData;
@@ -53,6 +58,9 @@ class application extends plugin
     } else {
       $this->base= preg_replace ("/^[^,]+,".get_ou('applicationou')."/", "", $this->dn);
     }
+
+    $this->orig_cn = $this->cn;
+    $this->orig_base = $this->base;
   }
 
 
@@ -112,7 +120,7 @@ class application extends plugin
  
     /* Do we represent a valid group? */
     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(_("application"))."</b>";
       return ($display);
     }
@@ -327,7 +335,7 @@ class application extends plugin
 
         if (!function_exists("imagick_blob2image")){
           /* Get temporary file name for conversation */
-          $fname = tempnam ("/tmp", "GOsa");
+          $fname = tempnam (TEMP_DIR, "GOsa");
 
           /* Open file and write out photoData */
           $fp = fopen ($fname, "w");
@@ -444,6 +452,15 @@ class application extends plugin
         $message[]= msgPool::duplicated("cn");
       }
     }
+
+    /* 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;
   }