Project

General

Profile

Actions

Bug #17741

open

Wrong total when querying fact_values via API

Added by Leonardo Sorrentino over 7 years ago. Updated about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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

Actions #1

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 #3

Updated by Joseph Magen about 7 years ago

  • Assignee set to Joseph Magen
Actions

Also available in: Atom PDF