You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Abhay Kulkarni <ak...@hortonworks.com> on 2018/03/15 22:55:24 UTC

Review Request 66106: Update Hbase plugin to handle default namespace

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

Review request for ranger and Madhan Neethiraj.


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


Repository: ranger


Description
-------

HBase supports a "default" namespace in which Hbase tables are implicitly present when namespace is not explicitly specified. Ranger Hbase policies with table-resource specified with or without a "default" namespace qualifier should match if a table in default namespace is accessed with or without "default" namespace qualifier.


Diffs
-----

  hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java 1349aef9e 
  hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HBaseRangerAuthorizationTest.java 665640f07 
  hbase-agent/src/test/resources/hbase-policies-tag.json 61728c800 


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


Testing
-------

Passed all unit tests.


Thanks,

Abhay Kulkarni


Re: Review Request 66106: Update Hbase plugin to handle default namespace

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

(Updated March 18, 2018, 10:03 p.m.)


Review request for ranger and Madhan Neethiraj.


Changes
-------

Addressed review comments


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


Repository: ranger


Description
-------

HBase supports a "default" namespace in which Hbase tables are implicitly present when namespace is not explicitly specified. Ranger Hbase policies with table-resource specified with or without a "default" namespace qualifier should match if a table in default namespace is accessed with or without "default" namespace qualifier.


Diffs (updated)
-----

  hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java 1349aef9e 
  hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java d7b46735d 
  hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerHBaseResource.java PRE-CREATION 
  hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HBaseRangerAuthorizationTest.java 665640f07 
  hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java 9f0e5ac87 
  hbase-agent/src/test/resources/hbase-policies-tag.json 61728c800 
  hbase-agent/src/test/resources/policyengine/test_policyengine_hbase.json f563c2850 


Diff: https://reviews.apache.org/r/66106/diff/3/

Changes: https://reviews.apache.org/r/66106/diff/2-3/


Testing
-------

Passed all unit tests.


Thanks,

Abhay Kulkarni


Re: Review Request 66106: Update Hbase plugin to handle default namespace

Posted by Madhan Neethiraj <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66106/#review199375
-----------------------------------------------------------


Fix it, then Ship it!





hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java
Line 188 (original), 188 (patched)
<https://reviews.apache.org/r/66106/#comment279685>

    Consider replacing strings "table", "column-family" and "column" with following constants introduced in this patch:
      
      RangerHBaseResource.KEY_TABLE
      RangerHBaseResource.KEY_COLUMN_FAMILY
      RangerHBaseResource.KEY_COLUMNS



hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerHbaseResource.java
Lines 31 (patched)
<https://reviews.apache.org/r/66106/#comment279686>

    Consider renaming "RangerHbaseResource" to "RangerHBaseResource".



hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerHbaseResource.java
Lines 36 (patched)
<https://reviews.apache.org/r/66106/#comment279683>

    Please update for indentation (tabs/spaces?)



hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerHbaseResource.java
Lines 52 (patched)
<https://reviews.apache.org/r/66106/#comment279684>

    Consider the following rewrite, to make it a little easier to read:
    
    public void setValue(String key, Object value) {
      // special handling for tables in 'default' namespace
      if (StringUtils.equals(key, KEY_TABLE)) {
        if (value instanceof String) {
          String tableName = (String) value;
    
          if (!tableName.contains(NAMESPACE_SEPARATOR)) {
            List<String> tableNames = new ArrayList<>(2);
    
            tableNames.add(tableName);
            tableNames.add(DEFAULT_NAMESPACE + tableName);
    
            value = tableNames;
          } else if (StringUtil.startsWith(tableName, DEFAULT_NAMESPACE) {
            List<String> tableNames = new ArrayList<>(2);
    
            tableNames.add(tableName.substring(DEFAULT_NAMESPACE.length());
            tableNames.add(tableName);
    
            value = tableNames;
          }
        }
      }
      
      super.setValue(key, value);
    }


- Madhan Neethiraj


On March 16, 2018, 11:08 p.m., Abhay Kulkarni wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66106/
> -----------------------------------------------------------
> 
> (Updated March 16, 2018, 11:08 p.m.)
> 
> 
> Review request for ranger and Madhan Neethiraj.
> 
> 
> Bugs: RANGER-2026
>     https://issues.apache.org/jira/browse/RANGER-2026
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> HBase supports a "default" namespace in which Hbase tables are implicitly present when namespace is not explicitly specified. Ranger Hbase policies with table-resource specified with or without a "default" namespace qualifier should match if a table in default namespace is accessed with or without "default" namespace qualifier.
> 
> 
> Diffs
> -----
> 
>   hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java 1349aef9e 
>   hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerHbaseResource.java PRE-CREATION 
>   hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HBaseRangerAuthorizationTest.java 665640f07 
>   hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java 9f0e5ac87 
>   hbase-agent/src/test/resources/hbase-policies-tag.json 61728c800 
>   hbase-agent/src/test/resources/policyengine/test_policyengine_hbase.json f563c2850 
> 
> 
> Diff: https://reviews.apache.org/r/66106/diff/2/
> 
> 
> Testing
> -------
> 
> Passed all unit tests.
> 
> 
> Thanks,
> 
> Abhay Kulkarni
> 
>


Re: Review Request 66106: Update Hbase plugin to handle default namespace

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

(Updated March 16, 2018, 11:08 p.m.)


Review request for ranger and Madhan Neethiraj.


Changes
-------

Added Hbase specific resource class, added unit tests


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


Repository: ranger


Description
-------

HBase supports a "default" namespace in which Hbase tables are implicitly present when namespace is not explicitly specified. Ranger Hbase policies with table-resource specified with or without a "default" namespace qualifier should match if a table in default namespace is accessed with or without "default" namespace qualifier.


Diffs (updated)
-----

  hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java 1349aef9e 
  hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerHbaseResource.java PRE-CREATION 
  hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/HBaseRangerAuthorizationTest.java 665640f07 
  hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/TestPolicyEngine.java 9f0e5ac87 
  hbase-agent/src/test/resources/hbase-policies-tag.json 61728c800 
  hbase-agent/src/test/resources/policyengine/test_policyengine_hbase.json f563c2850 


Diff: https://reviews.apache.org/r/66106/diff/2/

Changes: https://reviews.apache.org/r/66106/diff/1-2/


Testing
-------

Passed all unit tests.


Thanks,

Abhay Kulkarni