Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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