You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Pradeep Agrawal <pr...@gmail.com> on 2021/11/22 10:22:04 UTC

Review Request 73720: RANGER-3439: REST api to get or delete ranger policy based on guid, service name and zone name

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73720/
-----------------------------------------------------------

Review request for ranger, Dineshkumar Yadav, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Sailaja Polavarapu, and Velmurugan Periasamy.


Bugs: RANGER-3439
    https://issues.apache.org/jira/browse/RANGER-3439


Repository: ranger


Description
-------

**Problem statement:** This RR is modification of the work done in RANGER-3439 (https://reviews.apache.org/r/73601/) which is already committed, changes are needed for the changes proposed in https://reviews.apache.org/r/73719/

**Proposed solution:** API getPolicyByGUIDAndServiceName and deletePolicyByGUIDAndServiceName can be modified to address the requirement which shall accept the guid service name and zone name as request parameters input and provide the get policy or delete policy option.
API:
a) getPolicyByGUIDAndServiceNameAndZoneName(guid, service, zone): reads the input values and returns the policy object.
b) deletePolicyByGUIDAndServiceNameAndZoneName(guid, service, zone) : reads the input values and deletes the respective policy object.


Diffs
-----

  security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java f13cef71d 
  security-admin/src/main/java/org/apache/ranger/db/XXPolicyDao.java 41ca8b2a6 
  security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 6ab3d52a0 
  security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 3ba29653b 
  security-admin/src/main/resources/META-INF/jpa_named_queries.xml 85cadbbd5 


Diff: https://reviews.apache.org/r/73720/diff/1/


Testing
-------

Tested getPolicyByGUIDAndServiceNameAndZoneName() API and was able to recieve the matching policy object.
Tested deletePolicyByGUIDAndServiceNameAndZoneName() API and was able to delete the respective policy object.

**Sample curl requests:**

curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'

curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'


curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'

curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'


Thanks,

Pradeep Agrawal


Re: Review Request 73720: RANGER-3439: REST api to get or delete ranger policy based on guid, service name and zone name

Posted by Abhay Kulkarni <ak...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73720/#review223795
-----------------------------------------------------------


Ship it!




Ship It!

- Abhay Kulkarni


On Nov. 22, 2021, 10:22 a.m., Pradeep Agrawal wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73720/
> -----------------------------------------------------------
> 
> (Updated Nov. 22, 2021, 10:22 a.m.)
> 
> 
> Review request for ranger, Dineshkumar Yadav, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Sailaja Polavarapu, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-3439
>     https://issues.apache.org/jira/browse/RANGER-3439
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> **Problem statement:** This RR is modification of the work done in RANGER-3439 (https://reviews.apache.org/r/73601/) which is already committed, changes are needed for the changes proposed in https://reviews.apache.org/r/73719/
> 
> **Proposed solution:** API getPolicyByGUIDAndServiceName and deletePolicyByGUIDAndServiceName can be modified to address the requirement which shall accept the guid service name and zone name as request parameters input and provide the get policy or delete policy option.
> API:
> a) getPolicyByGUIDAndServiceNameAndZoneName(guid, service, zone): reads the input values and returns the policy object.
> b) deletePolicyByGUIDAndServiceNameAndZoneName(guid, service, zone) : reads the input values and deletes the respective policy object.
> 
> 
> Diffs
> -----
> 
>   security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java cb57b9913 
>   security-admin/src/main/java/org/apache/ranger/db/XXPolicyDao.java 3558337a3 
>   security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 6ab3d52a0 
>   security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 3ba29653b 
>   security-admin/src/main/resources/META-INF/jpa_named_queries.xml a19f7f1d8 
> 
> 
> Diff: https://reviews.apache.org/r/73720/diff/2/
> 
> 
> Testing
> -------
> 
> Tested getPolicyByGUIDAndServiceNameAndZoneName() API and was able to recieve the matching policy object.
> Tested deletePolicyByGUIDAndServiceNameAndZoneName() API and was able to delete the respective policy object.
> 
> **Sample curl requests:**
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'
> 
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'
> 
> 
> Thanks,
> 
> Pradeep Agrawal
> 
>


Re: Review Request 73720: RANGER-3439: REST api to get or delete ranger policy based on guid, service name and zone name

Posted by Pradeep Agrawal <pr...@gmail.com>.

> On Dec. 2, 2021, 9:11 p.m., Abhay Kulkarni wrote:
> > security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java
> > Line 416 (original), 416 (patched)
> > <https://reviews.apache.org/r/73720/diff/2/?file=2256065#file2256065line416>
> >
> >     Please update the PublicAPI documentation accordingly. (lines 416 and 521)

This is being tracked separately here : https://issues.apache.org/jira/browse/RANGER-3501


- Pradeep


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73720/#review223794
-----------------------------------------------------------


On Nov. 22, 2021, 10:22 a.m., Pradeep Agrawal wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73720/
> -----------------------------------------------------------
> 
> (Updated Nov. 22, 2021, 10:22 a.m.)
> 
> 
> Review request for ranger, Dineshkumar Yadav, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Sailaja Polavarapu, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-3439
>     https://issues.apache.org/jira/browse/RANGER-3439
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> **Problem statement:** This RR is modification of the work done in RANGER-3439 (https://reviews.apache.org/r/73601/) which is already committed, changes are needed for the changes proposed in https://reviews.apache.org/r/73719/
> 
> **Proposed solution:** API getPolicyByGUIDAndServiceName and deletePolicyByGUIDAndServiceName can be modified to address the requirement which shall accept the guid service name and zone name as request parameters input and provide the get policy or delete policy option.
> API:
> a) getPolicyByGUIDAndServiceNameAndZoneName(guid, service, zone): reads the input values and returns the policy object.
> b) deletePolicyByGUIDAndServiceNameAndZoneName(guid, service, zone) : reads the input values and deletes the respective policy object.
> 
> 
> Diffs
> -----
> 
>   security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java cb57b9913 
>   security-admin/src/main/java/org/apache/ranger/db/XXPolicyDao.java 3558337a3 
>   security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 6ab3d52a0 
>   security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 3ba29653b 
>   security-admin/src/main/resources/META-INF/jpa_named_queries.xml a19f7f1d8 
> 
> 
> Diff: https://reviews.apache.org/r/73720/diff/2/
> 
> 
> Testing
> -------
> 
> Tested getPolicyByGUIDAndServiceNameAndZoneName() API and was able to recieve the matching policy object.
> Tested deletePolicyByGUIDAndServiceNameAndZoneName() API and was able to delete the respective policy object.
> 
> **Sample curl requests:**
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'
> 
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'
> 
> 
> Thanks,
> 
> Pradeep Agrawal
> 
>


Re: Review Request 73720: RANGER-3439: REST api to get or delete ranger policy based on guid, service name and zone name

Posted by Abhay Kulkarni <ak...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73720/#review223794
-----------------------------------------------------------




security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java
Line 416 (original), 416 (patched)
<https://reviews.apache.org/r/73720/#comment312866>

    Please update the PublicAPI documentation accordingly. (lines 416 and 521)


- Abhay Kulkarni


On Nov. 22, 2021, 10:22 a.m., Pradeep Agrawal wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73720/
> -----------------------------------------------------------
> 
> (Updated Nov. 22, 2021, 10:22 a.m.)
> 
> 
> Review request for ranger, Dineshkumar Yadav, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Sailaja Polavarapu, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-3439
>     https://issues.apache.org/jira/browse/RANGER-3439
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> **Problem statement:** This RR is modification of the work done in RANGER-3439 (https://reviews.apache.org/r/73601/) which is already committed, changes are needed for the changes proposed in https://reviews.apache.org/r/73719/
> 
> **Proposed solution:** API getPolicyByGUIDAndServiceName and deletePolicyByGUIDAndServiceName can be modified to address the requirement which shall accept the guid service name and zone name as request parameters input and provide the get policy or delete policy option.
> API:
> a) getPolicyByGUIDAndServiceNameAndZoneName(guid, service, zone): reads the input values and returns the policy object.
> b) deletePolicyByGUIDAndServiceNameAndZoneName(guid, service, zone) : reads the input values and deletes the respective policy object.
> 
> 
> Diffs
> -----
> 
>   security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java cb57b9913 
>   security-admin/src/main/java/org/apache/ranger/db/XXPolicyDao.java 3558337a3 
>   security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 6ab3d52a0 
>   security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 3ba29653b 
>   security-admin/src/main/resources/META-INF/jpa_named_queries.xml a19f7f1d8 
> 
> 
> Diff: https://reviews.apache.org/r/73720/diff/2/
> 
> 
> Testing
> -------
> 
> Tested getPolicyByGUIDAndServiceNameAndZoneName() API and was able to recieve the matching policy object.
> Tested deletePolicyByGUIDAndServiceNameAndZoneName() API and was able to delete the respective policy object.
> 
> **Sample curl requests:**
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'
> 
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/0be7457b-35c7-4ca9-bd08-938d98a3e724?serviceName=cm_hive'
> 
> curl -u admin:Ranger1234 -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE 'http://localhost:6080/service/plugins/policies/guid/ad88dd6f-1d85-4a67-8e84-813809c83da0?serviceName=cm_hive&zoneName=zone1'
> 
> 
> Thanks,
> 
> Pradeep Agrawal
> 
>