apachehadooppolicyapache-ranger

How to add users to Apache Ranger via REST API


As in the title, how to manually add a user to Apache Ranger via REST API.

Could you post an example of curl call?

Could you post in addiction an url where i can find the docs for:

   http:<ip>:6080/service/xusers/???

Solution

  • Get a User

    curl -u admin:admin -v -i -s -X GET http://xxx:6080/service/xusers/secure/users/$ID_USER
    

    Replace $ID_USER by your userId

    Get all User

    curl -u admin:admin -v -i -s -X GET http://xxx:6080/service/xusers/secure/users
    

    Delete a User

    curl -u admin:admin -v -i -s -X DELETE http://xxx:6080/service/xusers/secure/users/$ID_USER
    

    Replace $ID_USER by your userId

    Add/POST a User

    curl -u admin:admin -v -i -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" http://xxx:6080/service/xusers/secure/users -d @userfile.json
    

    { "name":"user1", "firstName":"user1", "lastName": "user1", "loginId": "user1", "emailAddress" : null, "description" : "user1 desc", "password" : "user1pass", "groupIdList":[2,12], "status":1, "isVisible":1, "userRoleList": [ "ROLE_SYS_ADMIN" ], "userSource": 0 }