Closed masakazuwatanabe closed 2 years ago
The issue is when you use the search
endpoint instead of the getItems
one. There is a hidden filter in the search engine for these tasks that restrict them to being your tasks. You see the same thing by going to the project task search page /front/projecttask.php
.'
The URL /apirest.php/ProjectTask
will show all project tasks.
There has been no activity on this issue for some time and therefore it is considered stale and will be closed automatically in 10 days.
If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, feel free to add a comment to revive this issue. If it is related to a new feature, please open a topic to discuss with community about this enhancement on suggestion website.
You may also consider taking a subscription to get professionnal support or contact GLPI editor team directly.
Hi, I can confirm the issue, even when using the URLs /apirest.php/ProjectTask
or /apirest.php/Project/<id>/ProjectTask
(I'm using GLPI 10.0.14).
I was able to understand a bit why it's working in the interface, but not in the API.
If the user has access to the project of the tasks, he has the right to read them even if he’s not in the Task Team (see https://github.com/glpi-project/glpi/blob/10.0/bugfixes/src/ProjectTask.php#L91-L96). Meaning that the user has the right to read the tasks as soon as it has the rights on the project.
Now, on the API part, the getItems
method correctly checks the rights, but it also create a where
condition:
(`glpi_projecttaskteams`.`itemtype` = 'User' AND `glpi_projecttaskteams`.`items_id` = '2')
Indeed, it first calls Search::addDefaultWhere
: https://github.com/glpi-project/glpi/blob/b69e15312f81915286a60de8ec68210570406123/src/Api/API.php#L1138
Which returns this condition: https://github.com/glpi-project/glpi/blob/b69e15312f81915286a60de8ec68210570406123/src/Search.php#L4343-L4348
This condition is incomplete as it should probably include an OR
clause to check if the user has right on the task project. I'm not able to say if it can have unexpected impacts though.
Code of Conduct
Is there an existing issue for this?
Version
10.0.2
Bug description
hello. I'm having a problem because I can't get the list of project tasks with API.
This problem also occurs in Ver9.4.5 - Ver9.5.7. https://github.com/glpi-project/glpi/issues/6818
Set Project to Seeall in your profile.
If "See all" in "Projects" of "Profile" is checked,
but,
It seems that the task team is used as a condition for querying the project task, regardless of the status of the SeeAll permission of the project.
https://github.com/glpi-project/glpi/blob/10873706f388795a1d0d72a028eb4ceba36f7169/src/Search.php#L4251-L4281
There is no way to list all project tasks in REST-API. If all projects have permissions Just as the WebUI shows all the tasks, I also want to get a list of all tasks in REST-API.
Relevant log output
No response
Page URL
No response
Steps To reproduce
No response
Your GLPI setup information
システムのインストールと設定の情報
Server
GLPI constants
Libraries
LDAP directories
SQL replicas
Notifications
Plugins list
Anything else?
No response