Actions
Bug #17741
openWrong total when querying fact_values via API
Description
I have a user with the 'viewer' role, and if I try for example:
curl -k -u username:password "https://localhost/api/v2/fact_values?search=name=disks" | python -mjson.tool
I get the following response:
{ "page": 1, "per_page": 30, "results": { "hostA": { "disks": null }, "hostB": { "disks": null }, "hostC": { "disks": null }, "hostD": { "disks": null }, "hostE": { "disks": null }, "hostF": { "disks": null }, "hostG": { "disks": null } }, "search": "name=disks", "sort": { "by": null, "order": null }, "subtotal": 7, "total": 0 }
The field "Total" is always 0 with non-Administrator users. If the query is from an Administrator it always returns a fixed value:
"total": 60232
Which is exactly the record count in my fact_values table:
MariaDB [foremandb]> select count(*) from fact_values; +----------+ | count(*) | +----------+ | 60232 | +----------+ 1 row in set (0.01 sec)
It was working in Foreman 1.12.4, it broke after the upgrade to 1.13.2
Updated by Dominic Cleal over 7 years ago
- Subject changed from Wrong Total when querying facts via API to Wrong total when querying fact_values via API
- Category set to API
Actions