将现有用户添加到现有组 apache ranger

Add existing user to existing group apache ranger

我正在查看 apache Ranger 休息 API 以将现有内部 user/users 添加到现有内部组。

我一直在查看文档,但似乎找不到有用的东西,有 API 吗?

尝试以下 api 调用:-

curl -ivk -u admin:admin -H "Content-Type: application/json" -d '{"id":13,"createDate":"2020-12-23T07:55:04Z","updateDate":"2020-12-23T07:55:04Z","owner":"rangerusersync","updatedBy":"rangerusersync","name":"atlas","password":"*****","description":"atlas - add from Unix box","groupIdList":[6,59,4,131,133],"groupNameList":["atlas","hadoop","shadow"],"status":0,"isVisible":1,"userSource":1,"userRoleList":["ROLE_USER"],"otherAttributes":"{\"full_name\":\"atlas\",\"original_name\":\"atlas\"}"}'  -X PUT https://RANGER_HOST:6182/service/xusers/users

它有点大但是如果用户已经添加到 ranger 然后 运行 按照 api 获取用户的 id 信息:-

curl -ivk -u admin:admin -H "Accept : application/json" -X GET https://RANGER_HOST:6182/service/xusers/users

一旦你有了所有用户的ID,你可以运行跟随curl api得到你可以用来修改的json格式化数据,然后先使用PUT方法API 我提到了:-

curl -ivk -u admin:admin -H "Accept: application/json" -X GET https://RANGER_HOST:6182/service/xusers/users/13

Above Curl api 应该 return 如下所示:-

{"id":13,"createDate":"2020-12-23T07:55:04Z","updateDate":"2020-12-23T16:45:14Z","owner":"rangerusersync","updatedBy":"admin","name":"atlas","password":"*****","description":"atlas - add from Unix box","groupIdList":[133,6],"groupNameList":["apitest","atlas","hadoop","shadow","ssb"],"status":0,"isVisible":1,"userSource":1,"userRoleList":["ROLE_USER"],"otherAttributes":"{\"full_name\":\"atlas\",\"original_name\":\"atlas\"}"}

您必须从上面的输出中修改 "groupIdList":[133,6] 复制整个输出并使用 PUT 方法传递它,如上面提到的第一个 api 调用所示。