简体   繁体   English

Apache Ranger Api 不返回数据

[英]Apache Ranger Api not returning data

I'm trying to access user info via ranger API, and I stumbled upon a strange issue:我正在尝试通过游侠 API 访问用户信息,但偶然发现了一个奇怪的问题:

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 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!如果我有一个名为sUsername的用户名并尝试/xusers/users/userName/Username (没有s ),即使用户不在任何组中,我也会得到整个 JSON !

If I enter /xusers/users/userName/sUsername I get the entire JSON except the groupIdList and groupNameList .如果我输入/xusers/users/userName/sUsername我得到整个 JSON除了groupIdListgroupNameList Is this expected behaviour?这是预期的行为吗?

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:-如果要求是获取groupIdListgroupNameList ,那么我们必须使用以下 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.我了解,每次您必须获取用户的 id,但在jq实用程序的帮助下,我们可以 map 将名称转换为 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.在这种情况下, user.json将是包含所有组和用户信息的文件。

Following api should help generating user.json :-关注 api 应该有助于生成user.json :-

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM