Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Create Ranger hive policy through REST API

avatar
Contributor

Hi All,

 

I have a requirement like, I need to create hive policy through REST API in CDP Env with two groups .Here , we are giving permission at group level not at user level.

one group with "ALL" permissions  and 2nd group with "select" permission.

 

I have created policy through REST API with one group with "all" permissions but how to mention 2nd group with "select" permission in same create policy command.

I have tried the below method but did not worked.

 

 

 

CURLURL="https://host:6182/service/public/v2/api/policy/"
CURLDATA='{   "isEnabled":true,"service":"cm_hive","name":"policy_test1","description":"Policy for employees database access","isAuditEnabled":true,"resources":{"database":{"values":["DBNAME"],"isExcludes":false,"isRecursive":false},"table":{"values":["*"],"isExcludes":false,"isRecursive":false}},"policyItems":[{"accesses":[{"type":"ALL","isAllowed":true}],"users":[""],"groups":["GROUP1"],[{"type":"SELECT","isAllowed":true}],"users":[""],"groups":["GROUP2"]"conditions":[],"delegateAdmin":false}],"denyPolicyItems":[],"allowExceptions":[],"denyExceptions":[],"dataMaskPolicyItems":[],"rowFilterPolicyItems":[]}'
RESPONSE=`curl -k -iv -u username:password -H "Content-Type: application/json" -X POST "$CURLURL"  -d "$CURLDATA"`

 

 

 

 

 

Thanks in advance!

 

 

Srini Podili

1 ACCEPTED SOLUTION

avatar
Contributor

Hi All,

It worked ,i did mistake .i forgot to add "access" before second group permission.

 

Thanks 

Srinivas

View solution in original post

1 REPLY 1

avatar
Contributor

Hi All,

It worked ,i did mistake .i forgot to add "access" before second group permission.

 

Thanks 

Srinivas