Riemannian geometry of quantum groups and finite groups with nonuniversal differentials