[ 
https://issues.apache.org/jira/browse/HBASE-10619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14486424#comment-14486424
 ] 

Srikanth Srungarapu commented on HBASE-10619:
---------------------------------------------

Nice refactoring of helper methods. Just a minor thing
{code}
+    if (tableName.equals(TableName.META_TABLE_NAME)) {
+      throw new ConstraintException("Cannot disable " + 
TableName.META_TABLE_NAME + " table");
+    }
+    if (tableName.equals(TableName.NAMESPACE_TABLE_NAME)) {
+      throw new ConstraintException("Cannot disable " + 
TableName.NAMESPACE_TABLE_NAME + " table");
+    }
+    if (tableName.isSystemTable()) {
+      User user = UserUtil.getActiveUser();
+      if (!UserUtil.isSuperUser(user, this.superUsers, this.superGroups)) {
+        throw new ConstraintException("User : " + user.getShortName()
+            + " can't disable tables in '" + 
NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR
+            + "' namespace");
+      }
+    }
{code}
How about using else-ifs  here?

> Don't allow non super users to do DDL ops on system tables
> ----------------------------------------------------------
>
>                 Key: HBASE-10619
>                 URL: https://issues.apache.org/jira/browse/HBASE-10619
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John
>         Attachments: HBASE-10619.patch, HBASE-10619_V2.patch, 
> HBASE-10619_V3.patch, HBASE-10619_V4.patch, HBASE-10619_V5.patch, 
> HBASE-10619_V6.patch
>
>
> Don't allow non super users to do DDL ops on system tables
> For META and NS tables, we should allow them to be disabled even by super 
> users.  With out these tables online the cluster will be non operational.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to