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 2015-07-27 20:42:16

damian
Member
Registered: 2015-07-27
Posts: 29

[webservices] bug in methodinventaire.class.php line 579

I write here because I can't fill a bug (I can't see the option)

when I search a computer the method listObjects returns all computers, (I'm using version 1.5.0 )

I change  line 579 of methodinventaire.class.php

from
                && $item->getField($option['linkfield']) != NOT_AVAILABLE) {

to

                && $item->getField($option['field']) != NOT_AVAILABLE) {


now,  the method let me search the computer I'm looking for


Can you fix this?

Thanks!

Offline

#2 2015-09-06 16:15:46

damian
Member
Registered: 2015-07-27
Posts: 29

Re: [webservices] bug in methodinventaire.class.php line 579

This is the other (I think) bug that I found in version 1.5.0 of webservices

Offline

#3 2015-09-06 18:12:12

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: [webservices] bug in methodinventaire.class.php line 579


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#4 2015-09-06 19:10:35

damian
Member
Registered: 2015-07-27
Posts: 29

Re: [webservices] bug in methodinventaire.class.php line 579

Thank You!..

Offline

#5 2015-09-07 21:08:24

damian
Member
Registered: 2015-07-27
Posts: 29

Re: [webservices] bug in methodinventaire.class.php line 579

I found another issue:

If I set the entity to the same entity where the computer I' m looking for is created the funcion works OK. But if I set the entity to the parent' s entity -the root entity-  (The user damian and webservice_ci are superadmin of the root entity with recursive right) The function returns all the computers








REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.setMyEntity</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>method</name>
     <value>
      <string>glpi.setMyEntity</string>
     </value>
    </member>
    <member>
     <name>entity</name>
     <value>
      <int>1</int>
     </value>
    </member>
    <member>
     <name>recursive</name>
     <value>
      <int>1</int>
     </value>
    </member>
    <member>
     <name>session</name>
     <value>
      <string>dl58mghsg9htk96d8n0mgprg55</string>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
 <param>
  <value>
   <array>
    <data>
     <value>
      <struct>
       <member>
        <name>id</name>
        <value>
         <string>1</string>
        </value>
       </member>
       <member>
        <name>completename</name>
        <value>
         <string>Root entity &#62; ConectarIgualdad</string>
        </value>
       </member>
      </struct>
     </value>
    </data>
   </array>
  </value>
 </param>
</params>
</methodResponse>

REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.listObjects</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>method</name>
     <value>
      <string>glpi.listObjects</string>
     </value>
    </member>
    <member>
     <name>start</name>
     <value>
      <int>0</int>
     </value>
    </member>
    <member>
     <name>limit</name>
     <value>
      <int>10000</int>
     </value>
    </member>
    <member>
     <name>itemtype</name>
     <value>
      <string>Computer</string>
     </value>
    </member>
    <member>
     <name>name</name>
     <value>
      <string>00FF101ECFFC</string>
     </value>
    </member>
    <member>
     <name>session</name>
     <value>
      <string>dl58mghsg9htk96d8n0mgprg55</string>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
 <param>
  <value>
   <array>
    <data>
     <value>
      <struct>
       <member>
        <name>name</name>
        <value>
         <string>6C71D965D279</string>
        </value>
       </member>
       <member>
        <name>id</name>
        <value>
         <string>328</string>
        </value>
       </member>
       <member>
        <name>locations_id</name>
        <value>
         <string>0</string>
        </value>
       </member>
       <member>
        <name>serial</name>
        <value>
         <string>AA8163034015</string>
        </value>
       </member>
       <member>
        <name>otherserial</name>
        <value>
         <string>AA8163034015</string>
        </value>
       </member>
      </struct>
     </value>
     <value>
      <struct>
       <member>
        <name>name</name>
        <value>
         <string>6C71D9666903</string>
        </value>
       </member>
       <member>
        <name>id</name>
        <value>
         <string>329</string>
        </value>
       </member>
       <member>
        <name>locations_id</name>
        <value>
         <string>0</string>
        </value>
       </member>
       <member>
        <name>serial</name>
        <value>
         <string>AA3163035032</string>
        </value>
       </member>
       <member>
        <name>otherserial</name>
        <value>
         <string>AA3163035032</string>
        </value>
       </member>
      </struct>
     </value>
     <value>
      <struct>
       <member>
        <name>name</name>
        <value>
         <string>6C71D9666912</string>
        </value>
       </member>
       <member>
        <name>id</name>
        <value>
         <string>330</string>
        </value>
       </member>
       <member>
        <name>locations_id</name>
        <value>
         <string>0</string>
        </value>
       </member>
      </struct>
     </value>
     <value>
      <struct>
       <member>
        <name>name</name>
        <value>
         <string>6C71D965D0B1</string>
        </value>
       </member>
       <member>
        <name>id</name>
        <value>
         <string>331</string>
        </value>
       </member>
       <member>
        <name>locations_id</name>
        <value>
         <string>0</string>
        </value>
       </member>
       <member>
        <name>serial</name>
        <value>
         <string>AA2163034441</string>
        </value>
       </member>
       <member>
        <name>otherserial</name>
        <value>
         <string>AA2163034441</string>
        </value>
       </member>
      </struct>
     </value>
     <value>



but if I do the same request in the entity where the computer is created, it returns as expected( only 1 machine matching the computer's name )



REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.setMyProfile</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>method</name>
     <value>
      <string>glpi.setMyProfile</string>
     </value>
    </member>
    <member>
     <name>profile</name>
     <value>
      <int>4</int>
     </value>
    </member>
    <member>
     <name>session</name>
     <value>
      <string>76gvmmhh3il4l5eg7c2b8vn0k0</string>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>id</name>
     <value>
      <string>4</string>
     </value>
    </member>
    <member>
     <name>name</name>
     <value>
      <string>Super-Admin</string>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodResponse>

REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.setMyEntity</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>method</name>
     <value>
      <string>glpi.setMyEntity</string>
     </value>
    </member>
    <member>
     <name>entity</name>
     <value>
      <int>1</int>
     </value>
    </member>
    <member>
     <name>recursive</name>
     <value>
      <int>1</int>
     </value>
    </member>
    <member>
     <name>session</name>
     <value>
      <string>76gvmmhh3il4l5eg7c2b8vn0k0</string>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
 <param>
  <value>
   <array>
    <data>
     <value>
      <struct>
       <member>
        <name>id</name>
        <value>
         <string>1</string>
        </value>
       </member>
       <member>
        <name>completename</name>
        <value>
         <string>Root entity &#62; ConectarIgualdad</string>
        </value>
       </member>
      </struct>
     </value>
    </data>
   </array>
  </value>
 </param>
</params>
</methodResponse>

REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.listObjects</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>method</name>
     <value>
      <string>glpi.listObjects</string>
     </value>
    </member>
    <member>
     <name>start</name>
     <value>
      <int>0</int>
     </value>
    </member>
    <member>
     <name>limit</name>
     <value>
      <int>10000</int>
     </value>
    </member>
    <member>
     <name>itemtype</name>
     <value>
      <string>Computer</string>
     </value>
    </member>
    <member>
     <name>name</name>
     <value>
      <string>00FF101ECFFC</string>
     </value>
    </member>
    <member>
     <name>session</name>
     <value>
      <string>76gvmmhh3il4l5eg7c2b8vn0k0</string>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
 <param>
  <value>
   <array>
    <data>
     <value>
      <struct>
       <member>
        <name>name</name>
        <value>
         <string>00FF101ECFFC</string>
        </value>
       </member>
       <member>
        <name>id</name>
        <value>
         <string>3881</string>
        </value>
       </member>
       <member>
        <name>locations_id</name>
        <value>
         <string>0</string>
        </value>
       </member>
       <member>
        <name>serial</name>
        <value>
         <string>AA5184124661</string>
        </value>
       </member>
       <member>
        <name>otherserial</name>
        <value>
         <string>AA5184124661</string>
        </value>
       </member>
      </struct>
     </value>
    </data>
   </array>
  </value>
 </param>
</params>
</methodResponse>

Offline

Board footer

Powered by FluxBB