public static void grantGlobal(final User caller, final HBaseTestingUtil util, final String user,
    final Permission.Action... actions) throws Exception {
    SecureTestUtil.updateACLs(util, new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        Configuration conf = util.getConfiguration();
        try (Connection connection = ConnectionFactory.createConnection(conf, caller)) {
          connection.getAdmin().grant(
            new UserPermission(user, Permission.newBuilder().withActions(actions).build()), false);
        }
        return null;
      }
    });
  }
Grant permissions globally to the given user. 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