0

I'm trying to access user info via ranger API, and I stumbled upon a strange issue:

When I access /xusers/users/userName/{userName} I don't get the expected JSON, like in this URL: https://ranger.apache.org/apidocs/resource_XUserREST.html

If I have a username that's called sUsername and I try /xusers/users/userName/Username (without s), I get the entire JSON even if the user isn't in any group!

If I enter /xusers/users/userName/sUsername I get the entire JSON except the groupIdList and groupNameList. Is this expected behaviour?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
coding_potato
  • 353
  • 2
  • 15

1 Answers1

0

I reproduced the issue, I can see the same behaviour. If the requirement is to get the groupIdList and groupNameList, then we have to use following api:-

/service/xusers/users/{id}

I understand, each time you have to get the id of the user but with the help of jq utility, we can map the names to id.

cat user.json | jq '.vXUsers[] | "\(.id) \(.name)"'

In this case user.json would be the file that has all the group and user information.

Following api should help generating user.json:-

curl -k  -u admin:admin -H "Accept: application/json" -X GET https://ranger_host:6182/service/xusers/users -o user.txt
rikamamanus
  • 811
  • 3
  • 19