You are not logged in.
I think there is a bug in function methodGetTicket() of methodhelpdesk.class.php in the call of $ticket->can($params['ticket'], READ) (aprox line 839)
I'm calling the glpi.getTicket with an user that has super-admin privileges (I call , I set the entity root ( 0 ) (the ticket is created in root entity)
When I try to get some tickets (for example, in my setup ticket #100) the method returns WEBSERVICES_ERROR_NOTFOUND . The same user has no problems to see the ticket using helpdesk app.
I modify the function to let me see what is happen from this:
if (!$ticket->can($params['ticket'], READ)) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND);
}
To this:
$ret=$ticket->can($params['ticket'], READ);
if (!$ret) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND, '', '.' . print_r($ticket,true) . '. ticket:' . $params['ticket'] . "." );
}
The $ticket->can() call returns '' for ticket #100 but if I print_r the ticket, the content is there)
REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.doLogin</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>method</name>
<value>
<string>glpi.doLogin</string>
</value>
</member>
<member>
<name>login_name</name>
<value>
<string>damian</string>
</value>
</member>
<member>
<name>login_password</name>
<value>
<string>XXXXX</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>6</string>
</value>
</member>
<member>
<name>name</name>
<value>
<string>damian</string>
</value>
</member>
<member>
<name>realname</name>
<value>
<string>Fernandez Sosa (DSI)</string>
</value>
</member>
<member>
<name>firstname</name>
<value>
<string>Damian Alejandro</string>
</value>
</member>
<member>
<name>session</name>
<value>
<string>en1d1s2hjv0rfe3e82ukmtl9t4</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
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>en1d1s2hjv0rfe3e82ukmtl9t4</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>0</int>
</value>
</member>
<member>
<name>recursive</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>session</name>
<value>
<string>en1d1s2hjv0rfe3e82ukmtl9t4</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>
<int>0</int>
</value>
</member>
<member>
<name>completename</name>
<value>
<string>Entidad raíz</string>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>id</name>
<value>
<string>0</string>
</value>
</member>
<member>
<name>completename</name>
<value>
<string>Root entity</string>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>id</name>
<value>
<string>2</string>
</value>
</member>
<member>
<name>completename</name>
<value>
<string>Root entity > CNBA</string>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>id</name>
<value>
<string>5</string>
</value>
</member>
<member>
<name>completename</name>
<value>
<string>Root entity > CNBA > Dada de Baja</string>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>id</name>
<value>
<string>3</string>
</value>
</member>
<member>
<name>completename</name>
<value>
<string>Root entity > CNBA > En Deposito</string>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>id</name>
<value>
<string>1</string>
</value>
</member>
<member>
<name>completename</name>
<value>
<string>Root entity > ConectarIgualdad</string>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>id</name>
<value>
<string>4</string>
</value>
</member>
<member>
<name>completename</name>
<value>
<string>Root entity > EXTERNOS</string>
</value>
</member>
</struct>
</value>
</data>
</array>
</value>
</param>
</params>
</methodResponse>
REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.getTicket</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>method</name>
<value>
<string>glpi.getTicket</string>
</value>
</member>
<member>
<name>ticket</name>
<value>
<int>100</int>
</value>
</member>
<member>
<name>session</name>
<value>
<string>en1d1s2hjv0rfe3e82ukmtl9t4</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>10</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string>Not found (.Ticket Object
(
[dohistory] => 1
[userlinkclass] => Ticket_User
[grouplinkclass] => Group_Ticket
[supplierlinkclass] => Supplier_Ticket
[userentity_oncreate:protected] => 1
[hardwaredatas] => Array
(
)
[computerfound] => 0
[users:protected] => Array
(
[1] => Array
(
[0] => Array
(
[id] => 162
[tickets_id] => 100
[users_id] => 13
[type] => 1
[use_notification] => 1
[alternative_email] =>
)
)
[3] => Array
(
[0] => Array
(
[id] => 163
[tickets_id] => 100
[users_id] => 18393
[type] => 3
[use_notification] => 1
[alternative_email] =>
)
)
)
[groups:protected] => Array
(
)
[suppliers:protected] => Array
(
)
[mailqueueonaction] => 1
[fields] => Array
(
[id] => 100
[entities_id] => 0
[name] => Ruido
[date] => 2014-09-29 15:42:36
[closedate] => 2014-10-10 11:35:01
[solvedate] => 2014-09-29 19:53:57
[date_mod] => 2014-10-10 11:35:01
[users_id_lastupdater] => 10
[status] => 6
[users_id_recipient] => 13
[requesttypes_id] => 2
[content] => Alejandro:
La máquina de Silvia hace un tic tac raro, como si fuera una bomba de
tiempo próxima a explotar. Solicitamos acercarse por Secretaría a la
brevedad antes de que sea demasiado tardeee.
Atte,
Secretaría
-------------------------------------------------
Mail enviado desde el CNBA
http://www.cnba.uba.ar/
[urgency] => 3
[impact] => 3
[priority] => 3
[itilcategories_id] => 0
[type] => 1
[solutiontypes_id] => 0
[solution] => &lt;p&gt;Lo que hacia ruido era la UPS, no la CPU.&lt;/p&gt;
&lt;p&gt;Saludos...&lt;/p&gt;
&lt;p&gt; Ale&lt;/p&gt;
[global_validation] => 1
[slas_id] => 0
[slalevels_id] => 0
[due_date] =>
[begin_waiting_date] => 2014-09-29 19:53:57
[sla_waiting_duration] => 0
[waiting_duration] => 0
[close_delay_stat] => 935545
[solve_delay_stat] => 15081
[takeintoaccount_delay_stat] => 15081
[actiontime] => 0
[is_deleted] => 0
[locations_id] => 0
[validation_percent] => 0
)
[history_blacklist] => Array
(
)
[auto_message_on_action] => 1
[no_form_page] =>
[additional_fields_for_dictionnary] => Array
(
)
[fkfield:protected] =>
[searchopt:protected] =>
[taborientation] => vertical
[get_item_to_display_tab] => 1
[usenotepadrights:protected] =>
[type:protected] => -1
[displaylist:protected] => 1
[showdebug] =>
)
. ticket:100 .)</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
Offline
Hi,
glpi 0.85.4/Webservices1.5.0/xmlrpc/ functions called from test.php
login/set entity/setprofile to super admin
$args = array ();
$args['method'] = "glpi.getTicket";
$args['session'] = $sessionid ;
$args['ticket'] = "112";
$result = call_glpi($args);
and I get Ticket #112 whithout error.
have you tried ticket="100" as string rather than ticket=100 as integer ?
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
I add que " but it does not solve the problem.
The problem appears in some tickets not in all tickets (I think the method has the problem when the user that create the ticket is not the same that try to get the ticket
REQUEST:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>glpi.getTicket</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>method</name>
<value>
<string>glpi.getTicket</string>
</value>
</member>
<member>
<name>ticket</name>
<value>
<string>100</string>
</value>
</member>
<member>
<name>session</name>
<value>
<string>v2j95k2tkpq090ddehptrppvn6</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>10</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string>Not found (.Ticket Object
(
[dohistory] => 1
[userlinkclass] => Ticket_User
[grouplinkclass] => Group_Ticket
[supplierlinkclass] => Supplier_Ticket
[userentity_oncreate:protected] => 1
[hardwaredatas] => Array
(
)
[computerfound] => 0
[users:protected] => Array
(
[1] => Array
(
[0] => Array
(
[id] => 162
[tickets_id] => 100
[users_id] => 13
[type] => 1
[use_notification] => 1
[alternative_email] =>
)
)
[3] => Array
(
[0] => Array
(
[id] => 163
[tickets_id] => 100
[users_id] => 18393
[type] => 3
[use_notification] => 1
[alternative_email] =>
)
)
)
[groups:protected] => Array
(
)
[suppliers:protected] => Array
(
)
[mailqueueonaction] => 1
[fields] => Array
(
[id] => 100
[entities_id] => 0
[name] => Ruido
[date] => 2014-09-29 15:42:36
[closedate] => 2014-10-10 11:35:01
[solvedate] => 2014-09-29 19:53:57
[date_mod] => 2014-10-10 11:35:01
[users_id_lastupdater] => 10
[status] => 6
[users_id_recipient] => 13
[requesttypes_id] => 2
[content] => Alejandro:
La máquina de Silvia hace un tic tac raro, como si fuera una bomba de
tiempo próxima a explotar. Solicitamos acercarse por Secretaría a la
brevedad antes de que sea demasiado tardeee.
Atte,
Secretaría
-------------------------------------------------
Mail enviado desde el CNBA
http://www.cnba.uba.ar/
[urgency] => 3
[impact] => 3
[priority] => 3
[itilcategories_id] => 0
[type] => 1
[solutiontypes_id] => 0
[solution] => &lt;p&gt;Lo que hacia ruido era la UPS, no la CPU.&lt;/p&gt;
&lt;p&gt;Saludos...&lt;/p&gt;
&lt;p&gt; Ale&lt;/p&gt;
[global_validation] => 1
[slas_id] => 0
[slalevels_id] => 0
[due_date] =>
[begin_waiting_date] => 2014-09-29 19:53:57
[sla_waiting_duration] => 0
[waiting_duration] => 0
[close_delay_stat] => 935545
[solve_delay_stat] => 15081
[takeintoaccount_delay_stat] => 15081
[actiontime] => 0
[is_deleted] => 0
[locations_id] => 0
[validation_percent] => 0
)
[history_blacklist] => Array
(
)
[auto_message_on_action] => 1
[no_form_page] =>
[additional_fields_for_dictionnary] => Array
(
)
[fkfield:protected] =>
[searchopt:protected] =>
[taborientation] => vertical
[get_item_to_display_tab] => 1
[usenotepadrights:protected] =>
[type:protected] => -1
[displaylist:protected] => 1
[showdebug] =>
)
. ticket:100 .)</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
Offline
the ticket that I can't see was created via email using mailgate feature
Offline
The user who sent the webservices request must have right to read the ticket
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
reading the webservices requests in post #1 :
user damian(id=6), logged in root entity (id=0), with Super admin profile (id=4) recursive=1, should have right to read all tickets.
unless super admin profile was modified, i would say the request should return the ticket.
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
reading the webservices requests in post #1 :
user damian(id=6), logged in root entity (id=0), with Super admin profile (id=4) recursive=1, should have right to read all tickets.
unless super admin profile was modified, i would say the request should return the ticket.
I don't modify the super-admin profile. It is the same enviroment than the setTicketAssign bug solved yesterday (users webservice_Ci and damian are super-admin)
I do another test: I log to webservices using glpi user (which has mega-super-admin power) and I have the same results (returns not found error)
Offline
still investigating.
i'll have to create tickets by mailgate on my 0.85.4+webservices 1.5.0 and get ticket by webservices.
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
ticket created by me, closed, assigned to me, for requester A.
logged with requester B, (tech profile by default, not set with setMyEntity) getTicket => returns full ticket. OK
ticket status set to solved =>getTicket => returns full ticket. OK
logged with user C (post-only) getTicket returns "xmlrpc error(10): Not found" as expected since C as no rights on this ticket. OK
********************
I try to create a ticket with mailgate...
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
behaviour confirmed for tickets created with mailgate :
I create ticket by mail gate ticket status is "New" in root entity.
webservice : logged (Me as superadmin recursive in root entity) getticket=> Not Found.
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
The method $ticket->can() returns ""
The method can() is not defined in webservices , is defined in GLPI' s file
inc/commondbtm.class.php
I think the problem is the way webservices is calling that method (because I can see the ticket via helpdesk )
I continue to find the error (unfortunately, I never see the GLPI's code and I'm lost ) if I find something I'll post here
Thank you!..
Offline
did it again :
create ticket by mailgate ( requester C entity root) ticket status :new .
with web service : logged in with me, setMyprofile="4", SetMyEntity="0"recursive="1". getTicket AND IT WORKS
$args = array ();
$args['method'] = "glpi.doLogin";
$args['login_name'] = "ladenree";
$args['login_password'] = "MyPW";
$args['host']=$host;
$args['url']=$url;
if ($result = call_glpi($args)) {
$sessionid = $result['session'];
}
$result = call_glpi($args);
print_r($result);
$args = array ();
$args['method'] = "glpi.setMyProfile";
$args['session'] = $sessionid ;
$args['profile'] = "4";
$args['recursive'] = "1";
$result = call_glpi($args);
print_r($result);
$args = array ();
$args['method'] = "glpi.setMyEntity";
$args['session'] = $sessionid ;
$args['entity'] = "0";
$args['recursive'] = "1";
$result = call_glpi($args);
print_r($result);
$args = array ();
$args['method'] = "glpi.getTicket";
$args['session'] = $sessionid ;
$args['ticket'] = "178";
$result = call_glpi($args);
print_r($result);
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
WebServices rely on GLPI core right management.
If $ticket->can($params['ticket'], READ) doesn't return true, the issue "can't" be in webservices.
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
In the ticket I'm trying to get the method returns "" not true, not false just ''
Offline
i tried again to create a ticket by mailgate. New requester unknown by glpi, in entity#3.
(i am the last updater of this ticket because it was imported with my session)
webservices logged with my login
profile and entity set to superadmin in root recursive ( ticket is not in root)
glpi.getticket OK.
I'm sure that once (post #10) i got "not found" for mailgate tickets. something might have changed in my parameters.
now it works but i don't understand why !
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
I also don' t understand!! I move ticket 100 to ConectarIgualdad Entity and move it again to root entity and now getTicket is working!......!
Offline
your aswer remember me that for the firts ticket rules assign ticket to entity where not set (i create ticket by mailgate only for checking this presumed bug).
the only thing that changed is entity_ID
entity_id might have been empty not set, whene youy transfer to entity and back to root, entity id is set to 0.
that could explain this behaviour. to be continued...
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline