You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2012-08-28 14:13:51

Poil
Member
Registered: 2005-04-15
Posts: 9

Plugin Appliances - Cannot deleteItem - perms error

Hi,

We can't delete an item (a computer) on Plugin Appliances.

I think there is something wrong in plugins/appliances/front/appliance.form.php

} else if (isset($_POST["deleteitem"])){
   foreach ($_POST["item"] as $key => $val) {
      $input = array('id' => $key);
      if ($val == 1) {
         $PluginItem->check($key, 'w');
         $PluginItem->delete($input);
      }
   }
   Html::back();

There is no itemtype posted but I think PluginItem object need an itemtype to check permission ?

For  the moment I've patch like this :

         $PluginAppliances->check(-1, 'w', $_POST);
         #$PluginItem->check($key, 'w');

Best regards,
Poil

Last edited by Poil (2012-08-28 14:23:58)

Offline

#2 2012-08-28 16:45:43

Poil
Member
Registered: 2005-04-15
Posts: 9

Re: Plugin Appliances - Cannot deleteItem - perms error

Another problem, on webapplication

When I try to add an application the value of the hidden field plugin_webapplications_webapplications_id is empty

inc/webapplication_item.class.php

echo "<input type='hidden' name='plugin_webapplications_webapplications_id' value='$ID'>";

So I've patch inc/webapplication_item.class.php

--- /var/tmp/webapplications/inc/webapplication_item.class.php    2012-07-20 02:32:24.000000000 +0200
+++ webapplications/inc/webapplication_item.class.php    2012-08-28 17:03:26.149386370 +0200
@@ -235,11 +235,10 @@
                         echo "</td>";
                      }
                      echo "<td class='center'>".$item->getTypeName()."</td>";
-
-                     $ID = "";
-                     if ($_SESSION["glpiis_ids_visible"]||empty($data["name"])) $ID= " (".$data["id"].")";
+                     $DISPLAY_ID = "";
+                     if ($_SESSION["glpiis_ids_visible"]||empty($data["name"])) $DISPLAY_ID= " (".$data["id"].")";
                      $link = Toolbox::getItemTypeFormURL($type);
-                     $name = "<a href=\"".$link."?id=".$data["id"]."\">".$data["name"]."$ID</a>";
+                     $name = "<a href=\"".$link."?id=".$data["id"]."\">".$data["name"]."$DISPLAY_ID</a>";
                      echo "<td class='center' ".
                             (isset($data['is_deleted'])&&$data['is_deleted']?"class='tab_bg_2_2'":"").
                            ">".$name."</td>";
@@ -261,7 +260,7 @@
 
          if ($canedit)    {
             echo "<tr class='tab_bg_1'><td colspan='".(3+$colsup)."' class='center'>";
-            echo "<input type='hidden' name='plugin_webapplications_webapplications_id' value='$ID'>";
+            echo '<input type="hidden" name="plugin_webapplications_webapplications_id" value="'.$ID.'">';
             Dropdown::showAllItems("items_id", 0, 0,
                                    ($PluginWebapplicationsWebapplication->fields['is_recursive']
                                        ?-1:$PluginWebapplicationsWebapplication->fields['entities_id']),
@@ -801,4 +800,4 @@
    }
 
 }
-?>
\ No newline at end of file
+?>

Last edited by Poil (2012-08-28 17:07:18)

Offline

#3 2012-09-13 18:41:37

tsmr
GLPI-DEV
From: Rennes
Registered: 2005-08-26
Posts: 11,632
Website

Re: Plugin Appliances - Cannot deleteItem - perms error


Xavier Caillaud
Blog GLPI Infotel

Offline

Board footer

Powered by FluxBB