Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2518#discussion_r182954434
  
    --- Diff: 
nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/VisibilityFetchSupport.java
 ---
    @@ -0,0 +1,53 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.hbase;
    +
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.components.Validator;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.util.StringUtils;
    +
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +public interface VisibilityFetchSupport {
    +    PropertyDescriptor AUTHORIZATIONS = new PropertyDescriptor.Builder()
    +        .name("hbase-fetch-row-authorizations")
    +        .displayName("Authorizations")
    +        .description("The list of authorizations to pass to the scanner. 
This will be ignored if cell visibility labels are not in use.")
    --- End diff --
    
    @MikeThomsen Thanks for clarifying. To understand the feature more, I have 
done following test using HBase shell:
    
    ```
    # Created test table, and define labels
    create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
    add_labels [ 'admin', 'service', 'developer', 'test' ]
    
    # Setup nifi user
    grant 'nifi', 'RW', 't1'
    set_auths 'nifi', ['test', 'developer']
    
    # Added some cells with different Visibility Labels
    put 't1', 'r1', 'f1:c1', 'value-f1:c1', {VISIBILITY=>'admin|test'}
    put 't1', 'r1', 'f1:c2', 'value-f1:c2', {VISIBILITY=>'admin'}
    put 't1', 'r1', 'f1:c3', 'value-f1:c3', {VISIBILITY=>'test'}
    put 't1', 'r1', 'f1:c4', 'value-f1:c4', {VISIBILITY=>'developer'}
    put 't1', 'r1', 'f1:c5', 'value-f1:c5', {VISIBILITY=>'test&developer'}
    ```
    
    ```
    # == 1 ==
    # Scan with 'nifi' user, without specifying any label
    # 'c2' can not be read because 'nifi' is not associated with 'admin'
    ROW                                    COLUMN+CELL
     r1                                    column=f1:c1, 
timestamp=1524108017481, value=value-f1:c1
     r1                                    column=f1:c3, 
timestamp=1524108086777, value=value-f1:c3
     r1                                    column=f1:c4, 
timestamp=1524112589432, value=value-f1:c4
     r1                                    column=f1:c5, 
timestamp=1524203679856, value=value-f1:c5
    1 row(s) in 0.0310 seconds
    ```
    
    ```
    # == 2 ==
    # Scan with 'nifi' and 'test' label
    # 'c5' can not be read because it also needs 'developer' label.
    hbase(main):016:0* scan 't1', {AUTHORIZATIONS => ['test']}
    ROW                                    COLUMN+CELL
     r1                                    column=f1:c1, 
timestamp=1524108017481, value=value-f1:c1
     r1                                    column=f1:c3, 
timestamp=1524108086777, value=value-f1:c3
    1 row(s) in 0.0160 seconds
    ```
    
    ```
    # == 3 ==
    # Specify both 'test' and 'developer', result equals the one without any 
label
    hbase(main):017:0> scan 't1', {AUTHORIZATIONS => ['test', 'developer']}
    ROW                                    COLUMN+CELL
     r1                                    column=f1:c1, 
timestamp=1524108017481, value=value-f1:c1
     r1                                    column=f1:c3, 
timestamp=1524108086777, value=value-f1:c3
     r1                                    column=f1:c4, 
timestamp=1524112589432, value=value-f1:c4
     r1                                    column=f1:c5, 
timestamp=1524203679856, value=value-f1:c5
    1 row(s) in 0.0120 seconds
    ```
    
    ```
    # == 4 ==
    # Specifying label like this does not return anything.
    hbase(main):018:0> scan 't1', {AUTHORIZATIONS => ['test&developer']}
    ROW                                    COLUMN+CELL
    0 row(s) in 0.0050 seconds
    ```
    
    I think what people configure at the current 'AUTHORIZATIONS' property is 
not an authorizations but labels. IMHO, HBase shell command parameter name does 
not sound natural to me.. especially for Scan and Delete. My understandings are:
    
    - When `Put` a cell, `Visibility Label Expression` can be added, which 
consists of one or more Visibility Labels combined with logical operators such 
as '|', '&' or '!'.
    - When `Scan` cells, `Visibility Labels` can be specified. Multiple labels 
can be specified as a comma separated string. If not specified, all of 
Visibility Labels associated with the user is used. Unassociated labels are 
dropped. This can be used to filter scan results.
    - `Delete` is same as `Scan`. `Visibility Labels` can filter which cells to 
delete.
    - With 'Get', `Visibility Labels` is not used.
    
    My concern is, naming such parameter as 'Authorizations', it sounds as if 
users need to set something. Actually Authorization can be done correctly if 
user leaves the parameter blank.
    Do you still think 'Authorizations' is the better naming??


---

Reply via email to