private static void checkPermissions(Configuration conf, Permission... perms) throws IOException {
    try (Connection conn = ConnectionFactory.createConnection(conf)) {
      List<Boolean> hasUserPermissions =
        conn.getAdmin().hasUserPermissions(Lists.newArrayList(perms));
      for (int i = 0; i < hasUserPermissions.size(); i++) {
        if (!hasUserPermissions.get(i).booleanValue()) {
          throw new AccessDeniedException("Insufficient permissions " + perms[i]);
        }
      }
    }
  }
Revoke global permissions from the given user using AccessControlClient. Will wait until all
active AccessController instances have updated their permissions caches or will throw an
exception upon timeout (10 seconds).
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/SecureTestUtil.java