简体   繁体   English

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

[英]Add existing user to existing group apache ranger

im looking at apache Ranger rest API to add an existing internal user/users to an existing internal group.我正在查看apache Ranger rest API 以将现有的内部用户/用户添加到现有的内部组。

I have been looking at the docs and cant seem to find something useful,is there an API for that?我一直在看文档,但似乎找不到有用的东西,有没有 API 呢?

Try following api call:-尝试以下 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

Its little bit big but if user is already added to ranger then run following api to get the id information for users:-它有点大,但如果用户已经添加到游侠然后运行 api 以获取用户的 id 信息:-

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

Once you have IDs for all users, you can run following curl api to get the json formatted data which you can use to modify and then use PUT method in first API I mentioned:- Once you have IDs for all users, you can run following curl api to get the json formatted data which you can use to modify and then use PUT method in first API I mentioned:-

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

Above Curl api should return something like following:-以上 Curl api 应该返回如下内容:-

{"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\"}"}

you have to modify "groupIdList":[133,6] from the above output copy entire output and pass it with PUT method as shown in the first api call mentioned above.您必须从上面的 output 中修改"groupIdList":[133,6]复制整个 output 并使用 PUT 方法传递它,如上面提到的第一个 Z8A5DA52ED126447D359E70C05721A 调用所示。

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

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