private void validateGlobalUserACLForGetUserPermissions(final Connection conn, User nSUser1,
    User globalGroupUser1, User globalGroupUser2, Collection<String> superUsers, int superUserCount)
    throws Throwable {
    // Verify action privilege
    AccessTestAction globalUserPermissionAction = new AccessTestAction() {
      @Override
      public Object run() throws Exception {
        try (Connection conn = ConnectionFactory.createConnection(conf)) {
          conn.getAdmin().getUserPermissions(
            GetUserPermissionsRequest.newBuilder().withUserName("dummy").build());
        }
        return null;
      }
    };
    verifyAllowed(globalUserPermissionAction, SUPERUSER, USER_ADMIN, USER_GROUP_ADMIN);
    verifyDenied(globalUserPermissionAction, USER_GROUP_CREATE, USER_GROUP_READ, USER_GROUP_WRITE);

    // Validate global user permission
    List<UserPermission> userPermissions;
    assertEquals(6 + superUserCount, AccessControlClient.getUserPermissions(conn, null).size());
    assertEquals(6 + superUserCount,
      AccessControlClient.getUserPermissions(conn, HConstants.EMPTY_STRING).size());
    assertEquals(6 + superUserCount,
      AccessControlClient.getUserPermissions(conn, null, HConstants.EMPTY_STRING).size());
    userPermissions = AccessControlClient.getUserPermissions(conn, null, USER_ADMIN.getName());
    verifyGetUserPermissionResult(userPermissions, 1, null, null, USER_ADMIN.getName(), superUsers);
    assertEquals(0, AccessControlClient.getUserPermissions(conn, null, nSUser1.getName()).size());
    // Global group user ACL
    assertEquals(1,
      AccessControlClient.getUserPermissions(conn, null, globalGroupUser1.getName()).size());
    assertEquals(2,
      AccessControlClient.getUserPermissions(conn, null, globalGroupUser2.getName()).size());
  }
List all user permissions match the given regular expression for namespace and verify each of
them.
@param namespaceRegexWithoutPrefix the regualar expression for namespace, without
                                   NAMESPACE_PREFIX
@param expectedAmount              the expected amount of user permissions returned
@param expectedNamespace           the expected namespace of each user permission returned
@throws HBaseException in the case of any HBase exception when accessing hbase:acl table
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java