ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madhan Neethiraj <mad...@apache.org>
Subject Re: Review Request 66106: Update Hbase plugin to handle default namespace
Date Sat, 17 Mar 2018 21:08:27 GMT

-----------------------------------------------------------
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
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message