user2548436
user2548436

Reputation: 925

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/???

Upvotes: 1

Views: 6799

Answers (2)

Mohammed El Moumni
Mohammed El Moumni

Reputation: 267

I would like to add to @lisztomania's answer that this page from the mailing list archive of Apache Ranger gives a lot of available API calls and their description. You can find there the API calls to add / delete a user / group :

https://www.mail-archive.com/[email protected]/msg00064.html

Hope it will help !

Upvotes: 1

tdebroc
tdebroc

Reputation: 1526

  • Global note for all queries: Sometimes you have to remove /secure

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

  • Note: Sometimes you have to remove /secure

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
  • Note: Sometimes you have to remove /secure

  • Note 2: userfile.json should be like this:

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

  • userRoleList can be "ROLE_SYS_ADMIN" Or "ROLE_USER"
  • If you remove password, the user will be an external user.

Upvotes: 6

Related Questions