Skip to main content
vlundberg
Silver ⭐️⭐️
Mar 10, 2017 12:59 AM UTC

How to Manage Users and Security Policies via Ranger API.

  • Oct 5, 2026 8:46 AM UTC
  • 4 replies
  • 10175 views
  • Translate All

For this article let’s take the supposition that we have a MDM Software handling the enterprise organization.

When we add/change an item in a MDM, it goes throw a workflow (validation, dedup, etc…).

For synchronizing in real-time to Ranger “Users and Policies Management” the last action on the workflow must be publishing to a broker the information, that can be a JMS based broker(AMQ, RabbitMQ etc ..) or Kafka.

Putting the message into a broker gives you the safety of never losing the event.We use HDF to consume, built the payload and call Ranger API.

13472-screen-shot-2017-03-09-at-180115.png

List of hidden Ranger useful API's.

To invoke the API's

curl -u admin:admin -v -i -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" curl -u admin:admin -v -i -s -X GET curl -u admin:admin -v -i -s -X DELETE http://xxx:6080/service/xusers/secure/users/$ID_USER

Create a user

https://cwiki.apache.org/confluence/display/RANGER/REST+APIs+for+Service+Definition%2C+Service+and+Policy+Management

Others useful API's

Get a particular group by name

@srinivasp as this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.

Regards,

Vidya

Translate
Regards, Vidya Sargur, Community Manager Was your question answered? Make sure to mark the answer as the accepted solution. If you find a reply useful, say thanks by clicking on the thumbs up button.
urunath
Silver ⭐️
Oct 10, 2022 5:44 PM UTC

Hi ,

We want to import ranger policy from active cluster ranger to standby cluster ranger . Could you tell us how we can achieve this using sql and api

I can list policy using below command on Active cluster ranger database, could you tell us how do I insert approx. 10,000 ranger policy into standby cluster ranger database.

SELECT g.GROUP_NAME, g.DESCR group_descr, r.NAME role_name, r.DESCRIPTION role_descr,
p.NAME policy_name, p.DESCRIPTION policy_descr, p.POLICY_TEXT FROM
X_GROUP g,
X_ROLE r,
X_ROLE_REF_GROUP rg,
X_POLICY_REF_ROLE rp,
X_POLICY p
WHERE rg.GROUP_ID = g.ID
AND rg.ROLE_ID = r.ID
AND rp.ROLE_ID = r.ID
AND rp.POLICY_ID = p.ID
AND r.NAME like '%grant%'

 

Regards,
Gurunath

Translate
DianaTorres
Community Manager
Community Manager
Oct 10, 2022 5:50 PM UTC

@urunath As this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post. Thanks

Translate
Regards, Diana Torres, Senior Community Moderator