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...@freestoneinfotech.com> on 2016/05/30 05:33:31 UTC

Review Request 48023: RANGER-998 : Trim policy name in create/update policy request

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

Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Selvamohan Neethiraj, and Velmurugan Periasamy.


Bugs: BUG-998
    https://issues.apache.org/jira/browse/BUG-998


Repository: ranger


Description
-------

**Problem Statement: **
Currently only at UI end only policy name is trimmed, policy name should be trimmed at server end also.

**Proposed Solution: **
Proposed solution will trim policy name before storing policy name in x_policy table.


**Note:** Sample curl request to create policy having blank spaces at the start or end of policy name.

curl -i -u admin:admin  --header "Accept:application/json" -H "Content-Type:application/json" -X POST http://localhost:6080/service/plugins/policies -d '{"policyType":"0","name":"  cl1_hive_policy3   ","isEnabled":true,"description":"","isAuditEnabled":true,"resources":{"database":{"values":["cl1_hive_policy3"],"isRecursive":false,"isExcludes":false},"table":{"values":["abc3"],"isRecursive":false,"isExcludes":false},"column":{"values":["dfgh3"],"isRecursive":false,"isExcludes":false}},"policyItems":[{"users":["admin"],"accesses":[{"type":"select","isAllowed":true},{"type":"update","isAllowed":true},{"type":"create","isAllowed":true},{"type":"drop","isAllowed":true},{"type":"alter","isAllowed":true},{"type":"index","isAllowed":true},{"type":"lock","isAllowed":true},{"type":"all","isAllowed":true}]}],"denyPolicyItems":[],"allowExceptions":[],"denyExceptions":[],"service":"cl1_hive"}'


Diffs
-----

  security-admin/src/main/java/org/apache/ranger/biz/RangerPolicyRetriever.java 6b4b149 
  security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java 2f88a9b 
  security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java 4343c45 
  security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePersmission_J10005.java bda4b30 
  security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 4432bac 
  security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 19a1509 
  security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java 630be4f 
  security-admin/src/main/java/org/apache/ranger/service/XPolicyService.java 5e8ed56 

Diff: https://reviews.apache.org/r/48023/diff/


Testing
-------

***Case-1 : Upgrade Case***
**Steps performed: **
1. Installed Ranger admin 0.5 version and started Ranger admin.
2. Created policies using REST API where policy name contains blank spaces at the start or end of policy name.
3. Visited 'x_policy' table and confirmed that policies created with blank spaces are persisted in table. 
4. Stopped Ranger Admin.
5. Created Build of latest Ranger-admin with patch and Installed Ranger Admin with DB details used during installation of Ranger 0.5.
6. After installation confirmed that PatchTagModulePersmission_J10005.class is executed sucessfully.
7. Visited x_policy table to make sure policies created with spaces in policy name are trimmed or not.

**Expected behaviour :**
Policies should not have blank spaces at the start or end of policy name.

**Actual behaviour :**
Policies did not have blank spaces at the start or end of policy name.


***Case-2 : Latest Ranger with patch***
**Steps performed: **
1. Installed Ranger admin with patch and started Ranger admin.
2. Tried to create policies using REST API where policy name contains blank spaces at the start or end of policy name.
3. Visited 'x_policy' table to verify that whether policies contains spaces or not. 

**Expected behaviour :**
Policies should not have blank spaces at the start or end of policy name.

**Actual behaviour :**
Policies did not have blank spaces at the start or end of policy name.


Thanks,

Pradeep Agrawal


Re: Review Request 48023: RANGER-998 : Trim policy name in create/update policy request

Posted by Velmurugan Periasamy <vp...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48023/#review135507
-----------------------------------------------------------


Fix it, then Ship it!




Fix and Ship it


security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePersmission_J10005.java (line 17)
<https://reviews.apache.org/r/48023/#comment200499>

    Can you correct typo on the class name and file name? - PatchTagModulePersmission_J10005.java


- Velmurugan Periasamy


On May 30, 2016, 6:09 a.m., Pradeep Agrawal wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48023/
> -----------------------------------------------------------
> 
> (Updated May 30, 2016, 6:09 a.m.)
> 
> 
> Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Selvamohan Neethiraj, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-998
>     https://issues.apache.org/jira/browse/RANGER-998
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> **Problem Statement: **
> Currently only at UI end only policy name is trimmed, policy name should be trimmed at server end also.
> 
> **Proposed Solution: **
> Proposed solution will trim policy name before storing policy name in x_policy table.
> 
> 
> **Note:** Sample curl request to create policy having blank spaces at the start or end of policy name.
> 
> curl -i -u admin:admin  --header "Accept:application/json" -H "Content-Type:application/json" -X POST http://localhost:6080/service/plugins/policies -d '{"policyType":"0","name":"  cl1_hive_policy3   ","isEnabled":true,"description":"","isAuditEnabled":true,"resources":{"database":{"values":["cl1_hive_policy3"],"isRecursive":false,"isExcludes":false},"table":{"values":["abc3"],"isRecursive":false,"isExcludes":false},"column":{"values":["dfgh3"],"isRecursive":false,"isExcludes":false}},"policyItems":[{"users":["admin"],"accesses":[{"type":"select","isAllowed":true},{"type":"update","isAllowed":true},{"type":"create","isAllowed":true},{"type":"drop","isAllowed":true},{"type":"alter","isAllowed":true},{"type":"index","isAllowed":true},{"type":"lock","isAllowed":true},{"type":"all","isAllowed":true}]}],"denyPolicyItems":[],"allowExceptions":[],"denyExceptions":[],"service":"cl1_hive"}'
> 
> 
> Diffs
> -----
> 
>   security-admin/src/main/java/org/apache/ranger/biz/RangerPolicyRetriever.java 6b4b149 
>   security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java 2f88a9b 
>   security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java 4343c45 
>   security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePersmission_J10005.java bda4b30 
>   security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 4432bac 
>   security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 19a1509 
>   security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java 630be4f 
>   security-admin/src/main/java/org/apache/ranger/service/XPolicyService.java 5e8ed56 
> 
> Diff: https://reviews.apache.org/r/48023/diff/
> 
> 
> Testing
> -------
> 
> ***Case-1 : Upgrade Case***
> **Steps performed: **
> 1. Installed Ranger admin 0.5 version and started Ranger admin.
> 2. Created policies using REST API where policy name contains blank spaces at the start or end of policy name.
> 3. Visited 'x_policy' table and confirmed that policies created with blank spaces are persisted in table. 
> 4. Stopped Ranger Admin.
> 5. Created Build of latest Ranger-admin with patch and Installed Ranger Admin with DB details used during installation of Ranger 0.5.
> 6. After installation confirmed that PatchTagModulePersmission_J10005.class is executed sucessfully.
> 7. Visited x_policy table to make sure policies created with spaces in policy name are trimmed or not.
> 
> **Expected behaviour :**
> Policies should not have blank spaces at the start or end of policy name.
> 
> **Actual behaviour :**
> Policies did not have blank spaces at the start or end of policy name.
> 
> 
> ***Case-2 : Latest Ranger with patch***
> **Steps performed: **
> 1. Installed Ranger admin with patch and started Ranger admin.
> 2. Tried to create policies using REST API where policy name contains blank spaces at the start or end of policy name.
> 3. Visited 'x_policy' table to verify that whether policies contains spaces or not. 
> 
> **Expected behaviour :**
> Policies should not have blank spaces at the start or end of policy name.
> 
> **Actual behaviour :**
> Policies did not have blank spaces at the start or end of policy name.
> 
> 
> Thanks,
> 
> Pradeep Agrawal
> 
>


Re: Review Request 48023: RANGER-998 : Trim policy name in create/update policy request

Posted by Velmurugan Periasamy <vp...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48023/#review135597
-----------------------------------------------------------


Ship it!




Ship It!

- Velmurugan Periasamy


On May 31, 2016, 4:30 a.m., Pradeep Agrawal wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48023/
> -----------------------------------------------------------
> 
> (Updated May 31, 2016, 4:30 a.m.)
> 
> 
> Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Selvamohan Neethiraj, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-998
>     https://issues.apache.org/jira/browse/RANGER-998
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> **Problem Statement: **
> Currently only at UI end only policy name is trimmed, policy name should be trimmed at server end also.
> 
> **Proposed Solution: **
> Proposed solution will trim policy name before storing policy name in x_policy table.
> 
> 
> **Note:** Sample curl request to create policy having blank spaces at the start or end of policy name.
> 
> curl -i -u admin:admin  --header "Accept:application/json" -H "Content-Type:application/json" -X POST http://localhost:6080/service/plugins/policies -d '{"policyType":"0","name":"  cl1_hive_policy3   ","isEnabled":true,"description":"","isAuditEnabled":true,"resources":{"database":{"values":["cl1_hive_policy3"],"isRecursive":false,"isExcludes":false},"table":{"values":["abc3"],"isRecursive":false,"isExcludes":false},"column":{"values":["dfgh3"],"isRecursive":false,"isExcludes":false}},"policyItems":[{"users":["admin"],"accesses":[{"type":"select","isAllowed":true},{"type":"update","isAllowed":true},{"type":"create","isAllowed":true},{"type":"drop","isAllowed":true},{"type":"alter","isAllowed":true},{"type":"index","isAllowed":true},{"type":"lock","isAllowed":true},{"type":"all","isAllowed":true}]}],"denyPolicyItems":[],"allowExceptions":[],"denyExceptions":[],"service":"cl1_hive"}'
> 
> 
> Diffs
> -----
> 
>   security-admin/src/main/java/org/apache/ranger/biz/RangerPolicyRetriever.java 6b4b149 
>   security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java c488d4a 
>   security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java 4343c45 
>   security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePermission_J10005.java PRE-CREATION 
>   security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePersmission_J10005.java bda4b30 
>   security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 4432bac 
>   security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 886e78f 
>   security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java 630be4f 
>   security-admin/src/main/java/org/apache/ranger/service/XPolicyService.java 5e8ed56 
> 
> Diff: https://reviews.apache.org/r/48023/diff/
> 
> 
> Testing
> -------
> 
> ***Case-1 : Upgrade Case***
> **Steps performed: **
> 1. Installed Ranger admin 0.5 version and started Ranger admin.
> 2. Created policies using REST API where policy name contains blank spaces at the start or end of policy name.
> 3. Visited 'x_policy' table and confirmed that policies created with blank spaces are persisted in table. 
> 4. Stopped Ranger Admin.
> 5. Created Build of latest Ranger-admin with patch and Installed Ranger Admin with DB details used during installation of Ranger 0.5.
> 6. After installation confirmed that PatchTagModulePersmission_J10005.class is executed sucessfully.
> 7. Visited x_policy table to make sure policies created with spaces in policy name are trimmed or not.
> 
> **Expected behaviour :**
> Policies should not have blank spaces at the start or end of policy name.
> 
> **Actual behaviour :**
> Policies did not have blank spaces at the start or end of policy name.
> 
> 
> ***Case-2 : Latest Ranger with patch***
> **Steps performed: **
> 1. Installed Ranger admin with patch and started Ranger admin.
> 2. Tried to create policies using REST API where policy name contains blank spaces at the start or end of policy name.
> 3. Visited 'x_policy' table to verify that whether policies contains spaces or not. 
> 
> **Expected behaviour :**
> Policies should not have blank spaces at the start or end of policy name.
> 
> **Actual behaviour :**
> Policies did not have blank spaces at the start or end of policy name.
> 
> 
> Thanks,
> 
> Pradeep Agrawal
> 
>


Re: Review Request 48023: RANGER-998 : Trim policy name in create/update policy request

Posted by Pradeep Agrawal <pr...@freestoneinfotech.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48023/
-----------------------------------------------------------

(Updated May 31, 2016, 4:30 a.m.)


Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Selvamohan Neethiraj, and Velmurugan Periasamy.


Changes
-------

Addressed review comment


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


Repository: ranger


Description
-------

**Problem Statement: **
Currently only at UI end only policy name is trimmed, policy name should be trimmed at server end also.

**Proposed Solution: **
Proposed solution will trim policy name before storing policy name in x_policy table.


**Note:** Sample curl request to create policy having blank spaces at the start or end of policy name.

curl -i -u admin:admin  --header "Accept:application/json" -H "Content-Type:application/json" -X POST http://localhost:6080/service/plugins/policies -d '{"policyType":"0","name":"  cl1_hive_policy3   ","isEnabled":true,"description":"","isAuditEnabled":true,"resources":{"database":{"values":["cl1_hive_policy3"],"isRecursive":false,"isExcludes":false},"table":{"values":["abc3"],"isRecursive":false,"isExcludes":false},"column":{"values":["dfgh3"],"isRecursive":false,"isExcludes":false}},"policyItems":[{"users":["admin"],"accesses":[{"type":"select","isAllowed":true},{"type":"update","isAllowed":true},{"type":"create","isAllowed":true},{"type":"drop","isAllowed":true},{"type":"alter","isAllowed":true},{"type":"index","isAllowed":true},{"type":"lock","isAllowed":true},{"type":"all","isAllowed":true}]}],"denyPolicyItems":[],"allowExceptions":[],"denyExceptions":[],"service":"cl1_hive"}'


Diffs (updated)
-----

  security-admin/src/main/java/org/apache/ranger/biz/RangerPolicyRetriever.java 6b4b149 
  security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java c488d4a 
  security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java 4343c45 
  security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePermission_J10005.java PRE-CREATION 
  security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePersmission_J10005.java bda4b30 
  security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 4432bac 
  security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 886e78f 
  security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java 630be4f 
  security-admin/src/main/java/org/apache/ranger/service/XPolicyService.java 5e8ed56 

Diff: https://reviews.apache.org/r/48023/diff/


Testing
-------

***Case-1 : Upgrade Case***
**Steps performed: **
1. Installed Ranger admin 0.5 version and started Ranger admin.
2. Created policies using REST API where policy name contains blank spaces at the start or end of policy name.
3. Visited 'x_policy' table and confirmed that policies created with blank spaces are persisted in table. 
4. Stopped Ranger Admin.
5. Created Build of latest Ranger-admin with patch and Installed Ranger Admin with DB details used during installation of Ranger 0.5.
6. After installation confirmed that PatchTagModulePersmission_J10005.class is executed sucessfully.
7. Visited x_policy table to make sure policies created with spaces in policy name are trimmed or not.

**Expected behaviour :**
Policies should not have blank spaces at the start or end of policy name.

**Actual behaviour :**
Policies did not have blank spaces at the start or end of policy name.


***Case-2 : Latest Ranger with patch***
**Steps performed: **
1. Installed Ranger admin with patch and started Ranger admin.
2. Tried to create policies using REST API where policy name contains blank spaces at the start or end of policy name.
3. Visited 'x_policy' table to verify that whether policies contains spaces or not. 

**Expected behaviour :**
Policies should not have blank spaces at the start or end of policy name.

**Actual behaviour :**
Policies did not have blank spaces at the start or end of policy name.


Thanks,

Pradeep Agrawal


Re: Review Request 48023: RANGER-998 : Trim policy name in create/update policy request

Posted by Pradeep Agrawal <pr...@freestoneinfotech.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48023/
-----------------------------------------------------------

(Updated May 30, 2016, 6:09 a.m.)


Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Selvamohan Neethiraj, and Velmurugan Periasamy.


Changes
-------

updated Bug reference number


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


Repository: ranger


Description
-------

**Problem Statement: **
Currently only at UI end only policy name is trimmed, policy name should be trimmed at server end also.

**Proposed Solution: **
Proposed solution will trim policy name before storing policy name in x_policy table.


**Note:** Sample curl request to create policy having blank spaces at the start or end of policy name.

curl -i -u admin:admin  --header "Accept:application/json" -H "Content-Type:application/json" -X POST http://localhost:6080/service/plugins/policies -d '{"policyType":"0","name":"  cl1_hive_policy3   ","isEnabled":true,"description":"","isAuditEnabled":true,"resources":{"database":{"values":["cl1_hive_policy3"],"isRecursive":false,"isExcludes":false},"table":{"values":["abc3"],"isRecursive":false,"isExcludes":false},"column":{"values":["dfgh3"],"isRecursive":false,"isExcludes":false}},"policyItems":[{"users":["admin"],"accesses":[{"type":"select","isAllowed":true},{"type":"update","isAllowed":true},{"type":"create","isAllowed":true},{"type":"drop","isAllowed":true},{"type":"alter","isAllowed":true},{"type":"index","isAllowed":true},{"type":"lock","isAllowed":true},{"type":"all","isAllowed":true}]}],"denyPolicyItems":[],"allowExceptions":[],"denyExceptions":[],"service":"cl1_hive"}'


Diffs
-----

  security-admin/src/main/java/org/apache/ranger/biz/RangerPolicyRetriever.java 6b4b149 
  security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java 2f88a9b 
  security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java 4343c45 
  security-admin/src/main/java/org/apache/ranger/patch/PatchTagModulePersmission_J10005.java bda4b30 
  security-admin/src/main/java/org/apache/ranger/rest/PublicAPIsv2.java 4432bac 
  security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java 19a1509 
  security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java 630be4f 
  security-admin/src/main/java/org/apache/ranger/service/XPolicyService.java 5e8ed56 

Diff: https://reviews.apache.org/r/48023/diff/


Testing
-------

***Case-1 : Upgrade Case***
**Steps performed: **
1. Installed Ranger admin 0.5 version and started Ranger admin.
2. Created policies using REST API where policy name contains blank spaces at the start or end of policy name.
3. Visited 'x_policy' table and confirmed that policies created with blank spaces are persisted in table. 
4. Stopped Ranger Admin.
5. Created Build of latest Ranger-admin with patch and Installed Ranger Admin with DB details used during installation of Ranger 0.5.
6. After installation confirmed that PatchTagModulePersmission_J10005.class is executed sucessfully.
7. Visited x_policy table to make sure policies created with spaces in policy name are trimmed or not.

**Expected behaviour :**
Policies should not have blank spaces at the start or end of policy name.

**Actual behaviour :**
Policies did not have blank spaces at the start or end of policy name.


***Case-2 : Latest Ranger with patch***
**Steps performed: **
1. Installed Ranger admin with patch and started Ranger admin.
2. Tried to create policies using REST API where policy name contains blank spaces at the start or end of policy name.
3. Visited 'x_policy' table to verify that whether policies contains spaces or not. 

**Expected behaviour :**
Policies should not have blank spaces at the start or end of policy name.

**Actual behaviour :**
Policies did not have blank spaces at the start or end of policy name.


Thanks,

Pradeep Agrawal