diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java index 6851c7d6758..954d4c4d1f0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java @@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.CoprocessorEnvironment; import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.KeyValue.Type; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HRegionInfo; @@ -526,8 +527,15 @@ public class AccessController extends BaseRegionObserver if (list == null || list.isEmpty()) { get.addFamily(col); } else { - for (Cell cell: list) { - get.addColumn(col, CellUtil.cloneQualifier(cell)); + // In case of family delete, a Cell will be added into the list with Qualifier as null. + for (Cell cell : list) { + if (cell.getQualifierLength() == 0 + && (cell.getTypeByte() == Type.DeleteFamily.getCode() + || cell.getTypeByte() == Type.DeleteFamilyVersion.getCode())) { + get.addFamily(col); + } else { + get.addColumn(col, CellUtil.cloneQualifier(cell)); + } } } } else { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java index efa020394ae..fa21b4c85da 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java @@ -1315,6 +1315,21 @@ public class TestAccessController extends SecureTestUtil { return null; } }); + // user1 should be allowed to delete the cf. (All data under cf for a row) + user1.runAs(new PrivilegedExceptionAction() { + @Override + public Void run() throws Exception { + HTable t = new HTable(conf, TEST_TABLE.getTableName()); + try { + Delete d = new Delete(TEST_ROW2); + d.deleteFamily(TEST_FAMILY); + t.delete(d); + } finally { + t.close(); + } + return null; + } + }); } @Test