Inconsistency in User data accross APIs

api

#1

Hi,
I am using the patch from #7863 https://github.com/grafana/grafana/pull/7863#issuecomment-354004166 as i am using Nested queries in Elasticsearch
Grafana version: 4.3

i am using User HTTP API. In it, i am using the ‘Actual user’ API which returns the following response:

{
    "id": 0,
    "email": "super@localhost",
    "name": "",
    "login": "super",
    "theme": "",
    "orgId": 1,
    "isGrafanaAdmin": true
}

But when is use the ‘Search users’ API, it returns the following response:

  [
            {
                "id": 1,
                "name": "",
                "login": "super",
                "email": "super@localhost",
                "avatarUrl": "/grafana/avatar/214d0b9e3d7df8a9fa4a4ee0020d3138",
                "isAdmin": true,
                "lastSeenAt": "2018-12-28T12:28:12+05:30",
                "lastSeenAtAge": "2m"
            }
        ]

Note that the id in ‘Actual user’ is returned as 0 and in ‘Search users’ is returned as 1 for the same user email i.e. super. I even checked user on dashboard and there exists only one user i.e. super

Even when i use the ‘Get single user by id’ API like this:

URL : localhost/grafana/api/users/1

I get the following response:

{
    "id": 0,
    "email": "super@localhost",
    "name": "",
    "login": "super",
    "theme": "",
    "orgId": 1,
    "isGrafanaAdmin": true
}

What might be the reason behind such inconsistency in User id ??

I have to use this patched version of Grafana as Grafana doesn’t support Nested queries and only this patch has the fix.

Thanks and regards,
Kaiwalya